Reaktoro
A unified framework for modeling chemically reactive systems
Database.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 
26 // Forward declarations for ThermoFun
27 namespace ThermoFun {
28 
29 class Database;
30 
31 } // namespace ThermoFun
32 
33 namespace Reaktoro {
34 
35 // Forward declarations
36 class Element;
37 class AqueousSpecies;
38 class FluidSpecies;
39 using GaseousSpecies = FluidSpecies;
40 using LiquidSpecies = FluidSpecies;
41 class MineralSpecies;
42 
43 
77 class Database
78 {
79 public:
81  Database();
82 
89  explicit Database(std::string filename);
90 
92  explicit Database(const ThermoFun::Database& fundatabase);
93 
95  auto addElement(const Element& element) -> void;
96 
98  auto addAqueousSpecies(const AqueousSpecies& species) -> void;
99 
101  auto addGaseousSpecies(const GaseousSpecies& species) -> void;
102 
104  auto addLiquidSpecies(const LiquidSpecies& species) -> void;
105 
107  auto addMineralSpecies(const MineralSpecies& species) -> void;
108 
110  auto elements() const -> std::vector<Element>;
111 
113  auto aqueousSpecies() -> std::vector<AqueousSpecies>;
114 
118  auto aqueousSpecies(std::string name) const -> const AqueousSpecies&;
119 
121  auto gaseousSpecies() -> std::vector<GaseousSpecies>;
122 
126  auto gaseousSpecies(std::string name) const -> const GaseousSpecies&;
127 
129  auto liquidSpecies() -> std::vector<LiquidSpecies>;
130 
134  auto liquidSpecies(std::string name) const -> const LiquidSpecies&;
135 
137  auto mineralSpecies() -> std::vector<MineralSpecies>;
138 
142  auto mineralSpecies(std::string name) const -> const MineralSpecies&;
143 
146  auto containsAqueousSpecies(std::string species) const -> bool;
147 
150  auto containsGaseousSpecies(std::string species) const -> bool;
151 
154  auto containsLiquidSpecies(std::string species) const -> bool;
155 
158  auto containsMineralSpecies(std::string species) const -> bool;
159 
161  auto aqueousSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<AqueousSpecies>;
162 
164  auto gaseousSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<GaseousSpecies>;
165 
167  auto liquidSpeciesWithElements(const std::vector<std::string>& elements) const->std::vector<LiquidSpecies>;
168 
170  auto mineralSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<MineralSpecies>;
171 
172 private:
173  struct Impl;
174 
175  std::shared_ptr<Impl> pimpl;
176 };
177 
178 } // namespace Reaktoro
auto containsLiquidSpecies(std::string species) const -> bool
Check if the database contains a given liquid species.
Definition: Database.cpp:995
Provides operations to retrieve physical and thermodynamic data of chemical species.
Definition: Database.hpp:78
auto mineralSpecies() -> std::vector< MineralSpecies >
Return all mineral species in the database.
Definition: Database.cpp:975
auto containsMineralSpecies(std::string species) const -> bool
Check if the database contains a given mineral species.
Definition: Database.cpp:1000
A type to describe the attributes of a mineral species.
Definition: MineralSpecies.hpp:28
A type to represent an aqueous species.
Definition: AqueousSpecies.hpp:32
auto containsGaseousSpecies(std::string species) const -> bool
Check if the database contains a given gaseous species.
Definition: Database.cpp:990
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
Database()
Construct a default Database instance.
Definition: Database.cpp:903
auto addAqueousSpecies(const AqueousSpecies &species) -> void
Add an AqueousSpecies instance in the database.
Definition: Database.cpp:920
auto addMineralSpecies(const MineralSpecies &species) -> void
Add a MineralSpecies instance in the database.
Definition: Database.cpp:935
auto addLiquidSpecies(const LiquidSpecies &species) -> void
Add a LiquidSpecies instance in the database.
Definition: Database.cpp:930
auto addElement(const Element &element) -> void
Add an Element instance in the database.
Definition: Database.cpp:915
auto aqueousSpeciesWithElements(const std::vector< std::string > &elements) const -> std::vector< AqueousSpecies >
Return the aqueous species that contains at least one of the specified elements.
Definition: Database.cpp:1005
auto addGaseousSpecies(const GaseousSpecies &species) -> void
Add a GaseousSpecies instance in the database.
Definition: Database.cpp:925
A type used to define a chemical element and its attributes.
Definition: Element.hpp:28
auto gaseousSpeciesWithElements(const std::vector< std::string > &elements) const -> std::vector< GaseousSpecies >
Return the gaseous species that contains at least one of the specified elements.
Definition: Database.cpp:1010
auto gaseousSpecies() -> std::vector< GaseousSpecies >
Return all gaseous species in the database.
Definition: Database.cpp:955
auto containsAqueousSpecies(std::string species) const -> bool
Check if the database contains a given aqueous species.
Definition: Database.cpp:985
auto liquidSpecies() -> std::vector< LiquidSpecies >
Return all liquid species in the database.
Definition: Database.cpp:965
auto liquidSpeciesWithElements(const std::vector< std::string > &elements) const -> std::vector< LiquidSpecies >
Return the liquid species that contains at least one of the specified elements.
Definition: Database.cpp:1015
auto elements() const -> std::vector< Element >
Return all elements in the database.
Definition: Database.cpp:940
A type to describe the attributes of a fluids (gaseous or liquid) species.
Definition: FluidSpecies.hpp:31
auto aqueousSpecies() -> std::vector< AqueousSpecies >
Return all aqueous species in the database.
Definition: Database.cpp:945
auto mineralSpeciesWithElements(const std::vector< std::string > &elements) const -> std::vector< MineralSpecies >
Return the mineral species that contains at least one of the specified elements.
Definition: Database.cpp:1020