Cantera  2.1.2
utils.cpp
Go to the documentation of this file.
1 //! @file utils.cpp
2 #include "cantera/tpx/utils.h"
4 
5 #include "CarbonDioxide.h"
6 #include "Heptane.h"
7 #include "HFC134a.h"
8 #include "Hydrogen.h"
9 #include "Methane.h"
10 #include "Nitrogen.h"
11 #include "Oxygen.h"
12 #include "Water.h"
13 #include "RedlichKwong.h"
14 
15 namespace tpx
16 {
17 Substance* GetSubstanceByName(std::string name)
18 {
19  std::string lcname = Cantera::lowercase(name);
20  if (lcname == "water") {
21  return new water;
22  } else if (lcname == "nitrogen") {
23  return new nitrogen;
24  } else if (lcname == "methane") {
25  return new methane;
26  } else if (lcname == "hydrogen") {
27  return new hydrogen;
28  } else if (lcname == "oxygen") {
29  return new oxygen;
30  } else if (lcname == "hfc134a") {
31  return new HFC134a;
32  } else if (lcname == "rk") {
33  return new RedlichKwong;
34  } else if (lcname == "carbondioxide") {
35  return new CarbonDioxide;
36  } else if (lcname == "heptane") {
37  return new Heptane;
38  } else {
39  return 0;
40  }
41 }
42 
43 Substance* GetSub(int isub)
44 {
45  if (isub == 0) {
46  return new water;
47  } else if (isub == 1) {
48  return new nitrogen;
49  } else if (isub == 2) {
50  return new methane;
51  } else if (isub == 3) {
52  return new hydrogen;
53  } else if (isub == 4) {
54  return new oxygen;
55  } else if (isub == 5) {
56  return new HFC134a;
57  } else if (isub == 6) {
58  return new RedlichKwong;
59  } else if (isub == 7) {
60  return new CarbonDioxide;
61  } else if (isub == 8) {
62  return new Heptane;
63  } else {
64  return 0;
65  }
66 }
67 
68 }
std::string lowercase(const std::string &s)
Cast a copy of a string to lower case.
Definition: stringUtils.cpp:58
Contains declarations for string manipulation functions within Cantera.