Reaktoro 
A unified framework for modeling chemically reactive systems
Species.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <map>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 // Reaktoro includes
27 #include <Reaktoro/Math/Matrix.hpp>
28 #include <Reaktoro/Common/ThermoScalar.hpp>
29 
30 namespace Reaktoro {
31 
32 // Forward declarations
33 class Element;
34 
41 class Species
42 {
43 public:
45  Species();
46 
48  auto setName(std::string name) -> void;
49 
51  auto setFormula(std::string formula) -> void;
52 
54  auto setElements(const std::map<Element, double>& elements) -> void;
55 
57  auto numElements() const -> unsigned;
58 
60  auto name() const -> std::string;
61 
63  auto formula() const -> std::string;
64 
66  auto elements() const -> const std::map<Element, double>&;
67 
69  auto molarMass() const -> double;
70 
72  auto charge() const -> double;
73 
75  auto elementCoefficient(std::string element) const -> double;
76 
77 private:
78  struct Impl;
79 
80  std::shared_ptr<Impl> pimpl;
81 };
82 
84 auto operator<(const Species& lhs, const Species& rhs) -> bool;
85 
87 auto operator==(const Species& lhs, const Species& rhs) -> bool;
88 
89 } // namespace Reaktoro
A type used to describe a species and its attributes.
Definition: Species.hpp:41
auto charge() const -> double
Return the electrical charge of the species.
Definition: Species.cpp:117
auto name() const -> std::string
Return the name of the species.
Definition: Species.cpp:97
auto setElements(const std::map< Element, double > &elements) -> void
Set the elements of the species.
Definition: Species.cpp:85
auto setName(std::string name) -> void
Set the name of the species.
Definition: Species.cpp:75
Species()
Construct a default Species instance.
Definition: Species.cpp:71
auto molarMass() const -> double
Return the molar mass of the species (in units of kg/mol).
Definition: Species.cpp:112
auto elementCoefficient(std::string element) const -> double
Return the stoichiometry of an element in the species.
Definition: Species.cpp:122
auto elements() const -> const std::map< Element, double > &
Return the elements that compose the species and their coefficients.
Definition: Species.cpp:107
auto numElements() const -> unsigned
Return the number of elements of the species.
Definition: Species.cpp:92
auto setFormula(std::string formula) -> void
Set the formula of the species.
Definition: Species.cpp:80
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto formula() const -> std::string
Return the formula of the species.
Definition: Species.cpp:102