23 #include <xml_pack_base.h> 24 #include <xml_unpack_base.h> 29 #include "polyPackBase.h" 32 #include <cairo/cairo.h> 46 struct EvalOpBase:
public classdesc::PolyBase<minsky::OperationType::Type>,
64 std::vector<unsigned>
in1;
70 Support(
double weight,
unsigned idx): weight(weight), idx(idx) {}
72 std::vector<std::vector<Support>>
in2;
74 bool flow1=
true, flow2=
true, xflow=
true;
77 std::shared_ptr<OperationBase>
state;
79 if (state) state->throw_error(msg);
80 else throw std::runtime_error(msg);
96 virtual void deriv(
double df[], std::size_t n,
const double ds[],
97 const double sv[],
const double fv[])=0;
114 virtual int numArgs()
const =0;
120 void deriv(
double df[], std::size_t n,
const double ds[],
121 const double sv[],
const double fv[])
override;
123 void eval(
double fv[], std::size_t,
const double sv[])
override;
126 virtual double evaluate(
double in1=0,
double in2=0)
const=0;
131 virtual double d1(
double x1=0,
double x2=0)
const=0;
132 virtual double d2(
double x1=0,
double x2=0)
const=0;
137 template <minsky::OperationType::Type T>
138 struct EvalOp:
public classdesc::Poly<EvalOp<T>, ScalarEvalOp>
142 return OperationTypeInfo::numArguments<T>();
144 double evaluate(
double in1=0,
double in2=0)
const override;
145 double d1(
double x1=0,
double x2=0)
const override;
146 double d2(
double x1=0,
double x2=0)
const override;
152 double evaluate(
double in1=0,
double in2=0)
const override;
155 struct EvalOpPtr:
public classdesc::shared_ptr<EvalOpBase>,
165 const std::shared_ptr<VariableValue>& to,
167 const VariableValue& from2={});
192 const char*
what() const noexcept {
return "FlowVars unexpectedly resized";}
std::vector< std::vector< Support > > in2
represents the operation when evaluating the equations
static std::vector< double, CIVITA_ALLOCATOR< double > > stockVars
vector of variables that are integrated via Runge-Kutta. These variables label the columns of the God...
virtual void setTensorParams(const VariableValue &, const OperationBase &)
set additional tensor operation related parameters
const char * what() const noexcept
std::shared_ptr< Item > ItemPtr
Support(double weight, unsigned idx)
Legacy EvalOp base interface.
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
OperationType::Type type() const override
std::vector< unsigned > in1
std::shared_ptr< VariableValue > result
lifetime management of the resultant variableValue number of arguments to this operation ...
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
EvalOpPtr(OperationType::Type op)
std::shared_ptr< OperationBase > state
state data (for those ops that need it)
int numArgs() const override
static std::string timeUnit
void throw_error(const std::string &msg) const
exception throw if flowVars vector unexpectedly resized during evalEquations
float d2(float x0, float y0, float x1, float y1)