Cantera  3.1.0a1
Loading...
Searching...
No Matches
YamlWriter Class Reference

A class for generating full YAML input files from multiple data sources. More...

#include <YamlWriter.h>

Detailed Description

A class for generating full YAML input files from multiple data sources.

Definition at line 27 of file YamlWriter.h.

Public Member Functions

void setHeader (const AnyMap &header)
 Include top-level information used in YAML header block.
 
void addPhase (shared_ptr< Solution > soln, bool includeAdjacent=true)
 Include a phase definition for the specified Solution object.
 
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.
 
string toYamlString () const
 Return a YAML string that contains the definitions for the added phases, species, and reactions.
 
void toYamlFile (const string &filename) const
 Write the definitions for the added phases, species and reactions to the specified file.
 
void setPrecision (long int n)
 For output floating point values, set the maximum number of digits to the right of the decimal point.
 
void skipUserDefined (bool skip=true)
 By default user-defined data present in the input is preserved on output.
 
void setUnits (const map< string, string > &units={})
 Set the units to be used in the output file.
 
void setUnitSystem (const UnitSystem &units=UnitSystem())
 Set the units to be used in the output file.
 

Protected Attributes

AnyMap m_header
 Top-level information used in YAML header block.
 
vector< shared_ptr< Solution > > m_phases
 
long int m_float_precision = 15
 See setPrecision()
 
bool m_skip_user_defined = false
 See skipUserDefined()
 
UnitSystem m_output_units
 Top-level units directive for the output file.
 

Member Function Documentation

◆ setHeader()

void setHeader ( const AnyMap header)

Include top-level information used in YAML header block.

Definition at line 19 of file YamlWriter.cpp.

◆ addPhase() [1/2]

void addPhase ( shared_ptr< Solution soln,
bool  includeAdjacent = true 
)

Include a phase definition for the specified Solution object.

Definition at line 23 of file YamlWriter.cpp.

◆ addPhase() [2/2]

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 45 of file YamlWriter.cpp.

◆ toYamlString()

string toYamlString ( ) const

Return a YAML string that contains the definitions for the added phases, species, and reactions.

Definition at line 55 of file YamlWriter.cpp.

◆ toYamlFile()

void toYamlFile ( const string &  filename) const

Write the definitions for the added phases, species and reactions to the specified file.

Definition at line 189 of file YamlWriter.cpp.

◆ setPrecision()

void setPrecision ( long int  n)
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 53 of file YamlWriter.h.

◆ skipUserDefined()

void skipUserDefined ( bool  skip = true)
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 60 of file YamlWriter.h.

◆ setUnits()

void setUnits ( const map< string, string > &  units = {})

Set the units to be used in the output file.

Dimensions not specified will use Cantera's defaults.

Parameters
unitsA 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 195 of file YamlWriter.cpp.

◆ setUnitSystem()

void setUnitSystem ( const UnitSystem units = UnitSystem())

Set the units to be used in the output file.

Dimensions not specified will use Cantera's defaults.

Parameters
unitsA UnitSystem object specifying dimensions (mass, length, time, quantity, pressure, energy, activation-energy).

Definition at line 201 of file YamlWriter.cpp.

Member Data Documentation

◆ m_header

AnyMap m_header
protected

Top-level information used in YAML header block.

Definition at line 79 of file YamlWriter.h.

◆ m_phases

vector<shared_ptr<Solution> > m_phases
protected

Definition at line 81 of file YamlWriter.h.

◆ m_float_precision

long int m_float_precision = 15
protected

See setPrecision()

Definition at line 84 of file YamlWriter.h.

◆ m_skip_user_defined

bool m_skip_user_defined = false
protected

See skipUserDefined()

Definition at line 87 of file YamlWriter.h.

◆ m_output_units

UnitSystem m_output_units
protected

Top-level units directive for the output file.

Defaults to Cantera's native SI+kmol system.

Definition at line 91 of file YamlWriter.h.


The documentation for this class was generated from the following files: