39 ecolab::array<int>
sidx, fidx;
40 ecolab::array<double>
m;
49 template <
class GodleyIterator>
50 void initialiseGodleys
51 (
const GodleyIterator& begin,
const GodleyIterator& end,
58 void eval(
double* sv,
const double* fv)
const;
77 int id()
const {
return it->id();}
80 const std::vector<std::vector<std::string> >& data()
const;
82 bool signConventionReversed(
int col)
const;
83 bool initialConditionRow(
int row)
const;
86 string valueId(
const std::string& x)
const {
return it->valueId(x);}
104 void checkShared(
const string& name,
AssetClass ac);
113 bool updateColDefs(
const string& col,
const FlowCoef& fc);
116 void checkSharedColDefs()
const;
121 (
const GodleyIterator& begin,
const GodleyIterator& end,
131 for (GodleyIterator g=begin; g!=end; ++g)
133 if (g.data().empty())
continue;
136 for (std::size_t col=1; col<g.data()[0].size(); ++col)
137 if (!
trimWS(g.data()[0][col]).empty())
140 for (std::size_t row=1; row<g.data().size(); ++row)
141 if (!g.initialConditionRow(row))
142 for (std::size_t col=1; col<g.data()[row].size(); ++col)
145 auto svName=col<g.data()[0].size()?
trimWS(g.data()[0][col]):
"";
146 if (fvc.name.empty() || svName.empty())
continue;
147 fvc.name=g.valueId(fvc.name);
148 svName=g.valueId(svName);
150 auto fv=values.find(fvc.name);
151 auto sv=values.find(svName);
152 if (fv!=values.end() && sv!=values.end() &&
153 fv->second->idx()>=0 && sv->second->idx()>=0)
156 if (!compatibility &&
160 iidx.insert(sv->second->idx());
161 sidx<<=sv->second->idx();
162 fidx<<=fv->second->idx();
178 #include "evalGodley.cd" 179 #include "evalGodley.xcd"
bool operator!=(const GodleyIteratorAdaptor &x) const
bool updateColDefs(const string &col, const FlowCoef &fc)
update col defs, give column name, and flow variable entry
ecolab::array< int > sidx
representation of matrix connecting flow variables to stock variables
std::map< string, AssetClass > colAssetType
asset type of previously seen column of this name
bool compatibility
if compatibility is true, then consttrainst between Godley tables is not applied, and shared columns ...
void checkShared(const string &name, AssetClass ac)
check whether column name has already been seen, and if it has, whether it is allowed to be shared by...
for checking shared columns between tables
GodleyIteratorAdaptor< T > makeGodleyIt(const T &it)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
void initialiseGodleys(const GodleyIterator &begin, const GodleyIterator &end, const VariableValues &values)
initialise this to a sequence of Godley tables - adaptors provided below
std::string trimWS(const std::string &s)
void checkSharedColDefs() const
check shared columns are equivalently defined
GodleyAssetClass::AssetClass AssetClass
std::set< string > sharedCol
indicates a column is shared between Godley tables
#define CLASSDESC_ACCESS(type)
string valueId(const std::string &x) const
returns valueid for variable reference in table
represents a numerical coefficient times a variable (a "flow")
ecolab::array< int > initIdx
index of stock variables that need to be zeroed at start of eval
ecolab::array< double > m
GodleyIteratorAdaptor(const T &it)
adaptor suitable for initialiseGodleys
ConstMap< string, std::map< string, double > > colDef
store the sum of flow var contributions for each colum here. Used for checking that shared column def...