Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
DissociationReactions.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 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 // Reaktoro includes
21 #include <Reaktoro/Common/Types.hpp>
22 #include <Reaktoro/Core/ChemicalFormula.hpp>
23 
24 namespace Reaktoro {
25 
28 {
31 
33  std::vector<std::pair<double, ChemicalFormula>> ions;
34 };
35 
38 {
39 public:
42 
45 
47  static auto instance() -> DissociationReactions&;
48 
50  static auto reactions() -> const Deque<DissociationReaction>&;
51 
53  static auto reset() -> void;
54 
56  static auto append(DissociationReaction reaction) -> void;
57 
59  static auto size() -> std::size_t;
60 
62  static auto get(const ChemicalFormula& complex) -> std::optional<DissociationReaction>;
63 
65  static auto coefficient(const ChemicalFormula& complex, const ChemicalFormula& ion) -> double;
66 
68  auto begin() const;
69 
71  auto begin();
72 
74  auto end() const;
75 
77  auto end();
78 
79 private:
81  Deque<DissociationReaction> m_reactions;
82 
83 private:
86 
89 };
90 
91 } // namespace Reaktoro
A type used to represent the chemical formula of a chemical species.
Definition: ChemicalFormula.hpp:27
A type used store a collection of dissociation reactions.
Definition: DissociationReactions.hpp:38
auto operator=(const DissociationReactions &) -> DissociationReactions &=delete
Assign a DissociationReactions object to this [deleted].
static auto instance() -> DissociationReactions &
Return the single DissociationReactions object.
static auto coefficient(const ChemicalFormula &complex, const ChemicalFormula &ion) -> double
Return the stoichiometric coefficient of an ion in a complex substance.
static auto reset() -> void
Reset the DissociationReactions object to its default state.
auto end()
Return end iterator of this DissociationReactions instance.
static auto size() -> std::size_t
Return the number of dissociation reactions in the database.
static auto reactions() -> const Deque< DissociationReaction > &
Return the dissociation reactions in the database.
static auto get(const ChemicalFormula &complex) -> std::optional< DissociationReaction >
Return the dissociation reaction of the substance with given chemical formula.
static auto append(DissociationReaction reaction) -> void
Append a dissociation reaction in to the database.
DissociationReactions(const DissociationReactions &)=delete
Construct a copy of a DissociationReactions object [deleted].
auto begin() const
Return begin const iterator of this DissociationReactions instance.
auto begin()
Return begin iterator of this DissociationReactions instance.
auto end() const
Return end const iterator of this DissociationReactions instance.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::deque< T > Deque
Convenient alias for std::deque<T>.
Definition: Types.hpp:70
A type used to represent a dissociation reaction of a neutral substance into ions.
Definition: DissociationReactions.hpp:28
std::vector< std::pair< double, ChemicalFormula > > ions
The dissociated ions and their stoichiometric coefficients.
Definition: DissociationReactions.hpp:33
ChemicalFormula complex
The chemical formula of the complex substance that dissociates into ions.
Definition: DissociationReactions.hpp:30