Minsky
minsky::RESTMinsky Struct Reference

#include <RESTMinsky.h>

Inheritance diagram for minsky::RESTMinsky:
Inheritance graph
Collaboration diagram for minsky::RESTMinsky:
Collaboration graph

Public Member Functions

CmdData getCommandData (const std::string &) const override
 return meta information on a given command More...
 
template<class RP >
void commandHook (const std::string &command, const RP &args)
 
 RESTMinsky ()
 
- Public Member Functions inherited from minsky::Minsky
void addNewPublicationTab (const std::string &name)
 
void addCanvasItemToPublicationTab (size_t i)
 
bool multipleEquities () const
 
bool multipleEquities (const bool &m)
 
bool edited () const
 reflects whether the model has been changed since last save More...
 
bool reset_flag () const
 true if reset needs to be called prior to numerical integration More...
 
void markEdited ()
 indicate model has been changed since last saved More...
 
void requestReset ()
 
void requestRedraw ()
 requests a redraw of the curren active tab More...
 
bool resetIfFlagged () override
 checks whether a reset is required, and resets the simulation if so More...
 
void populateMissingDimensions ()
 fills in dimensions table with all loaded ravel axes More...
 
void populateMissingDimensionsFromVariable (const VariableValue &, bool &incompatibleMessageDisplayed)
 populate missing dimensions from a variableValue More...
 
void populateMissingDimensionsFromVariable (const VariableValue &v)
 
void renameDimension (const std::string &oldName, const std::string &newName)
 
void setGodleyIconResource (const string &s)
 
void setGroupIconResource (const string &s)
 
void setLockIconResource (const string &locked, const string &unlocked)
 
void setRavelIconResource (const string &s)
 
std::set< string > matchingTableColumns (const GodleyIcon &currTable, GodleyAssetClass::AssetClass ac)
 
void importDuplicateColumn (GodleyTable &srcTable, int srcCol)
 find any duplicate column, and use it as a source column for balanceDuplicateColumns More...
 
void balanceDuplicateColumns (const GodleyIcon &srcTable, int srcCol)
 makes all duplicated columns consistent with srcTable, srcCol More...
 
std::vector< std::string > allGodleyFlowVars () const
 
 Minsky ()
 
 ~Minsky ()
 
void clearAllMaps (bool clearHistory)
 
void clearAllMaps ()
 
void clearAllMapsTCL ()
 
VariablePtr definingVar (const std::string &valueId) const
 returns reference to variable defining (ie input wired) for valueId More...
 
void saveCanvasItemAsFile (const string &fileName) const
 
void initGodleys ()
 
void cut ()
 erase items in current selection, put copy into clipboard More...
 
void copy () const
 copy items in current selection into clipboard More...
 
void paste ()
 paste clipboard as a new group or ungrouped items on the canvas. canvas.itemFocus is set to refer to the new group or items. More...
 
bool clipboardEmpty () const
 return true if nothing available in clipboard More...
 
void saveSelectionAsFile (const string &fileName) const
 
void insertGroupFromFile (const string &file)
 
void makeVariablesConsistent ()
 
void imposeDimensions ()
 
void garbageCollect ()
 
bool cycleCheck () const
 checks for presence of illegal cycles in network. Returns true if there are some More...
 
void openLogFile (const string &)
 opens the log file, and writes out a header line describing names of all variables More...
 
void closeLogFile ()
 closes log file More...
 
bool loggingEnabled () const
 returns true if logging is in operation More...
 
void constructEquations ()
 construct the equations based on input data More...
 
void dimensionalAnalysis () const
 performs dimension analysis, throws if there is a problem More...
 
void deleteAllUnits ()
 removes units markup from all variables in model More...
 
bool checkEquationOrder () const
 consistency check of the equation order. Should return true. Outputs the operation number of the invalidly ordered operation. More...
 
double deltaT () const
 
void reset ()
 resets the variables back to their initial values More...
 
std::vector< double > step ()
 step the equations (by n steps, default 1) More...
 
void save (const std::string &filename)
 
