Minsky: 3.17.0
minsky::VariableBase Class Referenceabstract

#include <variable.h>

Inheritance diagram for minsky::VariableBase:
Inheritance graph
Collaboration diagram for minsky::VariableBase:
Collaboration graph

Public Types

typedef VariableType::Type Type
 
- Public Types inherited from minsky::VariableType
enum  Type {
  undefined, constant, parameter, flow,
  integral, stock, tempFlow, numVarTypes
}
 

Public Member Functions

virtual std::size_t numPorts () const =0
 
virtual Type type () const =0
 
void retype (VariableType::Type type)
 attempt to replace this variable with variable of type. More...
 
bool visible () const override
 whether this item is visible on the canvas. More...
 
const VariableBasevariableCast () const override
 
VariableBasevariableCast () override
 
float zoomFactor () const override
 
bool local () const
 
void toggleLocal ()
 toggle local status More...
 
const std::string & rawName () const
 accessor for the name member (may differ from name() with top level variables) More...
 
bool ioVar () const override
 indicates this is a group I/O variable More...
 
void ensureValueExists (VariableValue *vv, const std::string &name) const
 ensure an associated variableValue exists More...
 
virtual std::string valueId () const
 string used to link to the VariableValue associated with this More...
 
std::string valueIdInCurrentScope (const std::string &nm) const
 returns valueId for nm. If nm is not qualified, this variable's scope is used More...
 
std::shared_ptr< VariableValuevValue () const
 variableValue associated with this. nullptr if not associated with a variableValue More...
 
std::vector< unsigned > dims () const
 variable's tensor shape More...
 
std::vector< std::string > dimLabels () const
 labels along each axis More...
 
std::pair< std::string, std::string > getDimLabelsPicked () const
 
std::pair< std::string, std::string > setDimLabelsPicked (const std::string &dimLabel1, const std::string &dimLabel2)
 
const std::string & detailedText () const override
 
const std::string & detailedText (const std::string &x) override
 
const std::string & tooltip () const override
 
const std::string & tooltip (const std::string &x) override
 
bool sliderVisible () const
 returns true if slider is to be drawn More...
 
Units units (bool check) const override
 sets/gets the units associated with this type More...
 
Units units () const
 
void setUnits (const std::string &) const
 
std::string unitsStr () const
 
bool onKeyPress (int, const std::string &, int) override
 respond to key press events More...
 
bool lhs () const
 variable is on left hand side of flow calculation More...
 
bool temp () const
 variable is temporary More...
 
virtual VariableBaseclone () const override=0
 
bool isStock () const
 
std::string definition () const
 formula defining this variable More...
 
void draw (cairo_t *) const override
 
void resize (const LassoBox &b) override
 resize this item on the canvas More...
 
ClickType::Type clickType (float x, float y) const override
 returns the clicktype given a mouse click at x, y. More...
 
bool defined () const
 
bool inputWired () const
 
std::vector< std::string > accessibleVars () const
 return a list of existing variables this could be connected to More...
 
EngNotation engExp () const
 return formatted mantissa and exponent in engineering format More...
 
std::string mantissa (const EngNotation &e, int digits=3) const
 
void exportAsCSV (const std::string &filename, bool tabular) const
 export this variable as a CSV file More...
 
void importFromCSV (const std::vector< std::string > &filenames, const DataSpecSchema &spec) const
 import CSV files, using spec More...
 
void reloadCSV ()
 reload CSV file if previously imported More...
 
void destroyFrame () override
 clean up popup window structures on window close More...
 
bool miniPlotEnabled () const
 
bool miniPlotEnabled (bool)
 
void resetMiniPlot ()
 
bool onMouseMotion (float x, float y) override
 respond to mouse motion events with button pressed More...
 
void adjustSliderBounds () const
 
virtual std::string name () const
 variable displayed name More...
 
virtual std::string name (const std::string &nm)
 variable displayed name More...
 
const std::string & canonicalName () const
 variable displayed name More...
 
std::string init () const
 the initial value of this variable More...
 
std::string init (const std::string &)
 < return initial value for this variable More...
 
virtual double value (const double &)
 < set the initial value for this variable More...
 
virtual double value () const override
 < set the initial value for this variable More...
 
double sliderMin () const
 slider parameters More...
 
double sliderMin (double) const
 slider parameters More...
 
double sliderMax () const
 slider parameters More...
 
double sliderMax (double) const
 slider parameters More...
 
double sliderStep () const
 slider parameters More...
 
double sliderStep (double) const
 slider parameters More...
 
bool sliderStepRel () const
 slider parameters More...
 
bool sliderStepRel (bool) const
 slider parameters More...
 
bool enableSlider () const
 slider parameters More...
 
bool enableSlider (bool) const
 slider parameters More...
 
- Public Member Functions inherited from minsky::BottomRightResizerItem
bool onResizeHandle (float x, float y) const override
 
void drawResizeHandles (cairo_t *cairo) const override
 
virtual Point resizeHandleCoords () const
 returns coordinates of the resizer handle More...
 
- Public Member Functions inherited from minsky::Item
 Item ()=default
 
virtual std::weak_ptr< Portports (std::size_t i) const
 callback to be run when item deleted from group More...
 
std::size_t portsSize () const
 number of ports More...
 
float portX (std::size_t i)
 
float portY (std::size_t i)
 
virtual bool contains (float xx, float yy) const
 
bool contains (const Point &p) const
 
void updateBoundingBox () override
 
void throw_error (const std::string &) const
 mark item on canvas, then throw More...
 
double rotation () const
 
double rotation (const double &r)
 
std::pair< double, bool > rotationAsRadians () const
 return the rotation as radians, and whether rotation should have additional straight angle added for text that stays upright. More...
 
float iWidth () const
 
float iWidth (const float &w)
 
float iHeight () const
 
float iHeight (const float &h)
 
virtual void flip ()
 rotate icon though 180∘ More...
 
virtual std::string classType () const
 
std::string id () const
 return an id uniquely identifying this item More...
 
virtual float x () const
 
virtual float y () const
 
void ensureBBValid () const
 
float width () const
 
float height () const
 
virtual std::vector< Pointcorners () const
 
float left () const
 
float right () const
 
float top () const
 
float bottom () const
 
std::string bookmarkId () const
 Id of bookmark associated with this. More...
 
void adjustBookmark () const override
 adjust bookmark list to reflect current configuration More...
 
float resizeHandleSize () const
 resize handles should be at least a percentage if the icon size (#1025) More...
 
virtual bool inItem (float x, float y) const
 
virtual bool onItem (float x, float y) const
 returns true if (x,y) is on the icon More...
 
virtual void onMouseDown (float x, float y)
 respond to mouse down events More...
 
virtual void onMouseUp (float x, float y)
 respond to mouse up events More...
 
virtual bool onMouseOver (float x, float y)
 respond to mouse motion events (hover) without button pressed More...
 
virtual void onMouseLeave ()
 respond to mouse leave events (when mouse leaves item) More...
 
virtual void deleteAttachedWires ()
 delete all attached wires More...
 
void moveTo (float x, float y)
 
virtual float scaleFactor () const
 factor by which item has been resized More...
 
virtual float scaleFactor (const float &sf)
 
void dummyDraw () const
 draw into a dummy cairo context, for purposes of calculating port positions More...
 
virtual void displayTooltip (cairo_t *, const std::string &) const
 display tooltip text, eg on mouseover More...
 
virtual void updateIcon (double t)
 update display after a step() More...
 
 Item (const Item &)=default
 
Itemoperator= (const Item &)=default
 
virtual ~Item ()
 
void drawPorts (cairo_t *cairo) const
 
virtual std::shared_ptr< PortclosestOutPort (float x, float y) const
 returns closest output port to x,y More...
 
virtual std::shared_ptr< PortclosestInPort (float x, float y) const
 
virtual std::shared_ptr< Itemselect (float x, float y) const
 returns the variable if point (x,y) is within a visible variable icon, null otherwise. More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) override
 runs the RESTProcess descriptor suitable for this type More...
 
void RESTProcess (classdesc::RESTProcess_t &rp, const std::string &d) const override
 
virtual void json_pack (classdesc::json_pack_t &j) const
 
virtual void displayDelayedTooltip (float x, float y)
 enable extended tooltip help message appropriate for mouse at (x,y) More...
 
virtual void disableDelayedTooltip ()
 
virtual bool editorMode () const
 some items have an editor mode attribute More...
 
virtual void toggleEditorMode ()
 
Units checkUnits () const
 perform units consistency checks More...
 
ItemPtr itemPtrFromThis () const
 return a shared_ptr to this More...
 
