Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
Core.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/AggregateState.hpp>
23 #include <Reaktoro/Core/Data.hpp>
24 #include <Reaktoro/Core/ElementList.hpp>
25 #include <Reaktoro/Core/SpeciesList.hpp>
26 
27 namespace Reaktoro {
28 
29 // Forward declarations
30 class ChemicalFormula;
31 class ChemicalSystem;
32 class Database;
33 class Element;
34 class ElementalComposition;
35 class FormationReaction;
36 class Phase;
37 class Species;
38 template<typename Signature> class Model;
39 
40 REAKTORO_DATA_ENCODE_DECLARE(AggregateState);
41 REAKTORO_DATA_DECODE_DECLARE(AggregateState);
42 
43 REAKTORO_DATA_ENCODE_DECLARE(ChemicalFormula);
44 REAKTORO_DATA_DECODE_DECLARE(ChemicalFormula);
45 
46 REAKTORO_DATA_ENCODE_DECLARE(ChemicalSystem);
47 REAKTORO_DATA_DECODE_DECLARE(ChemicalSystem);
48 
49 REAKTORO_DATA_ENCODE_DECLARE(Database);
50 REAKTORO_DATA_DECODE_DECLARE(Database);
51 
52 REAKTORO_DATA_ENCODE_DECLARE(Element);
53 REAKTORO_DATA_DECODE_DECLARE(Element);
54 
55 REAKTORO_DATA_ENCODE_DECLARE(ElementList);
56 REAKTORO_DATA_DECODE_DECLARE(ElementList);
57 
58 REAKTORO_DATA_ENCODE_DECLARE(ElementalComposition);
59 REAKTORO_DATA_DECODE_DECLARE(ElementalComposition);
60 
61 REAKTORO_DATA_ENCODE_DECLARE(FormationReaction);
62 REAKTORO_DATA_DECODE_DECLARE(FormationReaction);
63 
64 REAKTORO_DATA_ENCODE_DECLARE(Phase);
65 REAKTORO_DATA_DECODE_DECLARE(Phase);
66 
67 REAKTORO_DATA_ENCODE_DECLARE(ReactionStandardThermoModel);
68 REAKTORO_DATA_DECODE_DECLARE(ReactionStandardThermoModel);
69 
70 REAKTORO_DATA_ENCODE_DECLARE(Species);
71 REAKTORO_DATA_DECODE_DECLARE(Species);
72 
73 REAKTORO_DATA_ENCODE_DECLARE(SpeciesList);
74 REAKTORO_DATA_DECODE_DECLARE(SpeciesList);
75 
76 REAKTORO_DATA_ENCODE_DECLARE(StandardThermoModel);
77 REAKTORO_DATA_DECODE_DECLARE(StandardThermoModel);
78 
79 //--------------------------------------------------------------------------------
80 // ATTENTION!
81 //--------------------------------------------------------------------------------
82 // Linking error if using g++ 12.1 if these encode/decode definitions for
83 // AggregateState are implemented in cpp file and not here in this header file!
84 //--------------------------------------------------------------------------------
85 
86 inline REAKTORO_DATA_ENCODE_DEFINE(AggregateState)
87 {
88  std::stringstream ss;
89  ss << obj;
90  data = ss.str();
91 }
92 
93 inline REAKTORO_DATA_DECODE_DEFINE(AggregateState)
94 {
95  obj = parseAggregateState(data.asString());
96 }
97 
98 } // namespace Reaktoro
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
AggregateState
The aggregate states of substances according to IUPAC.
Definition: AggregateState.hpp:32
Model< StandardThermoProps(real T, real P)> StandardThermoModel
The function type for calculation of standard thermodynamic properties of a species.
Definition: StandardThermoModel.hpp:30
Model< ReactionStandardThermoProps(ReactionStandardThermoModelArgs)> ReactionStandardThermoModel
The function type for calculation of standard thermodynamic properties of a reaction.
Definition: ReactionStandardThermoModel.hpp:40
auto parseAggregateState(const std::string &symbol) -> AggregateState
Return the AggregateState value from given aggregate state symbol.