void load (const std::string &filename)
 load from a file More...
 
void exportSchema (const std::string &filename, int schemaLevel=1)
 
void displayErrorItem (const Item &op) const
 indicate operation item has error, if visible, otherwise contining group More...
 
std::string ecolabVersion () const
 
std::string ravelVersion () const
 
std::string autoSaveFile () const
 name of an auto save file More...
 
void setAutoSaveFile (const std::string &file)
 initialises auto saving empty file to turn off autosave More...
 
void clearHistory ()
 clear history More...
 
void checkPushHistory ()
 called periodically to ensure history up to date More...
 
bool pushHistory ()
 push current model state onto history if it differs from previous More...
 
bool commandHook (const std::string &command, unsigned nargs)
 Executed after each interpreter command to maintain undo/redo stack, edited flag, autosaving etc. More...
 
long undo (int changes=1)
 restore model to state changes ago More...
 
void convertVarType (const std::string &name, VariableType::Type type)
 Converts variable(s) named by name into a variable of type type. More...
 
void addIntegral ()
 add integral to current canvas item (which must be variable convertible to an integral variable More...
 
bool inputWired (const std::string &name) const
 returns true if any variable of name name has a wired input More...
 
void renderCanvasToPS (const std::string &filename)
 render canvas to a postscript file More...
 
void renderCanvasToPDF (const std::string &filename)
 render canvas to a PDF file More...
 
void renderCanvasToSVG (const std::string &filename)
 render canvas to an SVG file More...
 
void renderCanvasToPNG (const std::string &filename)
 render canvas to a PNG image file More...
 
void renderCanvasToPNG (const std::string &filename, const Canvas::ZoomCrop &z)
 Render canvas to a PNG file filename, scaling the canvas temporarily by zoom, shifts it to left, top, and crops to width, height (in ZoomCrop struct). More...
 
void renderCanvasToEMF (const std::string &filename)
 render canvas to a EMF image file (Windows only) More...
 
void renderAllPlotsAsSVG (const string &prefix) const
 render all plots More...
 
void exportAllPlotsAsCSV (const string &prefix) const
 export all plots More...
 
void setAllDEmode (bool)
 set DE mode on all godley tables More...
 
void srand (int seed)
 set std library RNG seed More...
 
void setGodleyDisplayValue (bool displayValues, GodleyTable::DisplayStyle displayStyle)
 set display value mode on all godley table editor modes More...
 
void importVensim (const std::string &)
 import a Vensim file More...
 
void redrawAllGodleyTables ()
 request all Godley table windows to redraw More...
 
virtual void setBusyCursor ()
 set/clear busy cursor in GUI More...
 
virtual void clearBusyCursor ()
 
virtual void progress (const std::string &title, int)
 set progress bar, out of 100, labelling the progress bar with title More...
 
virtual void bookmarkRefresh ()
 refresh the bookmark menu after changes More...
 
virtual void resetScroll ()
 reset main window scroll bars after model has been panned More...
 
virtual void message (const std::string &)
 display a message in a popup box on the GUI More...
 
virtual void runItemDeletedCallback (const Item &)
 run callback attached to item More...
 
virtual MemCheckResult checkMemAllocation (size_t bytes) const
 
std::size_t physicalMem () const
 returns amount of memory installed on system More...
 
vector< string > listFonts () const
 
int numOpArgs (OperationType::Type o)
 
OperationType::Group classifyOp (OperationType::Type o) const
 
void latex (const std::string &filename, bool wrapLaTeXLines)
 
void matlab (const std::string &filename)
 
string latex2pango (const std::string &x)
 
std::vector< std::string > availableOperations ()
 list of available operations More...
 
Minsky::AvailableOperationsMapping availableOperationsMapping () const
 
std::vector< std::string > variableTypes ()
 list of available variable types More...
 
std::vector< std::string > assetClasses ()
 return list of available asset classes More...
 
void autoLayout ()
 auto layout current open group and recentre More...
 
void randomLayout ()
 randomly layout current open group and recentre reinitialises canvas to the group located in item More...
 
void openGroupInCanvas ()
 
void openModelInCanvas ()
 reinitialises canvas to the toplevel group More...
 
void listAllInstances ()
 
void nameCurrentItem (const std::string &name)
 
void itemFromNamedItem (const std::string &name)
 
bool triggerCheckMemAllocationCallback () const
 trigger checkMem callback for testing purposes More...
 
char getc () const
 Used to implement a pause until return pressed for attaching debugger purposes. More...
 
void setDefinition (const std::string &valueId, const std::string &definition)
 add/replace a definition for a flow variable given by valueId More...
 
void pushFlags ()
 push and pop state of the flags More...
 
void popFlags ()
 push and pop state of the flags More...
 
std::string defaultFont ()
 the default used by Pango More...
 
std::string defaultFont (const std::string &x)
 the default used by Pango More...
 
double fontScale ()
 an extra scaling factor of Pango fonts More...
 
double fontScale (double)
 an extra scaling factor of Pango fonts More...
 
- Public Member Functions inherited from minsky::RungeKutta
virtual ~RungeKutta ()=default
 
void rkreset ()
 reset the simulation More...
 
void rkstep ()
 step the equations (by n steps, default 1) evaluate the flow equations without stepping. More...
 
void evalEquations ()
 
- Public Member Functions inherited from minsky::Minsky_multipleEquities
 Minsky_multipleEquities (const std::string &name, ecolab::TCLAccessor< Minsky, bool >::Getter g, ecolab::TCLAccessor< Minsky, bool >::Setter s)
 

Public Attributes

RESTProcess_t registry
 
- Public Attributes inherited from minsky::Minsky
PannableTab< EquationDisplayequationDisplay
 
FontDisplay fontSampler
 
PhillipsDiagram phillipsDiagram
 
std::vector< PubTabpublicationTabs
 
VariableValues variableValues
 
Dimensions dimensions
 
Conversions conversions
 
std::map< Units, double > maxValue
 stash the maximum absolute value obtained by a dimensioned quantity More...
 
std::map< Units, double > maxFlowValue
 
SVGRenderer histogramResource
 
Exclude< std::map< std::string, std::shared_ptr< CallableFunction > > > userFunctions
 
GroupPtr model {new Group}
 
Canvas canvas {model}
 
std::set< string > logVarList
 set of variables (valueIds) to log More...
 
double lastT {0}
 previous timestep More...
 
int numBackups =1
 number of previous versions of saved files to keep save to a file More...
 
std::string fileVersion
 Minsky version file was saved under. More...
 
unsigned maxHistory {100}
 maximum no. of history states to save More...
 
int maxWaitMS =100
 maximum wait in millisecond between redrawing canvas during simulation More...
 
bool doPushHistory =true
 flag to indicate whether a TCL should be pushed onto the history stack, or logged in a recording. This is used to avoid movements being added to recordings and undo history More...
 
bool displayValues =false
 
GodleyTable::DisplayStyle displayStyle =GodleyTable::sign
 
std::shared_ptr< VariableInstanceListvariableInstanceList
 supports navigation to all instances of current variable More...
 
std::map< std::string, std::weak_ptr< Item > > namedItems
 
VariablePane variablePane
 
- Public Attributes inherited from minsky::RungeKutta
double t {0}
 time More...
 
bool running =false
 controls whether simulation is running More...
 
bool reverse =false
 reverse direction of simulation More...
 
EvalGodley evalGodley
 
- Public Attributes inherited from minsky::Simulation
double stepMin {0}
 
double stepMax {0.01}
 
int nSteps {1}
 
double epsRel {1e-2}
 
double epsAbs {1e-3}
 
int order {4}
 
bool implicit {false}
 
int simulationDelay {0}
 
std::string timeUnit
 
double tmax {INFINITY}
 
double t0 {0}
 

Additional Inherited Members

- Public Types inherited from minsky::Minsky
enum  CmdData { no_command, is_const, is_setterGetter, generic }
 
enum  MemCheckResult { OK, proceed, abort }
 check whether to proceed or abort, given a request to allocate bytes of memory. Implemented in MinskyTCL More...
 
using AvailableOperationsMapping = classdesc::StringKeyMap< std::vector< OperationType::Type > >
 
- Static Public Member Functions inherited from minsky::Minsky
static void saveGroupAsFile (const Group &, const string &fileName)
 
static bool ravelAvailable ()
 
static bool ravelExpired ()
 
static int daysUntilRavelExpires ()
 
- Static Public Attributes inherited from minsky::Minsky
static const std::string minskyVersion =MINSKY_VERSION
 return the AEGIS assigned version number More...
 
- Static Public Attributes inherited from minsky::ValueVector
static std::vector< double, CIVITA_ALLOCATOR< double > > stockVars
 vector of variables that are integrated via Runge-Kutta. These variables label the columns of the Godley table More...
 
static std::vector< double, CIVITA_ALLOCATOR< double > > flowVars
 variables defined as a simple function of the stock variables, also known as lhs variables. These variables appear in the body of the Godley table More...
 
- Protected Member Functions inherited from minsky::RungeKutta
void evalEquations (double result[], double, const double vars[])
 
void evalJacobian (Matrix &, double, const double vars[])
 
- Static Protected Member Functions inherited from minsky::RungeKutta
static int RKfunction (double, const double y[], double f[], void *)
 function to be integrated (internal use) More...
 
static int jacobian (double, const double y[], double *, double dfdt[], void *)
 compute jacobian (internal use) More...
 

Detailed Description

Definition at line 27 of file RESTMinsky.h.

Constructor & Destructor Documentation

◆ RESTMinsky()

minsky::RESTMinsky::RESTMinsky ( )
inline

Definition at line 47 of file RESTMinsky.h.

References registry, and classdesc::RESTProcess().

47 {RESTProcess(registry,"minsky",static_cast<Minsky&>(*this));}
RESTProcess_t registry
Definition: RESTMinsky.h:29
void RESTProcess(RESTProcess_t &t, const string &d, minsky::VariableValues &a)
Definition: minsky.cc:1811
Here is the call graph for this function:

Member Function Documentation

◆ commandHook()

template<class RP >
void minsky::RESTMinsky::commandHook ( const std::string &  command,
const RP &  args 
)
inline

Definition at line 32 of file RESTMinsky.h.

References minsky::Minsky::commandHook().

Referenced by processBuffer().

32  {
33  int nargs=1;
34  switch (args.type())
35  {
36  case RESTProcessType::array:
37  nargs=args.array().size();
38  break;
39  case RESTProcessType::null:
40  nargs=0;
41  break;
42  default:
43  break;
44  }
45  Minsky::commandHook(command,nargs);
46  }
bool commandHook(const std::string &command, unsigned nargs)
Executed after each interpreter command to maintain undo/redo stack, edited flag, autosaving etc...
Definition: minsky.cc:1326
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCommandData()

Minsky::CmdData minsky::RESTMinsky::getCommandData ( const std::string &  command) const
overridevirtual

return meta information on a given command

Reimplemented from minsky::Minsky.

Definition at line 29 of file RESTMinsky.cc.

30  {
31  switch (registry.count(dottedCommand))
32  {
33  case 0:
34  return no_command;
35  case 1:
36  {
37  auto& cmd=*registry.find(dottedCommand)->second;
38  return cmd.isConst()? is_const: cmd.isObject()? is_setterGetter: generic;
39  }
40  case 2:
41  {
42  auto firstCmd=registry.find(dottedCommand), secondCmd=firstCmd;
43  ++secondCmd;
44  if (firstCmd->second->arity()+secondCmd->second->arity() == 1)
45  return is_setterGetter;
46  return generic;
47  }
48  default:
49  return generic;
50  }
51 
52  }
RESTProcess_t registry
Definition: RESTMinsky.h:29

Member Data Documentation

◆ registry

RESTProcess_t minsky::RESTMinsky::registry

Definition at line 29 of file RESTMinsky.h.

Referenced by processBuffer(), and RESTMinsky().


The documentation for this struct was generated from the following files: