25 #include "polyPackBase.h" 28 #include <cairo/cairo.h> 42 struct EvalOpBase:
public classdesc::PolyBase<minsky::OperationType::Type>,
60 std::vector<unsigned>
in1;
66 Support(
double weight,
unsigned idx): weight(weight), idx(idx) {}
68 std::vector<std::vector<Support>>
in2;
70 bool flow1=
true, flow2=
true, xflow=
true;
73 std::shared_ptr<OperationBase>
state;
75 if (state) state->throw_error(msg);
76 else throw std::runtime_error(msg);
92 virtual void deriv(
double df[], std::size_t n,
const double ds[],
93 const double sv[],
const double fv[])=0;
110 virtual int numArgs()
const =0;
116 void deriv(
double df[], std::size_t n,
const double ds[],
117 const double sv[],
const double fv[])
override;
119 void eval(
double fv[], std::size_t,
const double sv[])
override;
122 virtual double evaluate(
double in1=0,
double in2=0)
const=0;
127 virtual double d1(
double x1=0,
double x2=0)
const=0;
128 virtual double d2(
double x1=0,
double x2=0)
const=0;
133 template <minsky::OperationType::Type T>
134 struct EvalOp:
public classdesc::Poly<EvalOp<T>, ScalarEvalOp>
138 return OperationTypeInfo::numArguments<T>();
140 double evaluate(
double in1=0,
double in2=0)
const override;
141 double d1(
double x1=0,
double x2=0)
const override;
142 double d2(
double x1=0,
double x2=0)
const override;
148 double evaluate(
double in1=0,
double in2=0)
const override;
151 struct EvalOpPtr:
public classdesc::shared_ptr<EvalOpBase>,
161 const std::shared_ptr<VariableValue>& to,
163 const VariableValue& from2={});
188 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.
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)