antioch-0.4.0
species_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/parser_base.h"
33 
34 // C++
35 #include <iostream>
36 
37 namespace Antioch
38 {
39  template <typename NumericType>
42  {
43  std::vector<std::string> species = parser->species_list();
44 
45  mixture.initialize_species(species);
46  }
47 
48  template<class NumericType>
50  ChemicalMixture<NumericType>& chem_mixture)
51  {
52  parser->read_chemical_species(chem_mixture);
53 
54  // sanity check, we require these informations
55  bool fail(false);
56  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
57  {
58  if(!chem_mixture.chemical_species()[s])
59  {
60  fail = true;
61  break;
62  }
63  }
64  if(fail)
65  {
66  std::cerr << "Molecule(s) is(are) missing. Please update the information."
67  << " Currently using file " << parser->file() << ".\n"
68  << "Missing molecule(s) is(are):" << std::endl;
69  for(unsigned int i = 0; i < chem_mixture.species_list().size(); i++)
70  {
71  if(!chem_mixture.chemical_species()[i])
72  {
73  std::cerr << chem_mixture.species_inverse_name_map().at(i) << std::endl;
74  }
75  }
76  antioch_error();
77  }
78  }
79 
80  template<class NumericType>
82  ChemicalMixture<NumericType>& chem_mixture)
83  {
84  parser->read_vibrational_data(chem_mixture);
85 
86  // sanity check, we check these informations
87  std::vector<std::string> missing;
88  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
89  {
90  if(chem_mixture.chemical_species()[s]->theta_v().empty())missing.push_back(chem_mixture.chemical_species()[s]->species());
91  }
92  if(!missing.empty())
93  {
94  std::cout << "WARNING:\nVibrational levels are missing. Please update the information."
95  << " Currently using file " << parser->file() << ".\n"
96  << "Missing molecule(s) is(are):" << std::endl;
97  for(unsigned int m = 0; m < missing.size(); m++)std::cerr << missing[m] << std::endl;
98  }
99  }
100 
101 
102  template<class NumericType>
104  ChemicalMixture<NumericType>& chem_mixture)
105 
106  {
107  parser->read_electronic_data(chem_mixture);
108 
109  // sanity check, we check these informations
110  std::vector<std::string> missing;
111  for(unsigned int s = 0; s < chem_mixture.chemical_species().size(); s++)
112  {
113  if(chem_mixture.chemical_species()[s]->theta_e().empty())missing.push_back(chem_mixture.chemical_species()[s]->species());
114  }
115  if(!missing.empty())
116  {
117  std::cerr << "WARNING:\nElectronic levels are missing. Please update the information."
118  << " Currently using file " << parser->file() << ".\n"
119  << "Missing molecule(s) is(are):" << std::endl;
120  for(unsigned int m = 0; m < missing.size(); m++)std::cerr << missing[m] << std::endl;
121  }
122  }
123 
125 
126 } // end namespace Antioch
virtual void read_chemical_species(ChemicalMixture< NumericType > &)
reads the mandatory data, not valid in xml && chemkin
Definition: parser_base.h:127
void read_species_electronic_data(ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
ANTIOCH_SPECIES_PARSING_INSTANTIATE()
const std::vector< Species > & species_list() const
#define antioch_error()
void read_species_data(ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
void read_species_vibrational_data(ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &chem_mixture)
virtual const std::vector< std::string > species_list()
reads the species set
Definition: parser_base.h:124
const std::string file() const
Definition: parser_base.h:242
const std::map< Species, std::string > & species_inverse_name_map() const
void initialize_species(const std::vector< std::string > &species_list)
method to initialize, backward compatibility
virtual void read_electronic_data(ChemicalMixture< NumericType > &)
reads the electronic data, not valid in xml && chemkin
Definition: parser_base.h:133
void read_chemical_species_composition(ParserBase< NumericType > *parser, ChemicalMixture< NumericType > &mixture)
virtual void read_vibrational_data(ChemicalMixture< NumericType > &)
reads the vibrational data, not valid in xml && chemkin
Definition: parser_base.h:130
Class storing chemical mixture properties.
The parameters are reduced parameters.
A parser is an instance related to a file.
const std::vector< ChemicalSpecies< CoeffType > * > & chemical_species() const

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