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