- Public Member Functions inherited from minsky::NoteBase
virtual ~NoteBase ()=default
 
- Public Member Functions inherited from minsky::VariableCaches
 VariableCaches ()=default
 
 VariableCaches (const VariableCaches &)
 
VariableCachesoperator= (const VariableCaches &)
 

Static Public Member Functions

static VariableBasecreate (Type type)
 
- Static Public Member Functions inherited from minsky::Item
static void drawSelected (cairo_t *cairo)
 
- Static Public Member Functions inherited from minsky::VariableType
static std::string typeName (int t)
 

Public Attributes

classdesc::Exclude< std::weak_ptr< Item > > controller
 reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar. More...
 
- Public Attributes inherited from minsky::Item
float m_x =0
 
float m_y =0
 position in canvas, or within group More...
 
float m_sf =1
 scale factor of item on canvas, or within group More...
 
bool onResizeHandles =false
 set to true to indicate mouse is ovcaler resize handles More...
 
bool onBorder =false
 true to indicate mouse hovering over border More...
 
std::string deleteCallback
 
BoundingBox bb
 canvas bounding box. More...
 
- Public Attributes inherited from minsky::NoteBase
bool mouseFocus =false
 true if target of a mouseover More...
 
bool selected =false
 true if selected for cut, copy or group operation More...
 
bool bookmark =false
 Is this item also a bookmark? More...
 

Static Public Attributes

static int varsPassed =0
 for caching units calculation factory method More...
 

Protected Member Functions

void addPorts ()
 

Private Member Functions

 CLASSDESC_ACCESS (VariableBase)
 
void insertControlled (Selection &selection) override
 

Private Attributes

std::string m_name
 
std::string m_canonicalName
 latex processed and active stripped version of name More...
 
std::pair< std::string, std::string > m_dimLabelsPicked
 
int unitsCtr =0
 for detecting reentrancy in units() More...
 
classdesc::Exclude< std::shared_ptr< ecolab::Plot > > miniPlot
 miniature plot feature More...
 

Static Private Attributes

static int stockVarsPassed =0
 for detecting reentrancy in units() More...
 

Friends

struct minsky::SchemaHelper
 

Additional Inherited Members

- Static Protected Member Functions inherited from minsky::Item
static void drawResizeHandle (cairo_t *cairo, double x, double y, double sf, double angle)
 
- Protected Attributes inherited from minsky::Item
double m_width =20
 
double m_height =20
 
ItemPortVector m_ports
 
minsky::Item::MemoisedRotator memoisedRotator
 
- Protected Attributes inherited from minsky::VariableCaches
classdesc::Exclude< std::shared_ptr< RenderVariable > > cachedNameRender
 cached Pango objects More...
 
classdesc::Exclude< std::shared_ptr< ecolab::Pango > > cachedMantissa
 
classdesc::Exclude< std::shared_ptr< ecolab::Pango > > cachedExponent
 
double cachedValue
 
double cachedTime
 

Detailed Description

Definition at line 77 of file variable.h.

Member Typedef Documentation

◆ Type

Definition at line 83 of file variable.h.

Member Function Documentation

◆ accessibleVars()

std::vector< std::string > VariableBase::accessibleVars ( ) const

return a list of existing variables this could be connected to

Definition at line 74 of file variable.cc.

References minsky::group.

75 {
76  if (auto g=group.lock())
77  return g->accessibleVars();
78  return {};
79 }

◆ addPorts()

void VariableBase::addPorts ( )
protected

Definition at line 54 of file variable.cc.

Referenced by minsky::Variable< VariableType::constant >::operator=(), minsky::PhillipsStock::PhillipsStock(), and minsky::Variable< VariableType::constant >::Variable().

55 {
56 #ifndef NDEBUG
57  for (auto& i: m_ports)
58  assert(i.use_count()==1);
59 #endif
60  m_ports.clear();
61  if (numPorts()>0)
62  m_ports.emplace_back(make_shared<Port>(*this));
63  for (size_t i=1; i<numPorts(); ++i)
64  m_ports.emplace_back(make_shared<InputPort>(*this));
65 }
virtual std::size_t numPorts() const =0
ItemPortVector m_ports
Definition: item.h:154
Here is the caller graph for this function:

◆ adjustSliderBounds()

void VariableBase::adjustSliderBounds ( ) const

Definition at line 549 of file variable.cc.

