Cantera  3.1.0
Loading...
Searching...
No Matches
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 https://cantera.org/license.txt for license and copyright information.
5
6#include "cantera/tpx/utils.h"
9
10#include "CarbonDioxide.h"
11#include "Heptane.h"
12#include "HFC134a.h"
13#include "Hydrogen.h"
14#include "Methane.h"
15#include "Nitrogen.h"
16#include "Oxygen.h"
17#include "Water.h"
18
19namespace tpx
20{
21Substance* newSubstance(const std::string& name)
22{
23 std::string lcname = Cantera::toLowerCopy(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 == "hfc-134a" || lcname == "hfc134a") {
35 return new HFC134a;
36 } else if (lcname == "carbon-dioxide" || lcname == "carbondioxide") {
37 return new CarbonDioxide;
38 } else if (lcname == "heptane") {
39 return new Heptane;
40 } else {
41 throw Cantera::CanteraError("tpx::newSubstance", "No Substance"
42 " definition known for '{}'.", name);
43 }
44}
45
46}
Base class for exceptions thrown by Cantera classes.
Pure species representation of carbon dioxide.
Equation of state for HFC-134a.
Definition HFC134a.h:18
Pure species representation of heptane.
Definition Heptane.h:16
Base class from which all pure substances are derived.
Definition Sub.h:37
Pure species representation of hydrogen.
Definition Hydrogen.h:17
Pure species representation of methane.
Definition Methane.h:17
Pure species representation of nitrogen.
Definition Nitrogen.h:17
Pure species representation of oxygen.
Definition Oxygen.h:16
Pure species representation of water.
Definition Water.h:16
This file contains definitions for utility functions and text for modules, inputfiles and logging,...
string toLowerCopy(const string &input)
Convert to lower case.
Contains declarations for string manipulation functions within Cantera.
Substance * newSubstance(const std::string &name)
Create a new Substance object corresponding to the specified name.
Definition utils.cpp:21