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-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. 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
auto molarMass() const -> double
Return the molar mass of the species (in units of kg/mol).
Definition: Species.cpp:112
auto setName(std::string name) -> void
Set the name of the species.
Definition: Species.cpp:75
auto formula() const -> std::string
Return the formula of the species.
Definition: Species.cpp:102
auto setElements(const std::map< Element, double > &elements) -> void
Set the elements of the species.
Definition: Species.cpp:85
auto charge() const -> double
Return the electrical charge of the species.
Definition: Species.cpp:117
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto numElements() const -> unsigned
Return the number of elements of the species.
Definition: Species.cpp:92
auto name() const -> std::string
Return the name of the species.
Definition: Species.cpp:97
auto elementCoefficient(std::string element) const -> double
Return the stoichiometry of an element in the species.
Definition: Species.cpp:122
auto setFormula(std::string formula) -> void
Set the formula of the species.
Definition: Species.cpp:80
auto elements() const -> const std::map< Element, double > &
Return the elements that compose the species and their coefficients.
Definition: Species.cpp:107
Species()
Construct a default Species instance.
Definition: Species.cpp:71
A type used to describe a species and its attributes.
Definition: Species.hpp:42