26 #ifndef ANTIOCH_XML_PARSER_H
27 #define ANTIOCH_XML_PARSER_H
49 template <
typename CoeffType>
50 class ChemicalMixture;
52 template <
typename NumericType,
typename CurveType>
53 class NASAThermoMixture;
55 template <
typename NumericType>
58 template <
typename NumericType>
62 template <
typename NumericType>
78 template <
typename NumericType =
double>
79 class XMLParser:
public ParserBase<NumericType>
105 {
antioch_error_msg(
"ERROR: XML Parsing only supports parsing for NASA7CurveFit and NASA9CurveFit!");}
109 {
antioch_error_msg(
"ERROR: XML Parsing only supports parsing for NASA7CurveFit and NASA9CurveFit!");}
138 bool reactants_pairs(std::vector<std::pair<std::string,int> > & reactants_pair)
const;
141 bool products_pairs(std::vector<std::pair<std::string,int> > & products_pair)
const;
159 bool is_k0(
unsigned int nrc,
const std::string & kin_model)
const;
162 unsigned int where_is_k0(
const std::string & kin_model)
const;
189 bool efficiencies(std::vector<std::pair<std::string,NumericType> > & par_values)
const;
192 bool Troe_alpha_parameter(NumericType & alpha, std::string & alpha_unit, std::string & def_unit)
const;
195 bool Troe_T1_parameter( NumericType & T1, std::string & T1_unit, std::string & def_unit)
const;
198 bool Troe_T2_parameter( NumericType & T2, std::string & T2_unit, std::string & def_unit)
const;
201 bool Troe_T3_parameter( NumericType & T3, std::string & T3_unit, std::string & def_unit)
const;
206 template <
typename ThermoType>
210 template <
typename PairedType>
225 const std::string& elem_name,
226 const std::string& attribute,
227 const std::string& attr_value )
const;
239 {
antioch_error_msg(
"ERROR: Only supported for NASA7CurveFit and NASA9CurveFit!");
return "";}
243 {
antioch_error_msg(
"ERROR: Only supported for NASA7CurveFit and NASA9CurveFit!");
return "";}
260 std::map<ParsingKey,std::string>
_map;
bool rate_constant_power_parameter(NumericType &b, std::string &b_unit, std::string &def_unit) const
return true if beta coefficient
const std::string reaction_id() const
return reaction id, 0 if not provided
tinyxml2::XMLElement * _rate_constant
void read_thermodynamic_data(NASAThermoMixture< NumericType, CEACurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
bool rate_constant_Tref_parameter(NumericType &Tref, std::string &Tref_unit, std::string &def_unit) const
return true if Tref
bool initialize()
Read header of file, go to interesting part.
bool verify_Kooij_in_place_of_Arrhenius() const
return true if a Kooij is called Arrhenuis
bool Troe_T2_parameter(NumericType &T2, std::string &T2_unit, std::string &def_unit) const
return true is alpha
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &thermo)
reads the thermo, NASA generalist, no templates for virtual
const std::map< std::string, NumericType > reactants_orders() const
return a map between reactants' name and found partial orders
tinyxml2::XMLElement * _reaction_block
std::map< ParsingKey, std::string > _default_unit
void change_file(const std::string &filename)
bool Troe_alpha_parameter(NumericType &alpha, std::string &alpha_unit, std::string &def_unit) const
return true is alpha
void read_thermodynamic_data(CEAThermodynamics< NumericType > &)
reads the thermo, CEA deprecated
std::string nasa_xml_section(NASAThermoMixture< NumericType, CEACurveFit< NumericType > > &)
For the given thermo type, return the string for the corresponding XML section.
std::string nasa_xml_section(NASAThermoMixture< NumericType, NASA9CurveFit< NumericType > > &)
For the given thermo type, return the string for the corresponding XML section.
bool rate_constant_Berthelot_coefficient_parameter(NumericType &D, std::string &D_unit, std::string &def_unit) const
return true if D coefficient
bool efficiencies(std::vector< std::pair< std::string, NumericType > > &par_values) const
return true if efficiencies are found
bool rate_constant(const std::string &kinetics_model)
go to next rate constant
void read_thermodynamic_data_root(ThermoType &thermo)
reads the thermo, NASA generalist
const std::string reaction_chemical_process() const
return reaction chemical process
bool Troe_T3_parameter(NumericType &T3, std::string &T3_unit, std::string &def_unit) const
return true is alpha
std::string nasa_xml_section(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &)
For the given thermo type, return the string for the corresponding XML section.
XMLParser()
Never use default constructor.
bool molecules_pairs(tinyxml2::XMLElement *molecules, std::vector< std::pair< std::string, PairedType > > &products_pair) const
return pairs of molecules and stoichiometric coefficients
bool Troe() const
return true if there's a Troe block
const std::string unit(tinyxml2::XMLElement *parameter) const
return the unit of current pointer
This class stores the NASA polynomial fit to the thermodynamics quantities and .
bool rate_constant_preexponential_parameter(NumericType &A, std::string &A_unit, std::string &def_unit) const
return true if pre exponentiel coefficient
#define antioch_error_msg(errmsg)
This class only differs from NASA9CurveFit in the construction.
tinyxml2::XMLElement * _species_block
bool rate_constant_activation_energy_parameter(NumericType &Ea, std::string &Ea_unit, std::string &def_unit) const
return true if activation energie
const std::string reaction_equation() const
return reaction equation
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA9CurveFit< NumericType > > &thermo)
reads the thermo, NASA generalist, no templates for virtual
std::map< ParsingKey, std::string > _map
tinyxml2::XMLElement * _reaction
tinyxml2::XMLDocument * _doc
bool products_pairs(std::vector< std::pair< std::string, int > > &products_pair) const
return pairs of products and stoichiometric coefficients
bool rate_constant_lambda_parameter(std::vector< NumericType > &lambda, std::string &lambda_unit, std::string &def_unit) const
return true if lambda
bool get_parameter(const tinyxml2::XMLElement *ptr, const std::string &par, NumericType &par_value, std::string &par_unit) const
return a parameter's value
The parameters are reduced parameters.
std::string nasa_xml_section(CEAThermodynamics< NumericType > &)
For the given thermo type, return the string for the corresponding XML section.
bool is_k0(unsigned int nrc, const std::string &kin_model) const
return true if the concerned reaction rate is the low pressure limit
const std::string reaction_kinetics_model(const std::vector< std::string > &kinetics_models) const
return reaction kinetics model
bool reactants_pairs(std::vector< std::pair< std::string, int > > &reactants_pair) const
return pairs of reactants and stoichiometric coefficients
const std::vector< std::string > species_list()
reads the species set
tinyxml2::XMLElement * find_element_with_attribute(const tinyxml2::XMLElement *element, const std::string &elem_name, const std::string &attribute, const std::string &attr_value) const
Search the siblings of the element to find the element with the given value for the given attribute...
unsigned int where_is_k0(const std::string &kin_model) const
return index of k0 (0 or 1)
bool reaction_reversible() const
return reversible state
tinyxml2::XMLElement * _thermo_block
tinyxml2::XMLElement * _Troe
const std::map< std::string, NumericType > products_orders() const
return a map between products' name and found partial orders
bool Troe_T1_parameter(NumericType &T1, std::string &T1_unit, std::string &def_unit) const
return true is alpha
bool rate_constant_cross_section_parameter(std::vector< NumericType > &sigma, std::string &sigma_unit, std::string &def_unit) const
return true if sigma