Minsky
|
#include <variableValue.h>
Public Member Functions | |
bool | lhs () const |
variable has an input port More... | |
bool | temp () const |
variable is a temporary More... | |
bool | isFlowVar () const |
returns true if variable's data is allocated on the flowVariables vector More... | |
bool | isZero () const |
VariableType::Type | type () const |
value at the ith location of the vector/tensor. Default, (i=0) is right for scalar quantities More... | |
double | valueAt (size_t i) const |
double | value () const |
set the value at the ith location More... | |
double | setValue (size_t i, double x) |
double | setValue (double x) |
int | idx () const |
void | reset_idx () |
double | operator[] (std::size_t i) const override |
double & | operator[] (std::size_t i) override |
const Index & | index (Index &&i) override |
template<class T > | |
void | hypercube_ (T x) |
bool | idxInRange () const |
const Hypercube & | hypercube () const override |
const Hypercube & | hypercube (const Hypercube &hc) override |
const Hypercube & | hypercube (Hypercube &&hc) override |
VariableValue (VariableType::Type type=VariableType::undefined, const std::string &name="", const GroupPtr &group=GroupPtr()) | |
VariableValue (VariableType::Type type, const VariableValue &vv) | |
VariableValue (const VariableValue &)=delete | |
void | operator= (const VariableValue &)=delete |
VariableValue & | operator= (TensorVal const &) |
VariableValue & | operator= (const ITensor &x) override |
VariableValue & | allocValue () |
allocate space in the variable vector. More... | |
std::string | valueId () const |
void | exportAsCSV (const std::string &filename, const std::string &comment="", bool tabular=false) const |
export this to a CSV file. If comment is non-empty, it is written as the first line of the file. If tabular is false, there is one data point per line, if true, the the longest dimension is written as a series on the line. More... | |
Summary | summary () const |
const std::string & | init () const |
const std::string & | init (const std::string &x) |
void | sliderSet (double x) |
sets variable value (or init value) More... | |
void | incrSlider (double step) |
increment slider by step More... | |
void | adjustSliderBounds () |
adjust slider bounds to encompass the current value More... | |
![]() | |
void | setUnits (const std::string &x) |
![]() | |
double | maxSliderSteps () const |
ensure there are at most 10000 steps between sliderMin and Max. see ticket 1255. More... | |
Protected Attributes | |
std::string | m_init |
the initial value of this variable More... | |
Private Member Functions | |
CLASSDESC_ACCESS (VariableValue) | |
double & | valRef () |
index into value vector More... | |
const double & | valRef () const |
ITensor::Timestamp | timestamp () const override |
Private Attributes | |
Type | m_type |
int | m_idx =-1 |
Friends | |
class | VariableManager |
struct | SchemaHelper |
Additional Inherited Members | |
![]() | |
enum | Type { undefined, constant, parameter, flow, integral, stock, tempFlow, numVarTypes } |
![]() | |
static std::string | typeName (int t) |
![]() | |
TensorVal | tensorInit |
when init is a tensor of values, this overrides the init string More... | |
TensorPtr | rhs |
when the RHS is attached to a tensor expression, this is a reference to it More... | |
Units | units |
dimension units of this value More... | |
bool | unitsCached =false |
std::string | detailedText |
long and short descriptions - common to all variables of a given name More... | |
std::string | tooltip |
bool | godleyOverridden =false |
std::string | name |
classdesc::Exclude< std::weak_ptr< Group > > | m_scope |
CSVDialog | csvDialog |
for importing CSV files More... | |
![]() | |
bool | sliderStepRel =false |
double | sliderMin =std::numeric_limits<double>::max() |
double | sliderMax =-sliderMin |
double | sliderStep =0 |
bool | enableSlider =true |
Definition at line 71 of file variableValue.h.
|
inline |
Definition at line 157 of file variableValue.h.
References minsky::scope().
|
inline |
Definition at line 164 of file variableValue.h.
References init(), and TCLcmd::trap::init.
|
delete |
void minsky::VariableValue::adjustSliderBounds | ( | ) |
adjust slider bounds to encompass the current value
Definition at line 237 of file variableValue.cc.
References minsky::anonymous_namespace{userFunction.cc}::isfinite(), and minsky::anonymous_namespace{userFunction.cc}::isnan().
VariableValue & minsky::VariableValue::allocValue | ( | ) |
allocate space in the variable vector.
Definition at line 121 of file variableValue.cc.
Referenced by minsky::VariableValues::reset(), and minsky::VariableValues::resetValue().
|
private |
void minsky::VariableValue::exportAsCSV | ( | const std::string & | filename, |
const std::string & | comment = "" , |
||
bool | tabular = false |
||
) | const |
export this to a CSV file. If comment is non-empty, it is written as the first line of the file. If tabular is false, there is one data point per line, if true, the the longest dimension is written as a series on the line.
Definition at line 417 of file variableValue.cc.
References minsky::CSVQuote(), minsky::anonymous_namespace{userFunction.cc}::isfinite(), and minsky::str().
Referenced by minsky::Sheet::exportAsCSV(), and minsky::Ravel::exportAsCSV().
|
override |
Definition at line 213 of file variableValue.cc.
References minsky::cminsky(), minsky::Minsky::definingVar(), and minsky::valueId().
Referenced by minsky::loadValueFromCSVFileT(), and minsky::Minsky::populateMissingDimensionsFromVariable().
|
inlineoverride |
Definition at line 151 of file variableValue.h.
|
inlineoverride |
Definition at line 153 of file variableValue.h.
|
inline |
Definition at line 139 of file variableValue.h.
|
inline |
Definition at line 122 of file variableValue.h.
Referenced by minsky::EvalOpPtr::EvalOpPtr(), and minsky::VariableValues::resetValue().
bool minsky::VariableValue::idxInRange | ( | ) | const |
Definition at line 89 of file variableValue.cc.
Referenced by minsky::VariableValues::reset(), and minsky::VariableValues::resetValue().
void minsky::VariableValue::incrSlider | ( | double | step | ) |
increment slider by step
Definition at line 232 of file variableValue.cc.
References step().
|
inlineoverride |
Definition at line 128 of file variableValue.h.
Referenced by minsky::loadValueFromCSVFileT().
|
inline |
Definition at line 186 of file variableValue.h.
Referenced by minsky::VariableBase::init(), minsky::VariableValues::initValue(), MathDAG::latexInit(), MathDAG::matlabInit(), minsky::GodleyIcon::update(), and VariableValue().
const std::string & minsky::VariableValue::init | ( | const std::string & | x | ) |
Definition at line 201 of file variableValue.cc.
References minsky::cminsky(), minsky::Minsky::definingVar(), minsky::VariableValues::initValue(), minsky::valueId(), and minsky::Minsky::variableValues.
|
inline |
returns true if variable's data is allocated on the flowVariables vector
Definition at line 97 of file variableValue.h.
Referenced by minsky::EvalOpPtr::EvalOpPtr(), and minsky::VariableValues::resetValue().
|
inline |
Definition at line 100 of file variableValue.h.
References TCLcmd::trap::init.
|
inline |
variable has an input port
Definition at line 91 of file variableValue.h.
|
delete |
VariableValue& minsky::VariableValue::operator= | ( | TensorVal const & | ) |
|
override |
Definition at line 111 of file variableValue.cc.
References civita::ITensor::hypercube(), civita::ITensor::index(), and civita::ITensor::size().
|
inlineoverride |
Definition at line 125 of file variableValue.h.
|
override |
|
inline |
Definition at line 123 of file variableValue.h.
Referenced by minsky::VariableValues::reset().
|
inline |
Definition at line 116 of file variableValue.h.
|
inline |
Definition at line 121 of file variableValue.h.
References setValue().
Referenced by setValue().
void minsky::VariableValue::sliderSet | ( | double | x | ) |
sets variable value (or init value)
Definition at line 222 of file variableValue.cc.
References TCLcmd::trap::init, minsky::anonymous_namespace{userFunction.cc}::isfinite(), and minsky::to_string().
Summary minsky::VariableValue::summary | ( | ) | const |
Definition at line 512 of file variableValue.cc.
References minsky::cminsky(), MathDAG::SystemOfEquations::getNodeFromIntVar(), MathDAG::SystemOfEquations::getNodeFromValueId(), TCLcmd::trap::init, minsky::Minsky::model, minsky::scope(), minsky::valueId(), and minsky::var.
|
inline |
variable is a temporary
Definition at line 94 of file variableValue.h.
|
inlineoverrideprivate |
Definition at line 84 of file variableValue.h.
|
inline |
value at the ith location of the vector/tensor. Default, (i=0) is right for scalar quantities
Definition at line 104 of file variableValue.h.
|
private |
index into value vector
Definition at line 177 of file variableValue.cc.
|
private |
Definition at line 153 of file variableValue.cc.
|
inline |
set the value at the ith location
Definition at line 114 of file variableValue.h.
|
inline |
Definition at line 109 of file variableValue.h.
|
inline |
Definition at line 179 of file variableValue.h.
References minsky::canonicalName(), and minsky::valueIdFromScope().
Referenced by minsky::VariableValues::resetValue().
|
friend |
Definition at line 81 of file variableValue.h.
|
friend |
Definition at line 80 of file variableValue.h.
|
private |
Definition at line 76 of file variableValue.h.
|
protected |
the initial value of this variable
Definition at line 88 of file variableValue.h.
|
private |
Definition at line 75 of file variableValue.h.