Reaktoro
A unified framework for modeling chemically reactive systems
PhreeqcDatabase.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 <set>
23 #include <string>
24 
25 // Reaktoro includes
26 #include <Reaktoro/Common/Index.hpp>
27 
28 namespace Reaktoro {
29 
30 // Forward declarations
31 class Database;
32 class Element;
33 class AqueousSpecies;
34 class FluidSpecies;
35 using GaseousSpecies = FluidSpecies;
36 class MineralSpecies;
37 
39 {
40 public:
43 
46  explicit PhreeqcDatabase(std::string filename);
47 
50  auto load(std::string filename) -> void;
51 
52  auto numElements() const -> unsigned;
53 
54  auto numAqueousSpecies() const -> unsigned;
55 
56  auto numGaseousSpecies() const -> unsigned;
57 
58  auto numMineralSpecies() const -> unsigned;
59 
60  auto numMasterSpecies() const -> unsigned;
61 
62  auto numProductSpecies() const -> unsigned;
63 
64  auto element(Index index) const -> Element;
65 
66  auto elements() const -> const std::vector<Element>&;
67 
68  auto aqueousSpecies(Index index) const -> AqueousSpecies;
69 
70  auto aqueousSpecies(std::string name) const -> AqueousSpecies;
71 
72  auto aqueousSpecies() const -> const std::vector<AqueousSpecies>&;
73 
74  auto gaseousSpecies(Index index) const -> GaseousSpecies;
75 
76  auto gaseousSpecies(std::string name) const -> GaseousSpecies;
77 
78  auto gaseousSpecies() const -> const std::vector<GaseousSpecies>&;
79 
80  auto mineralSpecies(Index index) const -> MineralSpecies;
81 
82  auto mineralSpecies(std::string name) const -> MineralSpecies;
83 
84  auto containsAqueousSpecies(std::string name) const -> bool;
85 
86  auto containsGaseousSpecies(std::string name) const -> bool;
87 
88  auto containsMineralSpecies(std::string name) const -> bool;
89 
90  auto mineralSpecies() const -> const std::vector<MineralSpecies>&;
91 
92  auto masterSpecies() const -> std::set<std::string>;
93 
95  auto cross(const Database& master) -> Database;
96 
97 private:
98  struct Impl;
99 
100  std::shared_ptr<Impl> pimpl;
101 };
102 
103 } // namespace Reaktoro
Provides operations to retrieve physical and thermodynamic data of chemical species.
Definition: Database.hpp:78
auto index(const T &value, const std::vector< T > &values) -> Index
Find the index of a value in a container of values.
Definition: SetUtils.hxx:21
A type to describe the attributes of a mineral species.
Definition: MineralSpecies.hpp:28
Definition: PhreeqcDatabase.hpp:39
auto load(std::string filename) -> void
Load a Phreeqc database.
Definition: PhreeqcDatabase.cpp:324
A type to represent an aqueous species.
Definition: AqueousSpecies.hpp:32
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto cross(const Database &master) -> Database
Cross this PhreeqcDatabase instance with master thermodynamic data in another Database instance.
Definition: PhreeqcDatabase.cpp:436
A type used to define a chemical element and its attributes.
Definition: Element.hpp:28
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
PhreeqcDatabase()
Construct a default PhreeqcDatabase instance.
Definition: PhreeqcDatabase.cpp:314
A type to describe the attributes of a fluids (gaseous or liquid) species.
Definition: FluidSpecies.hpp:31