antioch-0.4.0
ascii_parser.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_ASCII_PARSER_H
28 #define ANTIOCH_ASCII_PARSER_H
29 
30 // Antioch
32 #include "antioch/parser_base.h"
33 #include "antioch/parsing_enum.h"
34 #include "antioch/input_utils.h"
35 #include "antioch/string_utils.h"
36 #include "antioch/units.h"
37 
38 // C++
39 #include <fstream>
40 #include <string>
41 #include <vector>
42 #include <map>
43 
44 namespace Antioch
45 {
46 
47  // backward compatibility
48  typedef unsigned int Species;
49 
50  // Forward declarations
51  template <class NumericType>
52  class ChemicalMixture;
53 
54  template <class NumericType>
56 
57 // macro
58  template <typename NumericType, typename CurveFit>
60 
61  template <typename NumericType, typename CurveFit>
63 
64  template <typename NumericType>
66 
67  template <typename NumericType>
69 
70  // backward compatibility
71  template <typename NumericType>
72  class CEACurveFit;
73 
74  template <typename NumericType>
76 
77  template <typename NumericType>
78  class CEAEvaluator;
79 
80 // micro
81  template <typename NumericType>
83 
84  template <typename Macro, typename NumericType>
86 
87  template <typename NumericType>
88  class ASCIIParser: public ParserBase<NumericType>
89  {
90  public:
91  ASCIIParser(const std::string& file, bool verbose = true);
92  ~ASCIIParser();
93 
94  void change_file(const std::string & filename);
95 
96  bool initialize() {return false;}
97 
99  void set_ignored_columns(const std::vector<unsigned int> & ignored);
100 
102 // species
105  const std::vector<std::string> species_list() ;
106 
109 
112 
115 
117  void read_transport_data(TransportMixture<NumericType> & transport_mixture) {this->read_transport_data_root(transport_mixture);}
118 
119 
121 // thermo
123 
124 //global overload
127  {antioch_error_msg("ERROR: ASCIIParsing only supports parsing for CEACurveFit!");}
128 
131  {antioch_error_msg("ERROR: ASCIIParsing only supports parsing for CEACurveFit!");}
132 
135  {this->read_thermodynamic_data_root(thermo);}
136 
139 
140  private:
141 
142 // templated thermo version
144  template <typename CurveType>
146 
147 // templated transport version
149  template <typename Mixture>
150  void read_transport_data_root(Mixture & transport);
151 
153  void find_first(unsigned int & index,unsigned int n_data) const;
154 
156  void check_warn_for_species_with_untrusted_hf(const std::string& name) const;
157 
159  ASCIIParser();
160 
161  std::ifstream _doc;
162  std::map<ParsingUnit,std::string> _unit_map;
163 
164  std::vector<unsigned int> _ignored;
165  const unsigned int _n_columns_chemical_species;
166  const unsigned int _n_columns_vib_data;
167  const unsigned int _n_columns_el_data;
168  const unsigned int _n_columns_transport_species;
169 
172  };
173 
174 } // end namespace Antioch
175 
176 
177 #endif
void read_thermodynamic_data_root(NASAThermoMixture< NumericType, CurveType > &thermo)
read the thermodynamic data
Definition: ascii_parser.C:349
unsigned int Species
std::vector< unsigned int > _ignored
Definition: ascii_parser.h:164
bool _is_antioch_default_mixture_file
Needed to be able to warn about using not-trusted enthalpies of formation.
Definition: ascii_parser.h:171
void read_transport_data(TransportMixture< NumericType > &transport_mixture)
reads the transport data, not valid in xml && chemkin
Definition: ascii_parser.h:117
void read_electronic_data(ChemicalMixture< NumericType > &chem_mixture)
read the electronic data
Definition: ascii_parser.C:300
std::map< ParsingUnit, std::string > _unit_map
Definition: ascii_parser.h:162
void find_first(unsigned int &index, unsigned int n_data) const
find the index of the wanted data
Definition: ascii_parser.C:99
std::ifstream _doc
Definition: ascii_parser.h:161
void read_transport_data_root(Mixture &transport)
read the thermodynamic data
Definition: ascii_parser.C:438
const unsigned int _n_columns_el_data
Definition: ascii_parser.h:167
This class stores the NASA polynomial fit to the thermodynamics quantities and .
Definition: ascii_parser.h:68
#define antioch_error_msg(errmsg)
const std::string file() const
Definition: parser_base.h:242
void change_file(const std::string &filename)
Definition: ascii_parser.C:78
This class only differs from NASA9CurveFit in the construction.
Definition: ascii_parser.h:72
void set_ignored_columns(const std::vector< unsigned int > &ignored)
set the indexes of to-be-ignored columns
Definition: ascii_parser.C:133
Class storing chemical mixture properties.
Definition: ascii_parser.h:55
const unsigned int _n_columns_chemical_species
Definition: ascii_parser.h:165
void check_warn_for_species_with_untrusted_hf(const std::string &name) const
Warn about species for which Antioch default mixture file has untrusted H_f values.
Definition: ascii_parser.C:483
bool verbose() const
Definition: parser_base.h:248
Advanced unit class.
const unsigned int _n_columns_transport_species
Definition: ascii_parser.h:168
void read_vibrational_data(ChemicalMixture< NumericType > &chem_mixture)
read the vibrational data
Definition: ascii_parser.C:249
Class storing chemical mixture properties.
The parameters are reduced parameters.
void read_thermodynamic_data(NASAThermoMixture< NumericType, CEACurveFit< NumericType > > &thermo)
reads the thermo, NASA generalist, no templates for virtual
Definition: ascii_parser.h:134
const std::vector< std::string > species_list()
read species list
Definition: ascii_parser.C:139
A parser is an instance related to a file.
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
Definition: ascii_parser.h:126
const unsigned int _n_columns_vib_data
Definition: ascii_parser.h:166
void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA9CurveFit< NumericType > > &)
reads the thermo, NASA generalist, no templates for virtual
Definition: ascii_parser.h:130
ASCIIParser()
not allowed
void read_chemical_species(ChemicalMixture< NumericType > &chem_mixture)
read the mandatory data
Definition: ascii_parser.C:178

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