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 28 #include "antioch/nasa_mixture_parsing.h" 29 #include "antioch/nasa_mixture_ascii_parsing.h" 30 31 // Antioch 32 #include "antioch/nasa_mixture_parsing_instantiate_macro.h" 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> read_nasa_mixture_data(NASAThermoMixture<NumericType,CurveType> & thermo,const std::string & filename,ParsingType type,bool verbose)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> read_nasa_mixture_data_ascii(NASAThermoMixture<NumericType,NASA7CurveFit<NumericType>> & thermo,const std::string & filename)74 void read_nasa_mixture_data_ascii( NASAThermoMixture<NumericType, NASA7CurveFit<NumericType> >& thermo, const std::string &filename ) 75 { 76 antioch_deprecated(); 77 read_nasa_mixture_data( thermo, filename, CHEMKIN, true); 78 } 79 80 // Instantiate 81 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE(NASA7CurveFit); 82 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE(NASA9CurveFit); 83 ANTIOCH_NASA_MIXTURE_PARSING_INSTANTIATE(CEACurveFit); 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 90