Cantera 2.6.0
Public Member Functions | Protected Attributes | List of all members
YamlWriter Class Reference

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

#include <YamlWriter.h>

Collaboration diagram for YamlWriter:
[legend]

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...
 

Detailed Description

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

Definition at line 22 of file YamlWriter.h.

Constructor & Destructor Documentation

◆ YamlWriter()

Definition at line 20 of file YamlWriter.cpp.

Member Function Documentation

◆ setHeader()

void setHeader ( const AnyMap header)

Include top-level information used in YAML header block.

Definition at line 26 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 30 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 52 of file YamlWriter.cpp.

◆ toYamlString()

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().

◆ toYamlFile()

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.

◆ 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 48 of file YamlWriter.h.

References YamlWriter::m_float_precision.

◆ 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 55 of file YamlWriter.h.

References YamlWriter::m_skip_user_defined.

◆ setUnits()

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.

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

Member Data Documentation

◆ m_header

AnyMap m_header
protected

Top-level information used in YAML header block.

Definition at line 74 of file YamlWriter.h.

◆ m_phases

std::vector<shared_ptr<Solution> > m_phases
protected

Definition at line 76 of file YamlWriter.h.

◆ m_float_precision

long int m_float_precision
protected
See also
setPrecision()

Definition at line 79 of file YamlWriter.h.

Referenced by YamlWriter::setPrecision().

◆ m_skip_user_defined

bool m_skip_user_defined
protected
See also
skipUserDefined()

Definition at line 82 of file YamlWriter.h.

Referenced by YamlWriter::skipUserDefined().

◆ 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 86 of file YamlWriter.h.


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