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-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 <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
Eigen::MatrixXd Matrix
Define an alias to the matrix type of the Eigen library.
Definition: Matrix.hpp:387
std::vector< Index > Indices
Define a type that represents a collection of indices.
Definition: Index.hpp:29
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:47
auto equations() const -> std::vector< ReactionEquation >
Return the equations of the equilibrium reactions.
Definition: EquilibriumReactions.cpp:311
auto stoichiometricMatrix() const -> Matrix
Return the stoichiometric matrix of the reactions.
Definition: EquilibriumReactions.cpp:316
auto lu() const -> const LU &
Return the LU decomposition of the formula matrix A.
Definition: EquilibriumReactions.cpp:321
virtual ~EquilibriumReactions()
Destroy this EquilibriumReactions instance.
Definition: EquilibriumReactions.cpp:270
The class that computes the full pivoting Auxiliary struct for storing the LU decomposition of a matr...
Definition: LU.hpp:27
auto operator=(EquilibriumReactions other) -> EquilibriumReactions &
Assign other EquilibriumReactions instance to this.
Definition: EquilibriumReactions.cpp:274
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:55
EquilibriumReactions(const ChemicalSystem &system)
Construct an EquilibriumReactions instance.
Definition: EquilibriumReactions.cpp:254
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:38
auto indicesSecondarySpecies() const -> Indices
Return the indices of the secondary species.
Definition: EquilibriumReactions.cpp:306
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto partition() const -> const Partition &
Return the partition of the chemical system for which the equilibrium reactions were defined...
Definition: EquilibriumReactions.cpp:285
auto setMasterSpecies(Indices ispecies) -> void
Set the master species manually.
Definition: EquilibriumReactions.cpp:291
auto system() const -> const ChemicalSystem &
Return the chemical system for which the equilibrium reactions were defined.
Definition: EquilibriumReactions.cpp:280