antioch-0.4.0
chemkin_definitions.h
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 //Antioch
28 
29 //C++
30 #include <string>
31 #include <map>
32 
33 namespace Antioch
34 {
35 
36 /*ChemKin spec*/
37 
39  {
40  public:
43 
44  enum Delim{ ERROR = -1,
49  };
50 
51  enum Symbol{
52  TB = 0,
53  FAL,
56  };
57 
58  const std::map<Delim,std::string> & delim() const;
59 
60  const std::map<Symbol,std::string> & symbol() const;
61 
62  const std::string & reversible() const;
63 
64  const std::string & duplicate() const;
65 
66  const std::string & end_tag() const;
67 
68  const std::string & comment() const;
69 
70  const std::string & parser() const;
71 
72  bool is_comment(const char & c) const;
73 
74  bool is_equation_delimiter(const std::string & test) const;
75 
76  Delim equation_delimiter(const std::string & test) const;
77 
78  private:
79  const std::string _reversible;
80  const std::string _duplicate;
81  const std::string _end_tag;
82  const std::string _comment;
83  const std::string _parser;
84  std::map<Delim,std::string> _delim;
85  std::map<Symbol,std::string> _symbol;
86 
87  };
88 
89  inline
91  _reversible("REV"),
92  _duplicate("DUP"),
93  _end_tag("END"),
94  _comment("!"),
95  _parser("/")
96  {
97  _delim[PLUS] = "+";
98  _delim[REVERSIBLE] = "=";
99  _delim[REVERSIBLE_ALT] = "<=>";
100  _delim[IRREVERSIBLE] = "=>";
101 
102  _symbol[TB] = "M";
103  _symbol[FAL] = "(+M)";
104  _symbol[PHOTO] = "HV";
105  _symbol[ELECTRO] = "E";
106  }
107 
108  inline
109  const std::map<ChemKinDefinitions::Delim,std::string> & ChemKinDefinitions::delim() const
110  {
111  return _delim;
112  }
113 
114  inline
115  const std::map<ChemKinDefinitions::Symbol,std::string> & ChemKinDefinitions::symbol() const
116  {
117  return _symbol;
118  }
119 
120  inline
121  const std::string & ChemKinDefinitions::reversible() const
122  {
123  return _reversible;
124  }
125 
126  inline
127  const std::string & ChemKinDefinitions::duplicate() const
128  {
129  return _duplicate;
130  }
131 
132  inline
133  const std::string & ChemKinDefinitions::end_tag() const
134  {
135  return _end_tag;
136  }
137 
138  inline
139  const std::string & ChemKinDefinitions::comment() const
140  {
141  return _comment;
142  }
143 
144  inline
145  const std::string & ChemKinDefinitions::parser() const
146  {
147  return _parser;
148  }
149 
150  inline
151  bool ChemKinDefinitions::is_comment(const char & c) const
152  {
153  return (c == _comment[0]);
154  }
155 
156  inline
157  bool ChemKinDefinitions::is_equation_delimiter(const std::string & test) const
158  {
159  return (test == _delim.at(REVERSIBLE) ||
160  test == _delim.at(REVERSIBLE_ALT) ||
161  test == _delim.at(IRREVERSIBLE)
162  );
163  }
164 
165  inline
167  {
168  if(test.find(_delim.at(REVERSIBLE_ALT)) != std::string::npos)
169  {
170  return REVERSIBLE_ALT;
171  }else if(test.find(_delim.at(IRREVERSIBLE)) != std::string::npos)
172  {
173  return IRREVERSIBLE;
174  }else if(test.find(_delim.at(REVERSIBLE)) != std::string::npos)
175  {
176  return REVERSIBLE;
177  }else
178  {
179  return ERROR;
180  }
181  }
182 
183 }
const std::string & duplicate() const
const std::string & parser() const
Delim equation_delimiter(const std::string &test) const
std::map< Symbol, std::string > _symbol
bool is_equation_delimiter(const std::string &test) const
const std::string & comment() const
const std::string & end_tag() const
bool is_comment(const char &c) const
const std::map< Delim, std::string > & delim() const
const std::map< Symbol, std::string > & symbol() const
std::map< Delim, std::string > _delim
const std::string & reversible() const
The parameters are reduced parameters.

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