antioch-0.4.0
nasa_mixture_parsing.C
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 
30 
31 // Antioch
33 #include "antioch/parsing_enum.h"
34 #include "antioch/ascii_parser.h"
35 #include "antioch/xml_parser.h"
36 #include "antioch/chemkin_parser.h"
37 #include "antioch/nasa_mixture.h"
38 
39 namespace Antioch
40 {
41  template<class NumericType, typename CurveType>
42  void read_nasa_mixture_data( NASAThermoMixture<NumericType, CurveType >& thermo, const std::string &filename, ParsingType type, bool verbose )
43  {
44 
45  ParserBase<NumericType> * parser(NULL);
46  switch(type)
47  {
48  case ASCII:
49  parser = new ASCIIParser<NumericType>(filename,verbose);
50  break;
51  case CHEMKIN:
52  parser = new ChemKinParser<NumericType>(filename,verbose);
53  break;
54  case XML:
55  parser = new XMLParser<NumericType>(filename,verbose);
56  break;
57  default:
58  antioch_parsing_error("unknown type");
59  }
60 
61  parser->read_thermodynamic_data(thermo);
62 
63  // Make sure we actually populated everything
64  if( !thermo.check() )
65  {
66  std::cerr << "Error: NASA table not fully populated" << std::endl;
67  antioch_error();
68  }
69 
70  return;
71  }
72 
73  template<class NumericType>
74  void read_nasa_mixture_data_ascii( NASAThermoMixture<NumericType, NASA7CurveFit<NumericType> >& thermo, const std::string &filename )
75  {
77  read_nasa_mixture_data( thermo, filename, CHEMKIN, true);
78  }
79 
80  // Instantiate
84 
85  template void read_nasa_mixture_data_ascii<float>( NASAThermoMixture<float,NASA7CurveFit<float> >&, const std::string& );
86  template void read_nasa_mixture_data_ascii<double>( NASAThermoMixture<double,NASA7CurveFit<double> >&, const std::string& );
87  template void read_nasa_mixture_data_ascii<long double>( NASAThermoMixture<long double,NASA7CurveFit<long double> >&, const std::string& );
88 
89 } // end namespace Antioch
template void read_nasa_mixture_data_ascii< double >(NASAThermoMixture< double, NASA7CurveFit< double > > &, const std::string &)
virtual void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &)
thermo
Definition: parser_base.h:143
#define antioch_error()
void read_nasa_mixture_data(NASAThermoMixture< NumericType, CurveType > &thermo, const std::string &filename=DefaultSourceFilename::thermo_data(), ParsingType=ASCII, bool verbose=true)
#define antioch_deprecated()
void read_nasa_mixture_data_ascii(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &thermo, const std::string &filename)
Nothing is stored, this parser is based on the tinyxml2 implementation.
#define antioch_parsing_error(description)
The parameters are reduced parameters.
template void read_nasa_mixture_data_ascii< long double >(NASAThermoMixture< long double, NASA7CurveFit< long double > > &, const std::string &)
A parser is an instance related to a file.
bool check() const
Checks that curve fits have been specified for all species in the mixture.
Definition: nasa_mixture.h:163
ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE(NASA7CurveFit)
template void read_nasa_mixture_data_ascii< float >(NASAThermoMixture< float, NASA7CurveFit< float > > &, const std::string &)
ChemKin format file reader.

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