Reaktoro
A unified framework for modeling chemically reactive systems
EquilibriumReactions.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 <memory>
22 #include <string>
23 #include <vector>
24 
25 // Reaktoro includes
26 #include <Reaktoro/Common/Index.hpp>
27 #include <Reaktoro/Math/Matrix.hpp>
28 #include <Reaktoro/Math/LU.hpp>
29 
30 namespace Reaktoro {
31 
32 // Forward declarations
33 class ChemicalSystem;
34 class Partition;
35 class ReactionEquation;
36 
39 {
40 public:
43 
46 
49 
51  virtual ~EquilibriumReactions();
52 
55 
57  auto system() const -> const ChemicalSystem&;
58 
60  auto partition() const -> const Partition&;
61 
64  auto setMasterSpecies(Indices ispecies) -> void;
65 
68  auto setMasterSpecies(std::vector<std::string> species) -> void;
69 
72  auto indicesMasterSpecies() const -> Indices;
73 
76  auto indicesSecondarySpecies() const -> Indices;
77 
79  auto equations() const -> std::vector<ReactionEquation>;
80 
82  auto stoichiometricMatrix() const -> Matrix;
83 
85  auto lu() const -> const LU&;
86 
87 private:
88  struct Impl;
89 
90  std::unique_ptr<Impl> pimpl;
91 };
92 
93 } // namespace Reaktoro
virtual ~EquilibriumReactions()
Destroy this EquilibriumReactions instance.
Definition: EquilibriumReactions.cpp:270
auto stoichiometricMatrix() const -> Matrix
Return the stoichiometric matrix of the reactions.
Definition: EquilibriumReactions.cpp:316
EquilibriumReactions(const ChemicalSystem &system)
Construct an EquilibriumReactions instance.
Definition: EquilibriumReactions.cpp:254
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:38
auto setMasterSpecies(Indices ispecies) -> void
Set the master species manually.
Definition: EquilibriumReactions.cpp:291
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto system() const -> const ChemicalSystem &
Return the chemical system for which the equilibrium reactions were defined.
Definition: EquilibriumReactions.cpp:280
The class that computes the full pivoting Auxiliary struct for storing the LU decomposition of a matr...
Definition: LU.hpp:28
auto partition() const -> const Partition &
Return the partition of the chemical system for which the equilibrium reactions were defined.
Definition: EquilibriumReactions.cpp:285
auto operator=(EquilibriumReactions other) -> EquilibriumReactions &
Assign other EquilibriumReactions instance to this.
Definition: EquilibriumReactions.cpp:274
auto indicesMasterSpecies() const -> Indices
Return the indices of the master species.
Definition: EquilibriumReactions.cpp:301
A class that generates a system of equilibrium reactions written in terms of master and secondary spe...
Definition: EquilibriumReactions.hpp:39
std::vector< Index > Indices
Define a type that represents a collection of indices.
Definition: Index.hpp:29
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:56
Eigen::MatrixXd Matrix
Alias to Eigen type MatrixXd.
Definition: Matrix.hpp:42
auto indicesSecondarySpecies() const -> Indices
Return the indices of the secondary species.
Definition: EquilibriumReactions.cpp:306
auto equations() const -> std::vector< ReactionEquation >
Return the equations of the equilibrium reactions.
Definition: EquilibriumReactions.cpp:311
auto lu() const -> const LU &
Return the LU decomposition of the formula matrix A.
Definition: EquilibriumReactions.cpp:321