550 {
551  if (auto vv=vValue())
552  vv->adjustSliderBounds();
553 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ canonicalName()

const std::string& minsky::VariableBase::canonicalName ( ) const
inline

variable displayed name

Definition at line 132 of file variable.h.

References m_canonicalName.

132 {return m_canonicalName;}
std::string m_canonicalName
latex processed and active stripped version of name
Definition: variable.h:89

◆ CLASSDESC_ACCESS()

minsky::VariableBase::CLASSDESC_ACCESS ( VariableBase  )
private

◆ clickType()

ClickType::Type VariableBase::clickType ( float  x,
float  y 
) const
overridevirtual

returns the clicktype given a mouse click at x, y.

Reimplemented from minsky::Item.

Definition at line 82 of file variable.cc.

References minsky::flipped(), minsky::RenderVariable::handlePos(), minsky::RenderVariable::height(), minsky::Rotate::x(), and minsky::Rotate::y().

83 {
84  const Rotate r(rotation()+(flipped(rotation())? 180: 0),0,0); // rotate into variable's frame of reference
85  const RenderVariable rv(*this);
86  const double z=zoomFactor();
87  try
88  {
89  const double hpx=z*rv.handlePos();
90  double hpy=-z*rv.height();
91  if (rv.height()<0.5*iHeight()) hpy=-z*0.5*iHeight();
92  const double dx=xx-x(), dy=yy-y();
93  if (type()!=constant && hypot(dx - r.x(hpx,hpy), dy-r.y(hpx,hpy)) < 5)
94  return ClickType::inItem;
95  }
96  catch (...) {}
97  return Item::clickType(xx,yy);
98 }
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
float iHeight() const
Definition: item.h:221
rotate (x,y) by rot (in degrees) around the origin (x0, y0) can be used for rotating multiple points ...
Definition: geometry.h:44
virtual Type type() const =0
bool flipped(double rotation)
returns if the angle (in degrees) is in the second or third quadrant
Definition: geometry.h:102
virtual ClickType::Type clickType(float x, float y) const
returns the clicktype given a mouse click at x, y.
Definition: item.cc:275
float zoomFactor() const override
Definition: variable.cc:135
double rotation() const
Definition: item.h:208
Here is the call graph for this function:

◆ clone()

virtual VariableBase* minsky::VariableBase::clone ( ) const
overridepure virtual

◆ create()

VariableBase * VariableBase::create ( VariableType::Type  type)
static

Definition at line 101 of file variable.cc.

Referenced by schema3::MinskyItemFactory::create().

102 {
103  switch (type)
104  {
105  case undefined: return new Variable<undefined>; break;
106  case constant: return new VarConstant; break;
107  case parameter: return new Variable<parameter>; break;
108  case flow: return new Variable<flow>; break;
109  case stock: return new Variable<stock>; break;
110  case tempFlow: return new Variable<tempFlow>; break;
111  case integral: return new Variable<integral>; break;
112  default:
113  throw error("unknown variable type %s", typeName(type).c_str());
114  }
115 }
virtual Type type() const =0
static std::string typeName(int t)
Definition: variableType.cc:30
Here is the caller graph for this function:

◆ defined()

bool minsky::VariableBase::defined ( ) const
inline
Returns
true if variable is defined (inputWired() || isStock() && controlled)

Definition at line 206 of file variable.h.

References controller, inputWired(), and isStock().

206 {return inputWired() || (isStock() && controller.lock());}
bool inputWired() const
Definition: variable.cc:67
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
bool isStock() const
Definition: variable.h:193
Here is the call graph for this function:

◆ definition()

std::string VariableBase::definition ( ) const

formula defining this variable

Definition at line 572 of file variable.cc.

References minsky::cminsky(), MathDAG::SystemOfEquations::getDefFromIntVar(), and MathDAG::SystemOfEquations::getNodeFromVar().

573 {
575  ostringstream o;
576 
577  auto varDAG=system.getNodeFromVar(*this);
578 
580  {
581  if (varDAG && varDAG->rhs && varDAG->type!=VariableType::constant && varDAG->type!=VariableType::integral)
582  o << varDAG->rhs->latex();
583  else return system.getDefFromIntVar(*this).str();
584  }
585 
586  return o.str();
587 }
virtual Type type() const =0
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
Here is the call graph for this function:

◆ destroyFrame()

void VariableBase::destroyFrame ( )
overridevirtual

clean up popup window structures on window close

Reimplemented from minsky::Item.

Definition at line 486 of file variable.cc.

487 {
488  if (auto vv=vValue())
489  vv->csvDialog.destroyFrame();
490 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ detailedText() [1/2]

const std::string & VariableBase::detailedText ( ) const
overridevirtual

Reimplemented from minsky::NoteBase.

Definition at line 338 of file variable.cc.

References emptyString.

339 {
340  if (auto vv=vValue())
341  return vv->detailedText;
342  return emptyString ;
343 }
static string emptyString
Definition: variable.cc:336
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ detailedText() [2/2]

const std::string & VariableBase::detailedText ( const std::string &  x)
overridevirtual

Reimplemented from minsky::NoteBase.

Definition at line 345 of file variable.cc.

References emptyString.

346 {
347  if (auto vv=vValue())
348  return vv->detailedText=x;
349  return emptyString ;
350 }
virtual float x() const
Definition: item.cc:107
static string emptyString
Definition: variable.cc:336
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ dimLabels()

vector< string > VariableBase::dimLabels ( ) const

labels along each axis

Definition at line 164 of file variable.cc.

165 {
166  if (auto v=vValue()) return v->hypercube().dimLabels();
167  return {};
168 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ dims()

vector< unsigned > VariableBase::dims ( ) const

variable's tensor shape

Definition at line 154 of file variable.cc.

155 {
156  try
157  {
158  if (auto v=vValue()) return v->hypercube().dims();
159  }
160  catch (...) {} // ignore any exceptions caused by evaluating RHS.
161  return {};
162 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ draw()

void VariableBase::draw ( cairo_t *  cairo) const
overridevirtual

draws the icon onto the given cairo context

Returns
cairo path of icon outline

Reimplemented from minsky::Item.

Definition at line 698 of file variable.cc.

References minsky::cminsky(), MathDAG::cos(), minsky::engExp(), minsky::expMultiplier(), minsky::flipped(), minsky::group, minsky::anonymous_namespace{userFunction.cc}::isinf(), minsky::anonymous_namespace{userFunction.cc}::isnan(), M_PI, minsky::mantissa(), MathDAG::sin(), minsky::sliderHandleRadius, minsky::RungeKutta::t, minsky::Rotate::x(), and minsky::Rotate::y().

Referenced by minsky::RenderVariable::draw(), minsky::PhillipsStock::draw(), and minsky::anonymous_namespace{godleyIcon.cc}::DrawVars::operator()().

699 {
700  auto [angle,flipped]=rotationAsRadians();
701  const float z=zoomFactor();
702 
703  // grab a thread local copy of the renderer caches, as MacOSX does
704  // rendering on a different thread, and this avoids a race condition
705  // when the cache is invalidated
706  auto l_cachedNameRender=cachedNameRender;
707  if (!l_cachedNameRender || cairo!=cachedNameRender->cairoContext())
708  {
709  l_cachedNameRender=cachedNameRender=std::make_shared<RenderVariable>(*this,cairo);
710  l_cachedNameRender->setFontSize(12.0);
711  }
712 
713  // if rotation is in 1st or 3rd quadrant, rotate as
714  // normal, otherwise flip the text so it reads L->R
715  const Rotate r(rotation() + (flipped? 180:0),0,0);
716  l_cachedNameRender->angle=angle+(flipped? M_PI:0);
717 
718  // parameters of icon in userspace (unscaled) coordinates
719  const double w=std::max(l_cachedNameRender->width(), 0.5f*iWidth());
720  const double h=std::max(l_cachedNameRender->height(), 0.5f*iHeight());
721  const double hoffs=l_cachedNameRender->top();
722 
723  unique_ptr<cairo::Path> clipPath;
724  {
725  const CairoSave cs(cairo);
726  cairo_scale(cairo, z,z);
727  cairo_move_to(cairo,r.x(-w+1,-h-hoffs+2), r.y(-w+1,-h-hoffs+2));
728  {
729  const CairoSave cs(cairo);
730  if (local())
731  cairo_set_source_rgb(cairo,0,0,1);
732  l_cachedNameRender->show();
733  }
734 
735  auto vv=vValue();
736  if (miniPlot && vv && vv->size()==1)
737  try
738  {
739  if (cachedTime!=cminsky().t)
740  {
741  cachedTime=cminsky().t;
742  miniPlot->addPt(0,cachedTime,vv->value());
743  miniPlot->setMinMax();
744  }
745  const CairoSave cs(cairo);
746  cairo_translate(cairo,-w,-h);
747  miniPlot->draw(cairo,2*w,2*h);
748  }
749  catch (...) {} // ignore errors in obtaining values
750 
751  // For feature 47
752  try
753  {
754  if (type()!=constant && !ioVar() && vv && vv->size()==1 && vv->idxInRange())
755  {
756  auto l_cachedMantissa=cachedMantissa;
757  auto l_cachedExponent=cachedExponent;
758  if (!l_cachedMantissa || l_cachedMantissa->cairoContext()!=cairo)
759  {
760  l_cachedMantissa=cachedMantissa=make_shared<Pango>(cairo);
761  l_cachedMantissa->setFontSize(6.0);
762  l_cachedExponent=cachedExponent=make_shared<Pango>(cairo);
763  l_cachedExponent->setFontSize(6.0);
764  cachedValue=nan("");
765  }
766 
767  auto val=engExp();
768  if (value()!=cachedValue)
769  {
770  cachedValue=value();
771  if (!isnan(value())) {
772  if (sliderVisible())
773  l_cachedMantissa->setMarkup
774  (mantissa(val,
775  int(1+
776  (vv->sliderStepRel?
777  -log10(vv->maxSliderSteps()):
778  log10(vv->value()/vv->maxSliderSteps())
779  ))));
780  else
781  l_cachedMantissa->setMarkup(mantissa(val));
782  }
783  else if (isinf(value())) { // Display non-zero divide by zero as infinity. For ticket 1155
784  if (signbit(value())) l_cachedMantissa->setMarkup("-∞");
785  else l_cachedMantissa->setMarkup("∞");
786  }
787  else // Display all other NaN cases as ???. For ticket 1155
788  l_cachedMantissa->setMarkup("???");
789  l_cachedExponent->setMarkup(expMultiplier(val.engExp));
790  }
791  l_cachedMantissa->angle=angle+(flipped? M_PI:0);
792 
793  cairo_move_to(cairo,r.x(w-l_cachedMantissa->width()-2,-h-hoffs+2),
794  r.y(w-l_cachedMantissa->width()-2,-h-hoffs+2));
795  l_cachedMantissa->show();
796 
797  if (val.engExp!=0 && !isnan(value())) // Avoid large exponential number in variable value display. For ticket 1155
798  {
799  cairo_move_to(cairo,r.x(w-l_cachedExponent->width()-2,0),r.y(w-l_cachedExponent->width()-2,0));
800  l_cachedExponent->show();
801  }
802  }
803  }
804  catch (...) {} // ignore errors in obtaining values
805 
806  {
807  const cairo::CairoSave cs(cairo);
808  cairo_rotate(cairo, angle);
809  // constants and parameters should be rendered in blue, all others in red
810  switch (type())
811  {
812  case constant: case parameter:
813  cairo_set_source_rgb(cairo,0,0,1);
814  break;
815  default:
816  cairo_set_source_rgb(cairo,1,0,0);
817  break;
818  }
819  cairo_move_to(cairo,-w,-h);
820  if (lhs())
821  cairo_line_to(cairo,-w+2,0);
822  cairo_line_to(cairo,-w,h);
823  cairo_line_to(cairo,w,h);
824  cairo_line_to(cairo,w+2,0);
825  cairo_line_to(cairo,w,-h);
826  cairo_close_path(cairo);
827  clipPath.reset(new cairo::Path(cairo));
828  cairo_stroke(cairo);
829  if (sliderVisible())
830  {
831  // draw slider
832  const CairoSave cs(cairo);
833  cairo_set_source_rgb(cairo,0,0,0);
834  try
835  {
836  cairo_arc(cairo,(flipped?-1.0:1.0)*l_cachedNameRender->handlePos(), (flipped? h: -h), sliderHandleRadius, 0, 2*M_PI);
837  }
838  catch (const error&) {} // handlePos() may throw.
839  cairo_fill(cairo);
840  }
841  }// undo rotation
842 
843  const double x0=z*w, y0=0, x1=-z*w+2, y1=0;
844  const double sa=sin(angle), ca=cos(angle);
845  if (!m_ports.empty())
846  m_ports[0]->moveTo(x()+(x0*ca-y0*sa),
847  y()+(y0*ca+x0*sa));
848  if (m_ports.size()>1)
849  m_ports[1]->moveTo(x()+(x1*ca-y1*sa),
850  y()+(y1*ca+x1*sa));
851  }
852 
853  auto g=group.lock();
854  if (mouseFocus || (ioVar() && g && g->mouseFocus))
855  {
856  const cairo::CairoSave cs(cairo);
857  drawPorts(cairo);
858  displayTooltip(cairo,tooltip());
860  }
861 
862  cairo_new_path(cairo);
863  clipPath->appendToCurrent(cairo);
864  // Rescale size of variable attached to intop. For ticket 94
865  cairo_clip(cairo);
866  if (selected) drawSelected(cairo);
867 }
#define M_PI
some useful geometry types, defined from boost::geometry
Definition: geometry.h:29
std::string expMultiplier(int exp)
void drawPorts(cairo_t *cairo) const
Definition: item.cc:294
Expr sin(const Expr &x)
Definition: expr.h:130
classdesc::Exclude< std::shared_ptr< ecolab::Pango > > cachedExponent
Definition: variable.h:69
Expr cos(const Expr &x)
Definition: expr.h:136
virtual void displayTooltip(cairo_t *, const std::string &) const
display tooltip text, eg on mouseover
Definition: item.cc:398
virtual float x() const
Definition: item.cc:107
virtual float y() const
Definition: item.cc:114
float iHeight() const
Definition: item.h:221
bool onResizeHandles
set to true to indicate mouse is ovcaler resize handles
Definition: item.h:172
virtual double value() const override
< set the initial value for this variable
Definition: variable.cc:317
constexpr float sliderHandleRadius
Definition: slider.h:24
std::pair< double, bool > rotationAsRadians() const
return the rotation as radians, and whether rotation should have additional straight angle added for ...
Definition: item.cc:92
rotate (x,y) by rot (in degrees) around the origin (x0, y0) can be used for rotating multiple points ...
Definition: geometry.h:44
const std::string & tooltip() const override
Definition: variable.cc:352
virtual Type type() const =0
bool flipped(double rotation)
returns if the angle (in degrees) is in the second or third quadrant
Definition: geometry.h:102
bool sliderVisible() const
returns true if slider is to be drawn
Definition: variable.cc:538
float zoomFactor() const override
Definition: variable.cc:135
static void drawSelected(cairo_t *cairo)
Definition: item.cc:308
float iWidth() const
Definition: item.h:214
bool ioVar() const override
indicates this is a group I/O variable
Definition: variable.cc:243
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
EngNotation engExp() const
return formatted mantissa and exponent in engineering format
Definition: variable.h:214
ItemPortVector m_ports
Definition: item.h:154
bool selected
true if selected for cut, copy or group operation
Definition: noteBase.h:32
bool mouseFocus
true if target of a mouseover
Definition: noteBase.h:31
std::string mantissa(const EngNotation &e, int digits=3) const
Definition: variable.h:216
classdesc::Exclude< std::shared_ptr< ecolab::Pango > > cachedMantissa
Definition: variable.h:68
classdesc::Exclude< std::shared_ptr< RenderVariable > > cachedNameRender
cached Pango objects
Definition: variable.h:67
double t
time
Definition: rungeKutta.h:57
void moveTo(float x, float y)
Definition: item.cc:256
bool local() const
Definition: variable.cc:181
bool lhs() const
variable is on left hand side of flow calculation
Definition: variable.h:189
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
classdesc::Exclude< std::shared_ptr< ecolab::Plot > > miniPlot
miniature plot feature
Definition: variable.h:97
void drawResizeHandles(cairo_t *cairo) const override
Definition: item.cc:355
double rotation() const
Definition: item.h:208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ enableSlider() [1/2]

bool VariableBase::enableSlider ( ) const

slider parameters

Definition at line 683 of file variable.cc.

Referenced by schema3::Item::Item().

684 {
685  if (auto vv=vValue())
686  return vv->enableSlider;
687  return false;
688 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the caller graph for this function:

◆ enableSlider() [2/2]

bool VariableBase::enableSlider ( bool  x) const

slider parameters

Definition at line 690 of file variable.cc.

691 {
692  if (auto vv=vValue())
693  return vv->enableSlider=x;
694  return false;
695 }
virtual float x() const
Definition: item.cc:107
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ engExp()

EngNotation minsky::VariableBase::engExp ( ) const
inline

return formatted mantissa and exponent in engineering format

Definition at line 214 of file variable.h.

References minsky::engExp(), and value().

Referenced by minsky::RenderVariable::RenderVariable().

215  {return minsky::engExp(value());}
EngNotation engExp(double value)
return formatted mantissa and exponent in engineering format
virtual double value() const override
< set the initial value for this variable
Definition: variable.cc:317
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ensureValueExists()

void VariableBase::ensureValueExists ( VariableValue vv,
const std::string &  name 
) const

ensure an associated variableValue exists

Definition at line 247 of file variable.cc.

References minsky::group, minsky::isValueId(), pyminsky::minsky, minsky::scope(), minsky::valueId(), and minsky::Minsky::variableValues.

Referenced by MathDAG::SystemOfEquations::makeDAG(), minsky::VarConstant::name(), and minsky::VarConstant::VarConstant().

248 {
249  string valueId=this->valueId();
250  // disallow blank names
251  if (valueId.length()>1 && valueId.substr(valueId.length()-2)!=":_" &&
252  minsky().variableValues.count(valueId)==0)
253  {
254  assert(isValueId(valueId));
255  // Ensure value of variable is preserved after rename.
256  if (vv==nullptr)
258  first->second->m_scope=minsky::scope(group.lock(),m_name);
259  // Ensure variable names are updated correctly everywhere they appear.
260  else
261  {
262  auto iter=minsky().variableValues.emplace(valueId,VariableValuePtr(type(),*vv)).first->second;
263  iter->name=m_name;
264  iter->m_scope=minsky::scope(group.lock(),m_name);
265  }
266 
267  }
268 }
VariableValues variableValues
Definition: minsky.h:188
size_t scope(const string &name)
extract scope from a qualified variable name
Definition: valueId.cc:83
a shared_ptr that default constructs a default target, and is always valid
virtual Type type() const =0
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
bool isValueId(const string &name)
check that name is a valid valueId (useful for assertions)
Definition: valueId.cc:33
std::string m_name
Definition: variable.h:88
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportAsCSV()

void VariableBase::exportAsCSV ( const std::string &  filename,
bool  tabular 
) const

export this variable as a CSV file

Parameters
tabular- if true, the longest dimension is split across columns as a horizontal dimension

Definition at line 457 of file variable.cc.

References pyminsky::minsky, minsky::valueId(), and minsky::Minsky::variableValues.

458 {
459  auto value=minsky().variableValues.find(valueId());
460  if (value!=minsky().variableValues.end())
461  value->second->exportAsCSV(filename, name(), tabular);
462 }
VariableValues variableValues
Definition: minsky.h:188
virtual double value() const override
< set the initial value for this variable
Definition: variable.cc:317
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
virtual std::string name() const
variable displayed name
Definition: variable.cc:186
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ getDimLabelsPicked()

std::pair<std::string,std::string> minsky::VariableBase::getDimLabelsPicked ( ) const
inline

Definition at line 156 of file variable.h.

References m_dimLabelsPicked.

156 {return m_dimLabelsPicked;}
std::pair< std::string, std::string > m_dimLabelsPicked
Definition: variable.h:90

◆ importFromCSV()

void VariableBase::importFromCSV ( const std::vector< std::string > &  filenames,
const DataSpecSchema spec 
) const

import CSV files, using spec

Definition at line 464 of file variable.cc.

References minsky::loadValueFromCSVFile(), pyminsky::minsky, and minsky::Minsky::populateMissingDimensionsFromVariable().

465 {
466  if (auto v=vValue()) {
467  v->csvDialog.spec=spec;
468  if (!filenames.empty())
469  v->csvDialog.url=filenames[0];
470  loadValueFromCSVFile(*v, filenames, v->csvDialog.spec);
472  if (!v->hypercube().dimsAreDistinct())
473  throw_error("Axes of imported data should all have distinct names");
474  }
475 }
void throw_error(const std::string &) const
mark item on canvas, then throw
Definition: item.cc:86
void loadValueFromCSVFile(VariableValue &v, const vector< string > &filenames, const DataSpec &spec)
load a variableValue from a list of files according to data spec
Definition: CSVParser.cc:1058
void populateMissingDimensionsFromVariable(const VariableValue &, bool &incompatibleMessageDisplayed)
populate missing dimensions from a variableValue
Definition: minsky.cc:515
Minsky & minsky()
global minsky object
Definition: addon.cc:545
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ init() [1/2]

string VariableBase::init ( ) const

the initial value of this variable

Definition at line 270 of file variable.cc.

References pyminsky::minsky, minsky::valueId(), and minsky::Minsky::variableValues.

Referenced by minsky::VarConstant::name(), and minsky::VarConstant::value().

271 {
272  auto value=minsky().variableValues.find(valueId());
273  if (value!=minsky().variableValues.end()) {
274  // set initial value of int var to init value of input to second port. for ticket 1137
275  if (type()==integral)
276  {
277  // find attached integral
278  auto i=dynamic_cast<IntOp*>(controller.lock().get());
279  if (!i && !m_ports[1]->wires().empty())
280  i=dynamic_cast<IntOp*>(&(m_ports[1]->wires()[0]->from()->item()));
281  if (i && i->portsSize()>2 && !i->ports(2).lock()->wires().empty())
282  if (auto lhsVar=i->ports(2).lock()->wires()[0]->from()->item().variableCast())
283  if (auto vv=vValue())
284  if (auto lhsVv=lhsVar->vValue())
285  // Since integral takes initial value from second port, the intVar should have the same intial value.
286  if (vv->init()!=lhsVv->init()) vv->init(lhsVv->init());
287  }
288  return value->second->init();
289  }
290  return "0";
291 }
VariableValues variableValues
Definition: minsky.h:188
virtual double value() const override
< set the initial value for this variable
Definition: variable.cc:317
virtual Type type() const =0
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
ItemPortVector m_ports
Definition: item.h:154
Minsky & minsky()
global minsky object
Definition: addon.cc:545
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init() [2/2]

string VariableBase::init ( const std::string &  x)

< return initial value for this variable

Definition at line 293 of file variable.cc.

References minsky::cminsky(), minsky::VariableValue::init(), minsky::isValueId(), pyminsky::minsky, minsky::VariableValues::resetValue(), minsky::valueId(), and minsky::Minsky::variableValues.

294 {
295  ensureValueExists(nullptr,"");
296  if (isValueId(valueId()))
297  {
299  val.init(x);
300  // for constant types, we may as well set the current value. See ticket #433. Also ignore errors (for now), as they will reappear at reset time.
301  try
302  {
303  if (type()==constant || type()==parameter ||
304  (type()==flow && !cminsky().definingVar(valueId())))
305  {
307  cachedNameRender.reset(); // for constants
308  }
309  }
310  catch (...)
311  {}
313  }
314  return x;
315 }
void resetValue(VariableValue &) const
reset a give variable value to it&#39;s initial condition, in this context
virtual float x() const
Definition: item.cc:107
VariableValues variableValues
Definition: minsky.h:188
const std::string & init() const
virtual Type type() const =0
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
void ensureValueExists(VariableValue *vv, const std::string &name) const
ensure an associated variableValue exists
Definition: variable.cc:247
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
bool isValueId(const string &name)
check that name is a valid valueId (useful for assertions)
Definition: valueId.cc:33
classdesc::Exclude< std::shared_ptr< RenderVariable > > cachedNameRender
cached Pango objects
Definition: variable.h:67
void updateBoundingBox() override
Definition: item.h:198
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ inputWired()

bool VariableBase::inputWired ( ) const

Definition at line 67 of file variable.cc.

Referenced by defined().

68 {
69  if (auto p=ports(1).lock())
70  return !p->wires().empty();
71  return false;
72 }
virtual std::weak_ptr< Port > ports(std::size_t i) const
callback to be run when item deleted from group
Definition: item.h:177
Here is the caller graph for this function:

◆ insertControlled()

void VariableBase::insertControlled ( Selection selection)
overrideprivate

Definition at line 492 of file variable.cc.

References minsky::Selection::ensureItemInserted().

493 {
494  selection.ensureItemInserted(controller.lock());
495 }
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
void ensureItemInserted(const ItemPtr &item)
check if item already present, and if not, inserts item delegates to ensureGroupInserted if passed a ...
Definition: selection.cc:60
Here is the call graph for this function:

◆ ioVar()

bool VariableBase::ioVar ( ) const
overridevirtual

indicates this is a group I/O variable

Reimplemented from minsky::Item.

Definition at line 243 of file variable.cc.

Referenced by minsky::RenderVariable::RenderVariable().

244 {return dynamic_cast<Group*>(controller.lock().get());}
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
Here is the caller graph for this function:

◆ isStock()

bool minsky::VariableBase::isStock ( ) const
inline

Definition at line 193 of file variable.h.

References minsky::VariableType::integral, minsky::VariableType::stock, and type().

Referenced by defined().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lhs()

bool minsky::VariableBase::lhs ( ) const
inline

variable is on left hand side of flow calculation

Definition at line 189 of file variable.h.

References minsky::VariableType::flow, minsky::VariableType::tempFlow, and type().

Here is the call graph for this function:

◆ local()

bool VariableBase::local ( ) const
Returns
true if variable is local to its group

Definition at line 181 of file variable.cc.

References minsky::Minsky::canvas, minsky::cminsky(), minsky::group, and minsky::Canvas::model.

182 {
183  return m_name[0]!=':' && group.lock()!=cminsky().canvas.model;
184 }
Model model
Definition: canvas.h:103
Canvas canvas
Definition: minsky.h:243
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
std::string m_name
Definition: variable.h:88
Here is the call graph for this function:

◆ mantissa()

std::string minsky::VariableBase::mantissa ( const EngNotation e,
int  digits = 3 
) const
inline

Definition at line 216 of file variable.h.

References minsky::mantissa(), and value().

Referenced by minsky::RenderVariable::RenderVariable().

217  {return minsky::mantissa(value(),e, digits);}
virtual double value() const override
< set the initial value for this variable
Definition: variable.cc:317
std::string mantissa(double value, const EngNotation &, int digits=3)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ miniPlotEnabled() [1/2]

bool minsky::VariableBase::miniPlotEnabled ( ) const
inline

Definition at line 231 of file variable.h.

References miniPlot.

231 {return bool(miniPlot);}
classdesc::Exclude< std::shared_ptr< ecolab::Plot > > miniPlot
miniature plot feature
Definition: variable.h:97

◆ miniPlotEnabled() [2/2]

bool VariableBase::miniPlotEnabled ( bool  enabled)

Definition at line 589 of file variable.cc.

590 {
591  if (enabled)
592  {
593  miniPlot=make_shared<ecolab::Plot>();
594  miniPlot->plotType=ecolab::Plot::PlotType::bar;
595  }
596  else
597  miniPlot=nullptr;
598  return enabled;
599 }
classdesc::Exclude< std::shared_ptr< ecolab::Plot > > miniPlot
miniature plot feature
Definition: variable.h:97

◆ name() [1/2]

string VariableBase::name ( ) const
virtual

variable displayed name

Reimplemented in minsky::VarConstant.

Definition at line 186 of file variable.cc.

Referenced by MathDAG::SystemOfEquations::makeDAG(), minsky::GroupItems::renameVar(), minsky::RenderVariable::RenderVariable(), toggleLocal(), and minsky::Variable< VariableType::constant >::Variable().

187 {
188  if (m_name==":_") return "";
189  // hide any leading ':' in upper level
190  if (m_name[0]==':')
191  {
192  return m_name.substr(1);
193  }
194  return utf_to_utf<char>(m_name);
195 }
std::string m_name
Definition: variable.h:88
Here is the caller graph for this function:

◆ name() [2/2]

string VariableBase::name ( const std::string &  nm)
virtual

variable displayed name

Reimplemented in minsky::VarConstant.

Definition at line 218 of file variable.cc.

References minsky::canonicalName(), anonymous_namespace{variable.cc}::quoteLaTeX(), anonymous_namespace{variable.cc}::specialLatex, and minsky::valueId().

219 {
220  // cowardly refuse to set a blank name
221  if (name.empty() || name==":") return name;
222 
223  // check if we need to quote certain characters that have meaning in LaTeX
224  for (auto p=name.find_first_of(specialLatex); p!=string::npos;
225  p=name.find_first_of(specialLatex,p+1))
226  if (p==0||name[p-1]!='\\')
227  return this->name(quoteLaTeX(name));
228 
229  // Ensure value of variable is preserved after rename. For ticket 1106.
230  auto tmpVV=vValue();
231  m_name=name;
233  ensureValueExists(tmpVV.get(),name);
234  assert(vValue()->valueId()==valueId());
235  cachedNameRender.reset();
236  bb.update(*this); // adjust bounding box for new name - see ticket #704
237  if (auto controllingItem=controller.lock())
238  // integrals in particular may have had their size changed with intVar changing name
239  controllingItem->updateBoundingBox();
240  return this->name();
241 }
string quoteLaTeX(const std::string &x)
Definition: variable.cc:201
BoundingBox bb
canvas bounding box.
Definition: item.h:192
void update(const Item &x)
Definition: item.cc:46
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
void ensureValueExists(VariableValue *vv, const std::string &name) const
ensure an associated variableValue exists
Definition: variable.cc:247
std::string m_canonicalName
latex processed and active stripped version of name
Definition: variable.h:89
string canonicalName(const string &name)
convert a raw name into a canonical name - this is not idempotent.
Definition: valueId.cc:63
virtual std::string name() const
variable displayed name
Definition: variable.cc:186
std::string m_name
Definition: variable.h:88
classdesc::Exclude< std::shared_ptr< RenderVariable > > cachedNameRender
cached Pango objects
Definition: variable.h:67
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ numPorts()

◆ onKeyPress()

bool VariableBase::onKeyPress ( int  keySym,
const std::string &  utf8,
int  state 
)
overridevirtual

respond to key press events

Returns
true if it needs to be rerendered

Reimplemented from minsky::Item.

Definition at line 555 of file variable.cc.

References pyminsky::minsky, and minsky::Minsky::requestReset().

556 {
557  switch (keySym)
558  {
559  case 0xff52: case 0xff53: //Right, Up
560  if (auto vv=vValue()) vv->incrSlider(1);
561  if (!minsky().running) minsky().requestReset();
562  return true;
563  case 0xff51: case 0xff54: //Left, Down
564  if (auto vv=vValue()) vv->incrSlider(-1);
565  if (!minsky().running) minsky().requestReset();
566  return true;
567  default:
568  return false;
569  }
570 }
void requestReset()
Definition: minsky.cc:466
Minsky & minsky()
global minsky object
Definition: addon.cc:545
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ onMouseMotion()

bool VariableBase::onMouseMotion ( float  x,
float  y 
)
overridevirtual

respond to mouse motion events with button pressed

Returns
true if it needs to be rerendered

Reimplemented from minsky::Item.

Definition at line 607 of file variable.cc.

References MathDAG::cos(), minsky::RungeKutta::evalEquations(), M_PI, pyminsky::minsky, minsky::Minsky::pushHistory(), minsky::Minsky::requestReset(), and minsky::RenderVariable::width().

608 {
609  if (auto vv=vValue())
610  {
611  const RenderVariable rv(*this);
612  const double rw=fabs(zoomFactor()*(rv.width()<iWidth()? 0.5*iWidth() : rv.width())*cos(rotation()*M_PI/180));
613  const double sliderPos=(x-this->x())* (vv->sliderMax-vv->sliderMin)/rw+0.5*(vv->sliderMin+vv->sliderMax);
614  const double sliderHatch=sliderPos-fmod(sliderPos,vv->sliderStep); // matches slider's hatch marks to sliderStep value. for ticket 1258
615  vv->sliderSet(sliderHatch);
616  }
617  // push History to prevent an unnecessary reset when
618  // adjusting the slider whilst paused. See ticket #812
619  minsky().pushHistory();
620  if (minsky().reset_flag())
621  minsky().requestReset();
622  minsky().evalEquations();
623  return true;
624 }
#define M_PI
some useful geometry types, defined from boost::geometry
Definition: geometry.h:29
Expr cos(const Expr &x)
Definition: expr.h:136
void requestReset()
Definition: minsky.cc:466
virtual float x() const
Definition: item.cc:107
bool pushHistory()
push current model state onto history if it differs from previous
Definition: minsky.cc:1264
float zoomFactor() const override
Definition: variable.cc:135
float width() const
Definition: item.h:239
float iWidth() const
Definition: item.h:214
void evalEquations(double result[], double, const double vars[])
Definition: rungeKutta.cc:248
Minsky & minsky()
global minsky object
Definition: addon.cc:545
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
double rotation() const
Definition: item.h:208
Here is the call graph for this function:

◆ rawName()

const std::string& minsky::VariableBase::rawName ( ) const
inline

accessor for the name member (may differ from name() with top level variables)

Definition at line 137 of file variable.h.

References m_name.

Referenced by schema3::Item::Item(), and minsky::GroupItems::renameVar().

137 {return m_name;}
std::string m_name
Definition: variable.h:88
Here is the caller graph for this function:

◆ reloadCSV()

void VariableBase::reloadCSV ( )

reload CSV file if previously imported

Definition at line 478 of file variable.cc.

References minsky::loadValueFromCSVFile().

479 {
480  if (auto v=vValue())
481  if (!v->csvDialog.url.empty())
482  loadValueFromCSVFile(*v, {v->csvDialog.url}, v->csvDialog.spec);
483 }
void loadValueFromCSVFile(VariableValue &v, const vector< string > &filenames, const DataSpec &spec)
load a variableValue from a list of files according to data spec
Definition: CSVParser.cc:1058
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ resetMiniPlot()

void VariableBase::resetMiniPlot ( )

Definition at line 601 of file variable.cc.

602 {
603  if (miniPlotEnabled())
604  miniPlot->clear();
605 }
bool miniPlotEnabled() const
Definition: variable.h:231
classdesc::Exclude< std::shared_ptr< ecolab::Plot > > miniPlot
miniature plot feature
Definition: variable.h:97

◆ resize()

void VariableBase::resize ( const LassoBox b)
overridevirtual

resize this item on the canvas

Reimplemented from minsky::Item.

Definition at line 869 of file variable.cc.

References minsky::LassoBox::x0, minsky::LassoBox::x1, minsky::LassoBox::y0, and minsky::LassoBox::y1.

870 {
871  const float invZ=1/zoomFactor();
872  moveTo(0.5*(b.x0+b.x1), 0.5*(b.y0+b.y1));
873  iWidth(abs(b.x1-b.x0)*invZ);
874  iHeight(abs(b.y1-b.y0)*invZ);
875 }
float iHeight() const
Definition: item.h:221
float zoomFactor() const override
Definition: variable.cc:135
float iWidth() const
Definition: item.h:214
float x0
Definition: lasso.h:30
float y1
Definition: lasso.h:30
float x1
Definition: lasso.h:30
void moveTo(float x, float y)
Definition: item.cc:256
float y0
Definition: lasso.h:30

◆ retype()

void VariableBase::retype ( VariableType::Type  type)

attempt to replace this variable with variable of type.

Exceptions
ifnot possible

Definition at line 117 of file variable.cc.

References minsky::Minsky::convertVarType(), minsky::group, pyminsky::minsky, minsky::VariablePtr::retype(), and minsky::valueId().

118 {
119  if (type==this->type()) return; // nothing to do
120  if (auto vv=vValue())
121  if (type==vv->type())
122  if (auto g=group.lock())
123  for (auto& i: g->items)
124  if (i.get()==this)
125  {
126  VariablePtr vp{i};
127  vp.retype(type);
128  i=vp;
129  return;
130  }
132 }
void retype(VariableBase::Type type)
changes type of variable to type
Definition: variable.cc:510
virtual Type type() const =0
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
void convertVarType(const std::string &name, VariableType::Type type)
Converts variable(s) named by name into a variable of type type.
Definition: minsky.cc:1456
Minsky & minsky()
global minsky object
Definition: addon.cc:545
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ setDimLabelsPicked()

std::pair<std::string,std::string> minsky::VariableBase::setDimLabelsPicked ( const std::string &  dimLabel1,
const std::string &  dimLabel2 
)
inline

Definition at line 157 of file variable.h.

References m_dimLabelsPicked.

157  {
158  m_dimLabelsPicked=std::make_pair(dimLabel1,dimLabel2);
159  return m_dimLabelsPicked;
160  }
std::pair< std::string, std::string > m_dimLabelsPicked
Definition: variable.h:90

◆ setUnits()

void VariableBase::setUnits ( const std::string &  x) const

Definition at line 449 of file variable.cc.

References minsky::isValueId(), pyminsky::minsky, minsky::valueId(), and minsky::Minsky::variableValues.

450 {
451  if (isValueId(valueId()))
452  minsky().variableValues[valueId()]->units=Units(x);
453 }
virtual float x() const
Definition: item.cc:107
VariableValues variableValues
Definition: minsky.h:188
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
represents the units (in sense of dimensional analysis) of a variable.
Definition: units.h:34
bool isValueId(const string &name)
check that name is a valid valueId (useful for assertions)
Definition: valueId.cc:33
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ sliderMax() [1/2]

double VariableBase::sliderMax ( ) const

slider parameters

Definition at line 641 of file variable.cc.

Referenced by schema3::Item::Item().

642 {
643  if (auto vv=vValue())
644  return vv->sliderMax;
645  return 0;
646 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the caller graph for this function:

◆ sliderMax() [2/2]

double VariableBase::sliderMax ( double  x) const

slider parameters

Definition at line 648 of file variable.cc.

649 {
650  if (auto vv=vValue())
651  return vv->sliderMax=x;
652  return 0;
653 }
virtual float x() const
Definition: item.cc:107
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ sliderMin() [1/2]

double VariableBase::sliderMin ( ) const

slider parameters

Definition at line 626 of file variable.cc.

Referenced by schema3::Item::Item().

627 {
628  if (auto vv=vValue())
629  return vv->sliderMin;
630  return 0;
631 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the caller graph for this function:

◆ sliderMin() [2/2]

double VariableBase::sliderMin ( double  x) const

slider parameters

Definition at line 634 of file variable.cc.

635 {
636  if (auto vv=vValue())
637  return vv->sliderMin=x;
638  return 0;
639 }
virtual float x() const
Definition: item.cc:107
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ sliderStep() [1/2]

double VariableBase::sliderStep ( ) const

slider parameters

Definition at line 655 of file variable.cc.

Referenced by schema3::Item::Item().

656 {
657  if (auto vv=vValue())
658  return vv->sliderStep;
659  return 0;
660 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the caller graph for this function:

◆ sliderStep() [2/2]

double VariableBase::sliderStep ( double  x) const

slider parameters

Definition at line 662 of file variable.cc.

663 {
664  if (auto vv=vValue())
665  return vv->sliderStep=x;
666  return 0;
667 }
virtual float x() const
Definition: item.cc:107
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ sliderStepRel() [1/2]

bool VariableBase::sliderStepRel ( ) const

slider parameters

Definition at line 669 of file variable.cc.

Referenced by schema3::Item::Item().

670 {
671  if (auto vv=vValue())
672  return vv->sliderStepRel;
673  return false;
674 }
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the caller graph for this function:

◆ sliderStepRel() [2/2]

bool VariableBase::sliderStepRel ( bool  x) const

slider parameters

Definition at line 676 of file variable.cc.

677  {
678  if (auto vv=vValue())
679  return vv->sliderStepRel=x;
680  return false;
681 }
virtual float x() const
Definition: item.cc:107
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ sliderVisible()

bool VariableBase::sliderVisible ( ) const

returns true if slider is to be drawn

Definition at line 538 of file variable.cc.

References minsky::cminsky(), minsky::Minsky::definingVar(), and minsky::valueId().

539 {
540  auto vv=vValue();
541  return enableSlider() &&
542  ((!vv && type()==parameter) ||
543  (vv && vv->size()==1 &&
544  (type()==parameter ||
545  // !inputWired() short circuits the more expensive definingVar operation.
546  (type()==flow && !inputWired() && !cminsky().definingVar(valueId())))));
547 }
bool inputWired() const
Definition: variable.cc:67
virtual Type type() const =0
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
VariablePtr definingVar(const std::string &valueId) const
returns reference to variable defining (ie input wired) for valueId
Definition: minsky.cc:204
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
bool enableSlider() const
slider parameters
Definition: variable.cc:683
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146
Here is the call graph for this function:

◆ temp()

bool minsky::VariableBase::temp ( ) const
inline

variable is temporary

Definition at line 191 of file variable.h.

References minsky::VariableType::tempFlow, type(), and minsky::VariableType::undefined.

Here is the call graph for this function:

◆ toggleLocal()

void minsky::VariableBase::toggleLocal ( )
inline

toggle local status

Definition at line 127 of file variable.h.

References m_name, and name().

127 {name(m_name[0]==':'? m_name.substr(1): ':'+m_name);}
virtual std::string name() const
variable displayed name
Definition: variable.cc:186
std::string m_name
Definition: variable.h:88
Here is the call graph for this function:

◆ tooltip() [1/2]

const std::string & VariableBase::tooltip ( ) const
overridevirtual

Reimplemented from minsky::NoteBase.

Definition at line 352 of file variable.cc.

References emptyString.

353 {
354  if (auto vv=vValue())
355  return vv->tooltip;
356  return emptyString ;
357 }
static string emptyString
Definition: variable.cc:336
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ tooltip() [2/2]

const std::string & VariableBase::tooltip ( const std::string &  x)
overridevirtual

Reimplemented from minsky::NoteBase.

Definition at line 359 of file variable.cc.

References emptyString.

360 {
361  if (auto vv=vValue())
362  return vv->tooltip=x;
363  return emptyString ;
364 }
virtual float x() const
Definition: item.cc:107
static string emptyString
Definition: variable.cc:336
std::shared_ptr< VariableValue > vValue() const
variableValue associated with this. nullptr if not associated with a variableValue ...
Definition: variable.cc:146

◆ type()

virtual Type minsky::VariableBase::type ( ) const
pure virtual

◆ units() [1/2]

Units VariableBase::units ( bool  check) const
overridevirtual

sets/gets the units associated with this type

Reimplemented from minsky::Item.

Definition at line 369 of file variable.cc.

References minsky::cminsky(), pyminsky::minsky, minsky::Minsky::model, minsky::FlowCoef::name, minsky::VariableValues::resetUnitsCache(), minsky::Units::str(), minsky::valueId(), and minsky::Minsky::variableValues.

370 {
372  // we allow possible traversing twice, to allow
373  // stock variable to break the cycle
374  if (unitsCtr-stockVarsPassed>=1)
375  {
376  if (check)
377  throw_error("Cycle detected on wiring network");
378  else
379  return {};
380  }
381 
382  auto it=minsky().variableValues.find(valueId());
383  if (it!=minsky().variableValues.end())
384  {
385  auto& vv=it->second;
386  if (vv->unitsCached) return vv->units;
387 
388 
389  const IncrDecrCounter ucIdc(unitsCtr);
390  const IncrDecrCounter vpIdc(varsPassed);
391  // use a unique ptr here to only increment counter inside a stockVar
392  unique_ptr<IncrDecrCounter> svp;
393 
394  if (isStock()) // we use user defined units
395  {
396  if (unitsCtr==1)
397  {
398  svp.reset(new IncrDecrCounter(stockVarsPassed));
399  // check that input units match output units
400  Units units;
401  if (auto i=dynamic_cast<IntOp*>(controller.lock().get()))
402  units=i->units(check);
403  else if (auto g=dynamic_cast<GodleyIcon*>(controller.lock().get()))
404  units=g->stockVarUnits(name(),check);
405  else // I/O variable
406  units=vv->units;
407  if (check && units.str()!=vv->units.str())
408  {
409  if (auto i=controller.lock())
410  i->throw_error("Inconsistent units "+units.str()+"≠"+vv->units.str());
411  }
412 
413  if (check && controller.lock())
414  {
415  const FlowCoef fc(init());
416  if (!fc.name.empty())
417  {
418  // extract the valueid corresponding to the initialisation variable
419  auto vid=minsky::valueId(vv->m_scope.lock(), fc.name);
420  // find the first variable matching vid, and check that the units match
421  if (auto initVar=cminsky().model->findAny
422  (&GroupItems::items, [&vid](const ItemPtr& i){
423  if (auto v=i->variableCast())
424  return v->valueId()==vid;
425  return false;}))
426  if (units!=initVar->units(check))
427  throw_error("Inconsistent units in initial conditions");
428  }
429  }
430  }
431  }
432  else
433  // updates units in the process
434  if (m_ports.size()>1 && !m_ports[1]->wires().empty())
435  {
436  assert(m_ports[1]->wires()[0]->from());
437  vv->units=m_ports[1]->wires()[0]->from()->item().units(check);
438  }
439  else if (auto v=cminsky().definingVar(valueId()))
440  vv->units=v->units(check);
441 
442  vv->units.normalise();
443  vv->unitsCached=true;
444  return vv->units;
445  }
446  return Units();
447 }
Units units() const
Definition: variable.h:182
std::string str() const
Definition: variableType.cc:33
static int stockVarsPassed
for detecting reentrancy in units()
Definition: variable.h:92
VariableValues variableValues
Definition: minsky.h:188
exception-safe increment/decrement of a counter in a block
Definition: variable.h:54
std::shared_ptr< Item > ItemPtr
Definition: item.h:55
string valueId(const string &name)
construct a valueId from fully qualified name @ name should not be canonicalised
Definition: valueId.cc:75
int unitsCtr
for detecting reentrancy in units()
Definition: variable.h:91
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
static int varsPassed
for caching units calculation factory method
Definition: variable.h:103
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
represents the units (in sense of dimensional analysis) of a variable.
Definition: units.h:34
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
void throw_error(const std::string &) const
mark item on canvas, then throw
Definition: item.cc:86
ItemPortVector m_ports
Definition: item.h:154
represents a numerical coefficient times a variable (a "flow")
Definition: flowCoef.h:27
bool isStock() const
Definition: variable.h:193
std::string init() const
the initial value of this variable
Definition: variable.cc:270
virtual std::string name() const
variable displayed name
Definition: variable.cc:186
GroupPtr model
Definition: minsky.h:242
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ units() [2/2]

Units minsky::VariableBase::units ( ) const
inline

Definition at line 182 of file variable.h.

References units().

Referenced by minsky::PhillipsStock::draw(), units(), and unitsStr().

182 {return units(false);}
Units units() const
Definition: variable.h:182
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unitsStr()

std::string minsky::VariableBase::unitsStr ( ) const
inline

Definition at line 184 of file variable.h.

References minsky::Units::str(), and units().

184 {return units().str();}
Units units() const
Definition: variable.h:182
std::string str() const
Definition: variableType.cc:33
Here is the call graph for this function:

◆ value() [1/2]

double VariableBase::value ( const double &  x)
virtual

< set the initial value for this variable

current value associated with this variable

Reimplemented in minsky::VarConstant.

Definition at line 325 of file variable.cc.

References minsky::isValueId(), pyminsky::minsky, minsky::VariableValues::reset(), minsky::valueId(), and minsky::Minsky::variableValues.

326 {
327  if (!m_name.empty() && isValueId(valueId()))
328  {
329  (*minsky().variableValues[valueId()])[0]=x;
330  if (type()==constant)
331  cachedNameRender.reset();
332  }
333  return x;
334 }
virtual float x() const
Definition: item.cc:107
VariableValues variableValues
Definition: minsky.h:188
virtual Type type() const =0
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
bool isValueId(const string &name)
check that name is a valid valueId (useful for assertions)
Definition: valueId.cc:33
std::string m_name
Definition: variable.h:88
classdesc::Exclude< std::shared_ptr< RenderVariable > > cachedNameRender
cached Pango objects
Definition: variable.h:67
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:

◆ value() [2/2]

double VariableBase::value ( ) const
overridevirtual

< set the initial value for this variable

current value associated with this variable

Reimplemented from minsky::Item.

Definition at line 317 of file variable.cc.

References minsky::cminsky(), minsky::valueId(), and minsky::Minsky::variableValues.

Referenced by minsky::PhillipsStock::draw(), engExp(), and mantissa().

318 {
319  auto& vvs=minsky::cminsky().variableValues;
320  auto v=vvs.find(valueId());
321  if (v==vvs.end() || !v->second) return 0;
322  return v->second->value();
323 }
VariableValues variableValues
Definition: minsky.h:188
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valueId()

string VariableBase::valueId ( ) const
virtual

string used to link to the VariableValue associated with this

Reimplemented in minsky::VarConstant.

Definition at line 171 of file variable.cc.

References minsky::group, and minsky::valueId().

Referenced by MathDAG::SystemOfEquations::getDefFromIntVar(), MathDAG::SubexpressionCache::key(), MathDAG::SystemOfEquations::makeDAG(), and schema3::PhillipsDiagram::populatePhillipsDiagram().

172 {
173  return minsky::valueId(group.lock(), m_name);
174 }
string valueId(const string &name)
construct a valueId from fully qualified name @ name should not be canonicalised
Definition: valueId.cc:75
std::string m_name
Definition: variable.h:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valueIdInCurrentScope()

std::string VariableBase::valueIdInCurrentScope ( const std::string &  nm) const

returns valueId for nm. If nm is not qualified, this variable's scope is used

Definition at line 176 of file variable.cc.

References minsky::group, and minsky::valueId().

177 {
178  return minsky::valueId(group.lock(), nm);
179 }
string valueId(const string &name)
construct a valueId from fully qualified name @ name should not be canonicalised
Definition: valueId.cc:75
Here is the call graph for this function:

◆ variableCast() [1/2]

const VariableBase* minsky::VariableBase::variableCast ( ) const
inlineoverride

Definition at line 119 of file variable.h.

119 {return this;}

◆ variableCast() [2/2]

VariableBase* minsky::VariableBase::variableCast ( )
inlineoverride

Definition at line 120 of file variable.h.

120 {return this;}

◆ visible()

bool VariableBase::visible ( ) const
overridevirtual

whether this item is visible on the canvas.

Reimplemented from minsky::Item.

Definition at line 529 of file variable.cc.

References minsky::group.

530 {
531  auto g=group.lock();
532  //toplevel i/o items always visible
533  if ((!g || !g->group.lock()) && g==controller.lock()) return true;
534  if (controller.lock()) return false;
535  return Item::visible();
536 }
virtual bool visible() const
whether this item is visible on the canvas.
Definition: item.cc:250
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116

◆ vValue()

shared_ptr< VariableValue > VariableBase::vValue ( ) const

variableValue associated with this. nullptr if not associated with a variableValue

Definition at line 146 of file variable.cc.

References minsky::cminsky(), pyminsky::minsky, minsky::valueId(), and minsky::Minsky::variableValues.

Referenced by minsky::RenderVariable::handlePos(), schema3::Item::Item(), MathDAG::SystemOfEquations::makeDAG(), and schema3::Item::packTensorInit().

147 {
148  auto vv=cminsky().variableValues.find(valueId());
149  if (vv!=minsky().variableValues.end())
150  return vv->second;
151  return {};
152 }
VariableValues variableValues
Definition: minsky.h:188
virtual std::string valueId() const
string used to link to the VariableValue associated with this
Definition: variable.cc:171
const Minsky & cminsky()
const version to help in const correctness
Definition: minsky.h:538
Minsky & minsky()
global minsky object
Definition: addon.cc:545
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zoomFactor()

float VariableBase::zoomFactor ( ) const
overridevirtual

Reimplemented from minsky::Item.

Definition at line 135 of file variable.cc.

References minsky::group.

Referenced by minsky::PhillipsStock::draw().

136 {
137  if (ioVar())
138  if (auto g=group.lock())
139  return g->edgeScale();
140  // scale by GodleyIcon::scaleFactor if part of an Godley icon
141  if (auto g=dynamic_cast<GodleyIcon*>(controller.lock().get()))
142  return g->scaleFactor() * Item::zoomFactor();
143  return Item::zoomFactor();
144 }
virtual float zoomFactor() const
Definition: item.cc:121
classdesc::Exclude< std::weak_ptr< Item > > controller
reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.
Definition: variable.h:116
bool ioVar() const override
indicates this is a group I/O variable
Definition: variable.cc:243
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ minsky::SchemaHelper

friend struct minsky::SchemaHelper
friend

Definition at line 84 of file variable.h.

Member Data Documentation

◆ controller

classdesc::Exclude<std::weak_ptr<Item> > minsky::VariableBase::controller

reference to a controlling item - eg GodleyIcon, IntOp or a Group if an IOVar.

Definition at line 116 of file variable.h.

Referenced by defined(), minsky::Variable< VariableType::constant >::operator=(), and minsky::GroupItems::removeItem().

◆ m_canonicalName

std::string minsky::VariableBase::m_canonicalName
private

latex processed and active stripped version of name

Definition at line 89 of file variable.h.

Referenced by canonicalName().

◆ m_dimLabelsPicked

std::pair<std::string,std::string> minsky::VariableBase::m_dimLabelsPicked
private

Definition at line 90 of file variable.h.

Referenced by getDimLabelsPicked(), and setDimLabelsPicked().

◆ m_name

std::string minsky::VariableBase::m_name
private

Definition at line 88 of file variable.h.

Referenced by rawName(), and toggleLocal().

◆ miniPlot

classdesc::Exclude<std::shared_ptr<ecolab::Plot> > minsky::VariableBase::miniPlot
private

miniature plot feature

Definition at line 97 of file variable.h.

Referenced by miniPlotEnabled().

◆ stockVarsPassed

int VariableBase::stockVarsPassed =0
staticprivate

for detecting reentrancy in units()

Definition at line 92 of file variable.h.

◆ unitsCtr

int minsky::VariableBase::unitsCtr =0
mutableprivate

for detecting reentrancy in units()

Definition at line 91 of file variable.h.

◆ varsPassed

int VariableBase::varsPassed =0
static

for caching units calculation factory method

Definition at line 103 of file variable.h.


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