Go to the documentation of this file.
32 #include <unordered_map>
69 std::unordered_map< std::string, StateVarEntryLocation >
entries;
76 std::unordered_map< std::string, StateVarEntryLocation > theMap;
78 for (
const auto& theEntry : theEntries ) {
79 const auto nextLocation = sizeOccupied;
80 theMap[theEntry.name] = { nextLocation, theEntry.length };
81 sizeOccupied += theEntry.length;
83 return { theMap, sizeOccupied };
Definition: MarmotStateVarVectorManager.h:68
An entry in the statevar vector consists of the name and a certain length.
Definition: MarmotStateVarVectorManager.h:55
The location in the statevar vector consists of the index and its certain length.
Definition: MarmotStateVarVectorManager.h:61
MarmotStateVarVectorManager(double *theStateVars, const StateVarVectorLayout &theLayout_)
Definition: MarmotStateVarVectorManager.h:92
A convenience auxiliary class for managing multiple statevars with arbitrary length in a single conse...
Definition: MarmotStateVarVectorManager.h:37
int nRequiredStateVars
Definition: MarmotStateVarVectorManager.h:70
std::string name
Definition: MarmotStateVarVectorManager.h:56
Definition: MarmotUtils.h:29
StateView getStateView(const std::string &name) const
get a StateView for a statevar entry
Definition: MarmotStateVarVectorManager.h:41
int index
Definition: MarmotStateVarVectorManager.h:62
static StateVarVectorLayout makeLayout(const std::vector< StateVarEntryDefinition > &theEntries)
generate the statevar vector layout from a list of entries, defined by name and length
Definition: MarmotStateVarVectorManager.h:74
const StateVarVectorLayout & theLayout
a const reference to the respective layout
Definition: MarmotStateVarVectorManager.h:90
int length
Definition: MarmotStateVarVectorManager.h:63
bool contains(const std::string &name) const
check if the entry with name is managed
Definition: MarmotStateVarVectorManager.h:51
std::unordered_map< std::string, StateVarEntryLocation > entries
Definition: MarmotStateVarVectorManager.h:69
double * theStateVars
pointer to the first element in the statevar vector
Definition: MarmotStateVarVectorManager.h:87
int length
Definition: MarmotStateVarVectorManager.h:57
double & find(const std::string &name) const
get the reference to the first array element of an entry in the statevar vector
Definition: MarmotStateVarVectorManager.h:48