antioch-0.4.0
ascii_parser_unit.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 
29 #include "antioch/ascii_parser.h"
30 
31 #include <iomanip>
32 #include <string>
33 
34 template <typename Scalar>
35 int tester(const std::string& filename)
36 {
37 
38  std::vector<std::string> species_list;
39  species_list.push_back("N2");
40  species_list.push_back("O2");
41  species_list.push_back("H2");
42 
43  Antioch::ChemicalMixture<Scalar> chem_mix(species_list);
44 
45  Antioch::ASCIIParser<Scalar> parser(filename,true);
46 
47  parser.set_ignored_columns(std::vector<unsigned int>(1,0));
48 
49  Antioch::TransportMixture<Scalar> tran_mixture( chem_mix, static_cast<Antioch::ParserBase<Scalar>*>(&parser));
50 
51  return tran_mixture.transport_species().empty(); // false is winner
52 }
53 
54 int main(int argc, char* argv[])
55 {
56  // Check command line count.
57  if( argc < 2 )
58  {
59  // TODO: Need more consistent error handling.
60  std::cerr << "Error: Must specify ascii transport input file." << std::endl;
61  antioch_error();
62  }
63 
64  return tester<double>(std::string(argv[1]));
65 }
const std::vector< TransportSpecies< CoeffType > * > & transport_species() const
int main(int argc, char *argv[])
#define antioch_error()
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
int tester(const std::string &filename)
Class storing chemical mixture properties.
A parser is an instance related to a file.

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