Cantera 2.6.0
|
A class for generating full YAML input files from multiple data sources. More...
#include <YamlWriter.h>
Public Member Functions | |
void | setHeader (const AnyMap &header) |
Include top-level information used in YAML header block. More... | |
void | addPhase (shared_ptr< Solution > soln, bool includeAdjacent=true) |
Include a phase definition for the specified Solution object. More... | |
void | addPhase (shared_ptr< ThermoPhase > thermo, shared_ptr< Kinetics > kin={}, shared_ptr< Transport > tran={}) |
Include a phase definition using the specified ThermoPhase, (optional) Kinetics, and (optional) Transport objects. More... | |
std::string | toYamlString () const |
Return a YAML string that contains the definitions for the added phases, species, and reactions. More... | |
void | toYamlFile (const std::string &filename) const |
Write the definitions for the added phases, species and reactions to the specified file. More... | |
void | setPrecision (long int n) |
For output floating point values, set the maximum number of digits to the right of the decimal point. More... | |
void | skipUserDefined (bool skip=true) |
By default user-defined data present in the input is preserved on output. More... | |
void | setUnits (const std::map< std::string, std::string > &units={}) |
Set the units to be used in the output file. More... | |
void | setUnitSystem (const UnitSystem &units=UnitSystem()) |
Set the units to be used in the output file. More... | |
Protected Attributes | |
AnyMap | m_header |
Top-level information used in YAML header block. More... | |
std::vector< shared_ptr< Solution > > | m_phases |
long int | m_float_precision |
bool | m_skip_user_defined |
UnitSystem | m_output_units |
Top-level units directive for the output file. More... | |
A class for generating full YAML input files from multiple data sources.
Definition at line 22 of file YamlWriter.h.
YamlWriter | ( | ) |
Definition at line 20 of file YamlWriter.cpp.
void setHeader | ( | const AnyMap & | header | ) |
Include top-level information used in YAML header block.
Definition at line 26 of file YamlWriter.cpp.
void addPhase | ( | shared_ptr< Solution > | soln, |
bool | includeAdjacent = true |
||
) |
Include a phase definition for the specified Solution object.
Definition at line 30 of file YamlWriter.cpp.
void addPhase | ( | shared_ptr< ThermoPhase > | thermo, |
shared_ptr< Kinetics > | kin = {} , |
||
shared_ptr< Transport > | tran = {} |
||
) |
Include a phase definition using the specified ThermoPhase, (optional) Kinetics, and (optional) Transport objects.
Definition at line 52 of file YamlWriter.cpp.
std::string toYamlString | ( | ) | const |
Return a YAML string that contains the definitions for the added phases, species, and reactions.
Definition at line 62 of file YamlWriter.cpp.
References Cantera::gitCommit(), AnyMap::hasKey(), AnyBase::setLoc(), AnyMap::setMetadata(), AnyMap::setUnits(), AnyMap::size(), and Cantera::trimCopy().
void toYamlFile | ( | const std::string & | filename | ) | const |
Write the definitions for the added phases, species and reactions to the specified file.
Definition at line 197 of file YamlWriter.cpp.
|
inline |
For output floating point values, set the maximum number of digits to the right of the decimal point.
The default is 15 digits.
Definition at line 48 of file YamlWriter.h.
References YamlWriter::m_float_precision.
|
inline |
By default user-defined data present in the input is preserved on output.
This method can be used to skip output of user-defined data fields which are not directly used by Cantera.
Definition at line 55 of file YamlWriter.h.
References YamlWriter::m_skip_user_defined.
void setUnits | ( | const std::map< std::string, std::string > & | units = {} | ) |
Set the units to be used in the output file.
Dimensions not specified will use Cantera's defaults.
units | A map where keys are dimensions (mass, length, time, quantity, pressure, energy, activation-energy) and the values are corresponding units supported by the UnitSystem class. |
Definition at line 203 of file YamlWriter.cpp.
void setUnitSystem | ( | const UnitSystem & | units = UnitSystem() | ) |
Set the units to be used in the output file.
Dimensions not specified will use Cantera's defaults.
units | A UnitSystem object specifying dimensions (mass, length, time, quantity, pressure, energy, activation-energy). |
Definition at line 209 of file YamlWriter.cpp.
|
protected |
Top-level information used in YAML header block.
Definition at line 74 of file YamlWriter.h.
|
protected |
Definition at line 76 of file YamlWriter.h.
|
protected |
Definition at line 79 of file YamlWriter.h.
Referenced by YamlWriter::setPrecision().
|
protected |
Definition at line 82 of file YamlWriter.h.
Referenced by YamlWriter::skipUserDefined().
|
protected |
Top-level units directive for the output file.
Defaults to Cantera's native SI+kmol system.
Definition at line 86 of file YamlWriter.h.