antioch-0.4.0
parser_base.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // Antioch - A Gas Dynamics Thermochemistry Library
5 //
6 // Copyright (C) 2014-2016 Paul T. Bauman, Benjamin S. Kirk,
7 // Sylvain Plessis, Roy H. Stonger
8 //
9 // Copyright (C) 2013 The PECOS Development Team
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the Version 2.1 GNU Lesser General
13 // Public License as published by the Free Software Foundation.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
23 // Boston, MA 02110-1301 USA
24 //
25 //-----------------------------------------------------------------------el-
26 
27 #ifndef ANTIOCH_PARSER_BASE_H
28 #define ANTIOCH_PARSER_BASE_H
29 
30 //Antioch
32 #include "antioch/parsing_enum.h"
33 #include "antioch/input_utils.h"
34 
35 //C++
36 #include <vector>
37 #include <string>
38 #include <sstream>
39 #include <map>
40 
41 namespace Antioch
42 {
43 
44  // Forward declarations
45  template <class NumericType>
46  class ChemicalMixture;
47 
48  template <class NumericType>
49  class TransportMixture;
50 
51  template <typename NumericType, typename CurveFit>
52  class NASAEvaluator;
53 
54  template <typename NumericType, typename CurveFit>
55  class NASAThermoMixture;
56 
57  template <typename NumericType>
58  class NASA7CurveFit;
59 
60  template <typename NumericType>
61  class NASA9CurveFit;
62 
63  // backward compatibility
64  template <typename NumericType>
65  class CEACurveFit;
66 
67  template <typename NumericType>
68  class CEAThermodynamics;
69 
70  template <typename NumericType>
71  class CEAEvaluator;
72 
73 // micro
74  template <typename NumericType>
75  class StatMechThermodynamics;
76 
77  template <typename Macro, typename NumericType>
78  class IdealGasMicroThermo;
79 
105  template <typename NumericType>
106  class ParserBase
107  {
108  public:
109  ParserBase(const std::string & type,
110  const std::string & file,
111  bool verbose = true,
112  const std::string & comments = "");
113 
114  virtual ~ParserBase(){};
115 
116  // initialize kinetics, mandatory
117  virtual bool initialize() = 0;
118 
119  // to reinitialize, mandatory
120  virtual void change_file(const std::string & filename) = 0;
121 
124  virtual const std::vector<std::string> species_list() {antioch_not_implemented_msg(_not_implemented); return std::vector<std::string>();}
125 
128 
131 
134 
135 // transport
136 
139 
141 
144 
147 
150 
153 
155 
156 // non const
157 
159  virtual bool reaction() {antioch_not_implemented_msg(_not_implemented); return false;}
160 
162  virtual bool rate_constant(const std::string & /*kinetics_model*/) {antioch_not_implemented_msg(_not_implemented); return false;}
163 
164 // const
165 
167  virtual bool Troe() const {antioch_not_implemented_msg(_not_implemented); return false;}
168 
170  virtual const std::string reaction_id() const {antioch_not_implemented_msg(_not_implemented); return std::string();}
171 
173  virtual const std::string reaction_equation() const {antioch_not_implemented_msg(_not_implemented); return std::string();}
174 
176  virtual const std::string reaction_chemical_process() const {antioch_not_implemented_msg(_not_implemented); return std::string();}
177 
179  virtual const std::string reaction_kinetics_model(const std::vector<std::string> & /*kinetics_models*/) const {antioch_not_implemented_msg(_not_implemented); return std::string();}
180 
182  virtual bool reaction_reversible() const {antioch_not_implemented_msg(_not_implemented); return false;}
183 
185  virtual bool reactants_pairs(std::vector<std::pair<std::string,int> > & /*reactants_pair*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
186 
188  virtual bool products_pairs(std::vector<std::pair<std::string,int> > & /*products_pair*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
189 
191  virtual const std::map<std::string,NumericType> reactants_orders() const {antioch_not_implemented_msg(_not_implemented); return std::map<std::string,NumericType>();}
192 
194  virtual const std::map<std::string,NumericType> products_orders() const {antioch_not_implemented_msg(_not_implemented); return std::map<std::string,NumericType>();}
195 
197  virtual bool is_k0(unsigned int /*nrc*/, const std::string & /*kin_model*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
198 
200  virtual unsigned int where_is_k0(const std::string & /*kin_model*/) const {antioch_not_implemented_msg(_not_implemented); return -1;}
201 
203  virtual bool rate_constant_preexponential_parameter(NumericType & /*A*/, std::string & /*A_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
204 
206  virtual bool rate_constant_power_parameter(NumericType & /*b*/, std::string & /*b_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
207 
209  virtual bool rate_constant_activation_energy_parameter(NumericType & /*Ea*/, std::string & /*Ea_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
210 
212  virtual bool rate_constant_Berthelot_coefficient_parameter(NumericType & /*D*/, std::string & /*D_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
213 
215  virtual bool rate_constant_Tref_parameter( NumericType & /*Tref*/, std::string & /*Tref_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
216 
218  virtual bool rate_constant_lambda_parameter(std::vector<NumericType> & /*lambda*/, std::string & /*lambda_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
219 
221  virtual bool rate_constant_cross_section_parameter(std::vector<NumericType> & /*sigma*/, std::string & /*sigma_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
222 
225 
227  virtual bool efficiencies(std::vector<std::pair<std::string,NumericType> > & /*par_values*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
228 
230  virtual bool Troe_alpha_parameter(NumericType & /*alpha*/, std::string & /*alpha_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
231 
233  virtual bool Troe_T1_parameter(NumericType & /*T1*/, std::string & /*T1_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
234 
236  virtual bool Troe_T2_parameter(NumericType & /*T2*/, std::string & /*T2_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
237 
239  virtual bool Troe_T3_parameter(NumericType & /*T3*/, std::string & /*T3_unit*/, std::string & /*def_unit*/) const {antioch_not_implemented_msg(_not_implemented); return false;}
240 
242  const std::string file() const {return _file;}
243 
245  const std::string type() const {return _type;}
246 
248  bool verbose() const {return _verbose;}
249 
251  ParsingType enum_type() const;
252 
253 
254  protected:
255 
256  void skip_comments(std::istream & doc);
257 
258  std::string _type;
259  std::string _file;
260  bool _verbose;
261  std::string _comments;
262 
263  std::string _not_implemented;
264 
265  private:
266  ParserBase();
267  };
268 
269 } // end namespace Antioch
270 
271 
272 #endif //ANTIOCH_PARSER_BASE_H
virtual void read_chemical_species(ChemicalMixture< NumericType > &)
reads the mandatory data, not valid in xml && chemkin
Definition: parser_base.h:127
virtual const std::string reaction_kinetics_model(const std::vector< std::string > &) const
Definition: parser_base.h:179
virtual bool Troe_T1_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:233
#define antioch_not_implemented_msg(errmsg)
ParsingType enum_type() const
Definition: parser_base.C:63
std::string _comments
Definition: parser_base.h:261
virtual const std::string reaction_chemical_process() const
Definition: parser_base.h:176
virtual bool rate_constant_lambda_parameter(std::vector< NumericType > &, std::string &, std::string &) const
Definition: parser_base.h:218
virtual void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &)
thermo
Definition: parser_base.h:143
virtual const std::map< std::string, NumericType > reactants_orders() const
return a map between reactants' name and found partial orders
Definition: parser_base.h:191
void skip_comments(std::istream &doc)
Definition: parser_base.C:54
virtual bool initialize()=0
virtual bool rate_constant_Berthelot_coefficient_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:212
virtual bool Troe_T2_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:236
virtual bool rate_constant_activation_energy_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:209
virtual bool rate_constant_power_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:206
virtual void read_transport_data(TransportMixture< NumericType > &)
reads the transport data, not valid in xml && chemkin
Definition: parser_base.h:138
virtual unsigned int where_is_k0(const std::string &) const
Definition: parser_base.h:200
virtual ~ParserBase()
Definition: parser_base.h:114
virtual const std::map< std::string, NumericType > products_orders() const
return a map between products' name and found partial orders
Definition: parser_base.h:194
virtual bool rate_constant_preexponential_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:203
virtual bool Troe_T3_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:239
virtual const std::vector< std::string > species_list()
reads the species set
Definition: parser_base.h:124
const std::string type() const
Definition: parser_base.h:245
virtual bool rate_constant_Tref_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:215
std::string _type
Definition: parser_base.h:258
This class stores the NASA polynomial fit to the thermodynamics quantities and .
Definition: ascii_parser.h:68
virtual bool Troe() const
Definition: parser_base.h:167
const std::string file() const
Definition: parser_base.h:242
This class only differs from NASA9CurveFit in the construction.
Definition: ascii_parser.h:72
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
virtual bool reactants_pairs(std::vector< std::pair< std::string, int > > &) const
Definition: parser_base.h:185
virtual const std::string reaction_id() const
Definition: parser_base.h:170
virtual bool rate_constant(const std::string &)
go to next rate constant
Definition: parser_base.h:162
bool verbose() const
Definition: parser_base.h:248
virtual const std::string reaction_equation() const
Definition: parser_base.h:173
virtual void change_file(const std::string &filename)=0
virtual void read_electronic_data(ChemicalMixture< NumericType > &)
reads the electronic data, not valid in xml && chemkin
Definition: parser_base.h:133
virtual bool efficiencies(std::vector< std::pair< std::string, NumericType > > &) const
Definition: parser_base.h:227
virtual void read_thermodynamic_data(CEAThermodynamics< NumericType > &)
reads the thermo, CEA deprecated
Definition: parser_base.h:152
virtual void read_vibrational_data(ChemicalMixture< NumericType > &)
reads the vibrational data, not valid in xml && chemkin
Definition: parser_base.h:130
virtual void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA9CurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
Definition: parser_base.h:146
Class storing chemical mixture properties.
The parameters are reduced parameters.
virtual bool verify_Kooij_in_place_of_Arrhenius() const
Definition: parser_base.h:224
virtual bool Troe_alpha_parameter(NumericType &, std::string &, std::string &) const
Definition: parser_base.h:230
virtual bool rate_constant_cross_section_parameter(std::vector< NumericType > &, std::string &, std::string &) const
Definition: parser_base.h:221
virtual bool reaction_reversible() const
Definition: parser_base.h:182
virtual bool reaction()
reaction
Definition: parser_base.h:159
virtual bool products_pairs(std::vector< std::pair< std::string, int > > &) const
Definition: parser_base.h:188
std::string _file
Definition: parser_base.h:259
std::string _not_implemented
Definition: parser_base.h:263
virtual void read_thermodynamic_data(NASAThermoMixture< NumericType, CEACurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
Definition: parser_base.h:149
virtual bool is_k0(unsigned int, const std::string &) const
Definition: parser_base.h:197

Generated on Thu Jul 7 2016 11:09:45 for antioch-0.4.0 by  doxygen 1.8.8