Cantera  2.5.1
Species.h
Go to the documentation of this file.
1 //! @file Species.h Declaration for class Cantera::Species.
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 #ifndef CT_SPECIES_H
7 #define CT_SPECIES_H
8 
9 #include "cantera/base/ct_defs.h"
10 #include "cantera/base/AnyMap.h"
11 
12 namespace Cantera
13 {
14 
15 class SpeciesThermoInterpType;
16 class TransportData;
17 class XML_Node;
18 
19 //! Contains data about a single chemical species
20 /*!
21  * This class stores the data about a species which may be needed to add it to
22  * a ThermoPhase or Transport object.
23  */
24 class Species
25 {
26 public:
27  Species();
28 
29  //! Constructor
30  Species(const std::string& name, const compositionMap& comp,
31  double charge=0.0, double size=1.0);
32 
33  //! Species objects are not copyable or assignable
34  Species(const Species&) = delete;
35  Species& operator=(const Species& other) = delete;
36  ~Species();
37 
38  //! The name of the species
39  std::string name;
40 
41  //! The elemental composition of the species. Keys are element names; values
42  //! are the corresponding atomicities.
44 
45  //! The electrical charge on the species, in units of the elementary charge.
46  double charge;
47 
48  //! The effective size of the species. Currently used only for surface
49  //! species, where it represents the number of sites occupied.
50  double size;
51 
52  shared_ptr<TransportData> transport;
53 
54  //! Thermodynamic data for the species
55  shared_ptr<SpeciesThermoInterpType> thermo;
56 
57  //! Extra data used for specific models
58  //! @deprecated Superseded by #input. To be removed after Cantera 2.5.
60 
61  //! Input parameters used to define a species, e.g. from a YAML input file.
63 };
64 
65 //! Create a new Species object from a 'species' XML_Node.
66 //!
67 //! @deprecated The XML input format is deprecated and will be removed in
68 //! Cantera 3.0.
69 shared_ptr<Species> newSpecies(const XML_Node& species_node);
70 
71 //! Create a new Species object from an AnyMap specification
72 unique_ptr<Species> newSpecies(const AnyMap& node);
73 
74 //! Generate Species objects for all `<species>` nodes in an XML document.
75 //!
76 //! The `<species>` nodes are assumed to be children of the `<speciesData>` node
77 //! in an XML document with a `<ctml>` root node, as in the case of XML files
78 //! produced by conversion from CTI files.
79 //!
80 //! This function can be used in combination with get_XML_File and
81 //! get_XML_from_string to get Species objects from either a file or a string,
82 //! respectively, where the string or file is formatted as either CTI or XML.
83 //!
84 //! @deprecated The XML input format is deprecated and will be removed in
85 //! Cantera 3.0.
86 std::vector<shared_ptr<Species> > getSpecies(const XML_Node& node);
87 
88 //! Generate Species objects for each item (an AnyMap) in `items`.
89 std::vector<shared_ptr<Species>> getSpecies(const AnyValue& items);
90 
91 }
92 
93 #endif
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:360
A wrapper for a variable whose type is determined at runtime.
Definition: AnyMap.h:77
Contains data about a single chemical species.
Definition: Species.h:25
compositionMap composition
The elemental composition of the species.
Definition: Species.h:43
AnyMap extra
Extra data used for specific models.
Definition: Species.h:59
std::string name
The name of the species.
Definition: Species.h:39
double charge
The electrical charge on the species, in units of the elementary charge.
Definition: Species.h:46
double size
The effective size of the species.
Definition: Species.h:50
shared_ptr< SpeciesThermoInterpType > thermo
Thermodynamic data for the species.
Definition: Species.h:55
Species(const Species &)=delete
Species objects are not copyable or assignable.
AnyMap input
Input parameters used to define a species, e.g. from a YAML input file.
Definition: Species.h:62
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:104
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
std::map< std::string, double > compositionMap
Map connecting a string name with a double.
Definition: ct_defs.h:172
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:264
shared_ptr< Species > newSpecies(const XML_Node &species_node)
Create a new Species object from a 'species' XML_Node.
Definition: Species.cpp:36
std::vector< shared_ptr< Species > > getSpecies(const XML_Node &node)
Generate Species objects for all <species> nodes in an XML document.
Definition: Species.cpp:125