Cantera  2.3.0
utils.cpp
Go to the documentation of this file.
1 //! @file utils.cpp
2 
3 // This file is part of Cantera. See License.txt in the top-level directory or
4 // at http://www.cantera.org/license.txt for license and copyright information.
5 
6 #include "cantera/tpx/utils.h"
8 
9 #include "CarbonDioxide.h"
10 #include "Heptane.h"
11 #include "HFC134a.h"
12 #include "Hydrogen.h"
13 #include "Methane.h"
14 #include "Nitrogen.h"
15 #include "Oxygen.h"
16 #include "Water.h"
17 #include "RedlichKwong.h"
18 
19 namespace tpx
20 {
21 Substance* GetSubstanceByName(std::string name)
22 {
23  std::string lcname = boost::algorithm::to_lower_copy(name);
24  if (lcname == "water") {
25  return new water;
26  } else if (lcname == "nitrogen") {
27  return new nitrogen;
28  } else if (lcname == "methane") {
29  return new methane;
30  } else if (lcname == "hydrogen") {
31  return new hydrogen;
32  } else if (lcname == "oxygen") {
33  return new oxygen;
34  } else if (lcname == "hfc134a") {
35  return new HFC134a;
36  } else if (lcname == "rk") {
37  return new RedlichKwong;
38  } else if (lcname == "carbondioxide") {
39  return new CarbonDioxide;
40  } else if (lcname == "heptane") {
41  return new Heptane;
42  } else {
43  return 0;
44  }
45 }
46 
47 Substance* GetSub(int isub)
48 {
49  if (isub == 0) {
50  return new water;
51  } else if (isub == 1) {
52  return new nitrogen;
53  } else if (isub == 2) {
54  return new methane;
55  } else if (isub == 3) {
56  return new hydrogen;
57  } else if (isub == 4) {
58  return new oxygen;
59  } else if (isub == 5) {
60  return new HFC134a;
61  } else if (isub == 6) {
62  return new RedlichKwong;
63  } else if (isub == 7) {
64  return new CarbonDioxide;
65  } else if (isub == 8) {
66  return new Heptane;
67  } else {
68  return 0;
69  }
70 }
71 
72 }
Contains declarations for string manipulation functions within Cantera.