6 #ifndef CT_SOLUTIONARRAY_H
7 #define CT_SOLUTIONARRAY_H
51 static shared_ptr<SolutionArray>
create(
const shared_ptr<Solution>& sol,
65 shared_ptr<SolutionArray>
share(
const vector<int>& selected)
67 return shared_ptr<SolutionArray>(
new SolutionArray(*
this, selected));
75 return static_cast<int>(
m_size);
102 string info(
const vector<string>& keys,
int rows=10,
int width=80);
120 shared_ptr<ThermoPhase>
thermo();
164 void setState(
int loc,
const vector<double>& state);
178 void addExtra(
const string& name,
bool back=
true);
186 vector<string>
listExtra(
bool all=
true)
const;
195 void append(
const vector<double>& state,
const AnyMap& extra);
206 static void writeHeader(
const string& fname,
const string& name,
const string& desc,
207 bool overwrite=
false);
218 bool overwrite=
false);
229 void writeEntry(
const string& fname,
bool overwrite=
false,
const string& basis=
"");
240 void writeEntry(
const string& fname,
const string& name,
const string& sub,
241 bool overwrite=
false,
int compression=0);
252 bool overwrite=
false);
288 void save(
const string& fname,
const string& name=
"",
const string& sub=
"",
289 const string& desc=
"",
bool overwrite=
false,
int compression=0,
290 const string& basis=
"");
315 void readEntry(
const string& fname,
const string& name,
const string& sub);
324 void readEntry(
const AnyMap& root,
const string& name,
const string& sub);
339 AnyMap restore(
const string& fname,
const string& name,
const string& sub=
"");
375 string _detectMode(
const set<string>& names,
bool native=
true);
A map of string keys to values whose type can vary at runtime.
A wrapper for a variable whose type is determined at runtime.
A container class holding arrays of state information.
size_t m_size
Number of entries in SolutionArray.
void append(const vector< double > &state, const AnyMap &extra)
Append location entry at end of SolutionArray.
shared_ptr< Solution > solution()
Retrieve associated Solution object.
size_t m_loc
Buffered location within data vector.
void setLoc(int loc, bool restore=true)
Update the buffered location used to access SolutionArray entries.
string _detectMode(const set< string > &names, bool native=true)
Identify storage mode of state data.
size_t m_dataSize
Total size of unsliced data.
void setMeta(const AnyMap &meta)
Set SolutionArray meta data.
static AnyMap readHeader(const string &fname, const string &name)
Read header information from a HDF container file.
size_t m_stride
Stride between SolutionArray entries.
void _setExtra(const string &name, const AnyValue &data=AnyValue())
Set extra SolutionArray component.
string info(const vector< string > &keys, int rows=10, int width=80)
Print a concise summary of a SolutionArray.
vector< string > listExtra(bool all=true) const
Retrieve list of extra component names.
void setApiShape(const vector< long int > &shape)
Set SolutionArray shape information used by high-level API's.
void setAuxiliary(int loc, const AnyMap &data)
Set auxiliary data for a given location.
static void writeHeader(const string &fname, const string &name, const string &desc, bool overwrite=false)
Write header data to a HDF container file.
AnyMap restore(const string &fname, const string &name, const string &sub="")
Restore SolutionArray data and header information from a container file.
AnyMap getAuxiliary(int loc)
Retrieve auxiliary data for a given location.
AnyValue getComponent(const string &name) const
Retrieve a component of the SolutionArray by name.
vector< int > m_active
Vector of locations referencing active entries.
set< string > _stateProperties(const string &mode, bool alias=false)
Retrieve set containing list of properties defining state.
void readEntry(const string &fname, const string &name, const string &sub)
Restore SolutionArray data from a HDF container file.
void _resize(size_t size)
Service function used to resize SolutionArray.
bool hasComponent(const string &name) const
Check whether SolutionArray contains a component.
static shared_ptr< SolutionArray > create(const shared_ptr< Solution > &sol, int size=0, const AnyMap &meta={})
Instantiate a new SolutionArray reference.
void _initExtra(const string &name, const AnyValue &value)
Initialize extra SolutionArray component.
vector< string > componentNames() const
Retrieve list of component names.
shared_ptr< vector< double > > m_data
Work vector holding states.
vector< long int > apiShape() const
SolutionArray shape information used by high-level API's.
shared_ptr< map< string, AnyValue > > m_extra
Auxiliary (extra) components; size of first dimension has to match m_dataSize.
bool m_shared
true if data are shared from another object
void setState(int loc, const vector< double > &state)
Set the state vector for a given location.
shared_ptr< map< int, string > > m_order
Mapping of auxiliary component names, where the index is used as the mapping key.
int apiNdim() const
Number of SolutionArray dimensions used by high-level API's.
void setComponent(const string &name, const AnyValue &data)
Set a component of the SolutionArray by name.
void normalize()
Normalize mass/mole fractions.
void save(const string &fname, const string &name="", const string &sub="", const string &desc="", bool overwrite=false, int compression=0, const string &basis="")
Save current SolutionArray contents to a data file.
void reset()
Reset all entries of the SolutionArray to the current Solution state.
AnyMap & meta()
SolutionArray meta data.
void resize(int size)
Resize SolutionArray objects with a single dimension (default).
void _resizeExtra(const string &name, const AnyValue &value=AnyValue())
Resize extra SolutionArray component.
shared_ptr< ThermoPhase > thermo()
Retrieve associated ThermoPhase object.
void addExtra(const string &name, bool back=true)
Add auxiliary component to SolutionArray.
bool hasExtra(const string &name) const
Check whether SolutionArray contains an extra component.
void updateState(int loc)
Update state at given location to state of associated Solution object.
vector< double > getState(int loc)
Retrieve the state vector for a given location.
void writeEntry(const string &fname, bool overwrite=false, const string &basis="")
Write SolutionArray data to a CSV file.
int size() const
Size of SolutionArray (number of entries).
vector< long int > m_apiShape
Shape information used by high-level API's.
shared_ptr< SolutionArray > share(const vector< int > &selected)
Share locations from an existing SolutionArray and return new reference.
shared_ptr< Solution > m_sol
Solution object associated with state data.
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
Namespace for the Cantera kernel.
const size_t npos
index returned by functions to indicate "no position"