antioch-0.4.0
cea_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 
28 
29 // Antioch
30 #include "antioch/ascii_parser.h"
31 #include "antioch/chemkin_parser.h"
32 #include "antioch/xml_parser.h"
33 #include "antioch/cea_mixture.h"
34 
35 // C++
36 #include <iostream>
37 
38 namespace Antioch
39 {
40  template<class NumericType>
41  void read_cea_mixture_data( CEAThermoMixture<NumericType >& thermo, const std::string & filename, ParsingType type, bool verbose )
42  {
43 
44  ParserBase<NumericType> * parser(NULL);
45  switch(type)
46  {
47  case ASCII:
48  parser = new ASCIIParser<NumericType>(filename,verbose);
49  break;
50  case CHEMKIN:
51  parser = new ChemKinParser<NumericType>(filename,verbose);
52  break;
53  case XML:
54  parser = new XMLParser<NumericType>(filename,verbose);
55  break;
56  default:
57  antioch_parsing_error("unknown type");
58  }
59 
60  parser->read_thermodynamic_data(thermo);
61  // Make sure we actually populated everything
62  if( !thermo.check() )
63  {
64  std::cerr << "Error: CEA table not fully populated" << std::endl;
65  antioch_error();
66  }
67  }
68 
69  // Instantiate
70  template void read_cea_mixture_data<float>( CEAThermoMixture<float>&,const std::string&, ParsingType, bool );
71  template void read_cea_mixture_data<double>( CEAThermoMixture<double>&,const std::string&, ParsingType, bool );
72  template void read_cea_mixture_data<long double>( CEAThermoMixture<long double>&,const std::string&, ParsingType, bool );
73 
74 } // end namespace Antioch
template void read_cea_mixture_data< double >(CEAThermoMixture< double > &, const std::string &, ParsingType, bool)
virtual void read_thermodynamic_data(NASAThermoMixture< NumericType, NASA7CurveFit< NumericType > > &)
thermo
Definition: parser_base.h:143
void read_cea_mixture_data(CEAThermoMixture< NumericType > &thermo, const std::string &filename, ParsingType type, bool verbose=true)
template void read_cea_mixture_data< long double >(CEAThermoMixture< long double > &, const std::string &, ParsingType, bool)
#define antioch_error()
Nothing is stored, this parser is based on the tinyxml2 implementation.
#define antioch_parsing_error(description)
The parameters are reduced parameters.
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.
template void read_cea_mixture_data< float >(CEAThermoMixture< float > &, const std::string &, ParsingType, bool)
ChemKin format file reader.

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