Cantera  3.1.0a1
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. 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...
 
string toYamlString () const
 Return a YAML string that contains the definitions for the added phases, species, and reactions. More...
 
void toYamlFile (const 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 map< string, 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...
 
vector< shared_ptr< Solution > > m_phases
 
long int m_float_precision = 15
 See setPrecision() More...
 
bool m_skip_user_defined = false
 See skipUserDefined() More...
 
UnitSystem m_output_units
 Top-level units directive for the output file. More...
 

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_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: