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-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 <string>
23 #include <vector>
24 
25 namespace Reaktoro {
26 
27 // Forward declarations
28 class Element;
29 class AqueousSpecies;
30 class GaseousSpecies;
31 class MineralSpecies;
32 
63 class Database
64 {
65 public:
67  Database();
68 
75  explicit Database(std::string filename);
76 
78  auto addElement(const Element& element) -> void;
79 
81  auto addAqueousSpecies(const AqueousSpecies& species) -> void;
82 
84  auto addGaseousSpecies(const GaseousSpecies& species) -> void;
85 
87  auto addMineralSpecies(const MineralSpecies& species) -> void;
88 
90  auto elements() -> std::vector<Element>;
91 
93  auto aqueousSpecies() -> std::vector<AqueousSpecies>;
94 
98  auto aqueousSpecies(std::string name) const -> const AqueousSpecies&;
99 
101  auto gaseousSpecies() -> std::vector<GaseousSpecies>;
102 
106  auto gaseousSpecies(std::string name) const -> const GaseousSpecies&;
107 
109  auto mineralSpecies() -> std::vector<MineralSpecies>;
110 
114  auto mineralSpecies(std::string name) const -> const MineralSpecies&;
115 
118  auto containsAqueousSpecies(std::string species) const -> bool;
119 
122  auto containsGaseousSpecies(std::string species) const -> bool;
123 
126  auto containsMineralSpecies(std::string species) const -> bool;
127 
129  auto aqueousSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<AqueousSpecies>;
130 
132  auto gaseousSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<GaseousSpecies>;
133 
135  auto mineralSpeciesWithElements(const std::vector<std::string>& elements) const -> std::vector<MineralSpecies>;
136 
137 private:
138  struct Impl;
139 
140  std::shared_ptr<Impl> pimpl;
141 };
142 
143 } // namespace Reaktoro
auto addElement(const Element &element) -> void
Add an Element instance in the database.
Definition: Database.cpp:715
Database()
Construct a default Database instance.
Definition: Database.cpp:707
auto addAqueousSpecies(const AqueousSpecies &species) -> void
Add an AqueousSpecies instance in the database.
Definition: Database.cpp:720
auto containsAqueousSpecies(std::string species) const -> bool
Check if the database contains a given aqueous species.
Definition: Database.cpp:770
auto addMineralSpecies(const MineralSpecies &species) -> void
Add a MineralSpecies instance in the database.
Definition: Database.cpp:730
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
auto containsGaseousSpecies(std::string species) const -> bool
Check if the database contains a given gaseous species.
Definition: Database.cpp:775
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:795
auto mineralSpecies() -> std::vector< MineralSpecies >
Return all mineral species in the database.
Definition: Database.cpp:760
auto gaseousSpecies() -> std::vector< GaseousSpecies >
Return all gaseous species in the database.
Definition: Database.cpp:750
auto containsMineralSpecies(std::string species) const -> bool
Check if the database contains a given mineral species.
Definition: Database.cpp:780
auto aqueousSpecies() -> std::vector< AqueousSpecies >
Return all aqueous species in the database.
Definition: Database.cpp:740
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:790
auto elements() -> std::vector< Element >
Return all elements in the database.
Definition: Database.cpp:735
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
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:785
A type used to define a chemical element and its attributes.
Definition: Element.hpp:27
auto addGaseousSpecies(const GaseousSpecies &species) -> void
Add a GaseousSpecies instance in the database.
Definition: Database.cpp:725
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