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-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 <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 GaseousSpecies;
35 class MineralSpecies;
36 
38 {
39 public:
42 
45  explicit PhreeqcDatabase(std::string filename);
46 
49  auto load(std::string filename) -> void;
50 
51  auto numElements() const -> unsigned;
52 
53  auto numAqueousSpecies() const -> unsigned;
54 
55  auto numGaseousSpecies() const -> unsigned;
56 
57  auto numMineralSpecies() const -> unsigned;
58 
59  auto numMasterSpecies() const -> unsigned;
60 
61  auto numProductSpecies() const -> unsigned;
62 
63  auto element(Index index) const -> Element;
64 
65  auto elements() const -> const std::vector<Element>&;
66 
67  auto aqueousSpecies(Index index) const -> AqueousSpecies;
68 
69  auto aqueousSpecies(std::string name) const -> AqueousSpecies;
70 
71  auto aqueousSpecies() const -> const std::vector<AqueousSpecies>&;
72 
73  auto gaseousSpecies(Index index) const -> GaseousSpecies;
74 
75  auto gaseousSpecies(std::string name) const -> GaseousSpecies;
76 
77  auto gaseousSpecies() const -> const std::vector<GaseousSpecies>&;
78 
79  auto mineralSpecies(Index index) const -> MineralSpecies;
80 
81  auto mineralSpecies(std::string name) const -> MineralSpecies;
82 
83  auto containsAqueousSpecies(std::string name) const -> bool;
84 
85  auto containsGaseousSpecies(std::string name) const -> bool;
86 
87  auto containsMineralSpecies(std::string name) const -> bool;
88 
89  auto mineralSpecies() const -> const std::vector<MineralSpecies>&;
90 
91  auto masterSpecies() const -> std::set<std::string>;
92 
94  auto cross(const Database& master) -> Database;
95 
96 private:
97  struct Impl;
98 
99  std::shared_ptr<Impl> pimpl;
100 };
101 
102 } // namespace Reaktoro
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 represent an aqueous species.
Definition: AqueousSpecies.hpp:31
Provides operations to retrive physical and thermodynamic data of chemical species.
Definition: Database.hpp:63
PhreeqcDatabase()
Construct a default PhreeqcDatabase instance.
Definition: PhreeqcDatabase.cpp:314
Definition: PhreeqcDatabase.hpp:37
auto load(std::string filename) -> void
Load a Phreeqc database.
Definition: PhreeqcDatabase.cpp:324
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
A type used to define a chemical element and its attributes.
Definition: Element.hpp:27
auto cross(const Database &master) -> Database
Cross this PhreeqcDatabase instance with master thermodynamic data in another Database instance...
Definition: PhreeqcDatabase.cpp:436
A type to describe the attributes of a mineral species.
Definition: MineralSpecies.hpp:27
A type to describe the attributes of a gaseous species.
Definition: GaseousSpecies.hpp:30