Reaktoro 
A unified framework for modeling chemically reactive systems
ChemicalEditor.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 <string>
22 #include <vector>
23 #include <memory>
24 
25 // Reaktoro includes
26 
27 namespace Reaktoro {
28 
29 // Forward declarations
30 class Database;
31 class AqueousPhase;
32 class GaseousPhase;
33 class MineralPhase;
34 class ChemicalSystem;
35 class ReactionSystem;
36 class MineralReaction;
37 
79 {
80 public:
85 
87  explicit ChemicalEditor(const Database& database);
88 
90  ChemicalEditor(const ChemicalEditor& other);
91 
93  virtual ~ChemicalEditor();
94 
96  auto operator=(const ChemicalEditor& other) -> ChemicalEditor&;
97 
101  auto setTemperatures(std::vector<double> values, std::string units) -> void;
102 
106  auto setPressures(std::vector<double> values, std::string units) -> void;
107 
114  auto addPhase(const AqueousPhase& phase) -> AqueousPhase&;
115 
122  auto addPhase(const GaseousPhase& phase) -> GaseousPhase&;
123 
129  auto addPhase(const MineralPhase& phase) -> MineralPhase&;
130 
134  auto addReaction(const MineralReaction& reaction) -> MineralReaction&;
135 
157  auto addAqueousPhase(std::vector<std::string> species) -> AqueousPhase&;
158 
160  auto addAqueousPhase(std::initializer_list<std::string> species) -> AqueousPhase&;
161 
197  auto addAqueousPhase(std::string compounds) -> AqueousPhase&;
198 
220  auto addGaseousPhase(std::vector<std::string> species) -> GaseousPhase&;
221 
223  auto addGaseousPhase(std::initializer_list<std::string> species) -> GaseousPhase&;
224 
258  auto addGaseousPhase(std::string compounds) -> GaseousPhase&;
259 
292  auto addMineralPhase(std::vector<std::string> species) -> MineralPhase&;
293 
295  auto addMineralPhase(std::initializer_list<std::string> species) -> MineralPhase&;
296 
329  auto addMineralPhase(std::string compounds) -> MineralPhase&;
330 
334  auto addMineralReaction(const MineralReaction& reaction) -> MineralReaction&;
335 
339  auto addMineralReaction(std::string mineral) -> MineralReaction&;
340 
342  auto aqueousPhase() const -> const AqueousPhase&;
343 
345  auto aqueousPhase() -> AqueousPhase&;
346 
348  auto gaseousPhase() const -> const GaseousPhase&;
349 
351  auto gaseousPhase() -> GaseousPhase&;
352 
354  auto mineralPhases() const -> const std::vector<MineralPhase>&;
355 
357  auto mineralPhases() -> std::vector<MineralPhase>&;
358 
360  auto createChemicalSystem() const -> ChemicalSystem;
361 
363  auto createReactionSystem() const -> ReactionSystem;
364 
366  operator ChemicalSystem() const;
367 
369  operator ReactionSystem() const;
370 
371 private:
372  struct Impl;
373 
374  std::unique_ptr<Impl> pimpl;
375 };
376 
377 } // namespace Reaktoro
auto addMineralReaction(const MineralReaction &reaction) -> MineralReaction &
Add a mineral reaction in the chemical editor.
Definition: ChemicalEditor.cpp:498
auto aqueousPhase() const -> const AqueousPhase &
Return the aqueous phase in the chemical editor.
Definition: ChemicalEditor.cpp:508
auto addReaction(const MineralReaction &reaction) -> MineralReaction &
Add a mineral reaction in the chemical editor.
Definition: ChemicalEditor.cpp:448
auto addMineralPhase(std::vector< std::string > species) -> MineralPhase &
Add a mineral phase in the chemical editor.
Definition: ChemicalEditor.cpp:483
auto setTemperatures(std::vector< double > values, std::string units) -> void
Set the temperatures for constructing interpolation tables of thermodynamic properties.
Definition: ChemicalEditor.cpp:423
Definition: MineralReaction.hpp:37
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:47
auto addPhase(const AqueousPhase &phase) -> AqueousPhase &
Add an aqueous phase in the chemical editor.
Definition: ChemicalEditor.cpp:433
auto mineralPhases() const -> const std::vector< MineralPhase > &
Return the mineral phases in the chemical editor.
Definition: ChemicalEditor.cpp:528
Provides operations to retrive physical and thermodynamic data of chemical species.
Definition: Database.hpp:63
auto gaseousPhase() const -> const GaseousPhase &
Return the gaseous phase in the chemical editor.
Definition: ChemicalEditor.cpp:518
Provides convenient operations to initialize ChemicalSystem and ReactionSystem instances.
Definition: ChemicalEditor.hpp:78
auto addAqueousPhase(std::vector< std::string > species) -> AqueousPhase &
Add an aqueous phase in the chemical editor.
Definition: ChemicalEditor.cpp:453
auto setPressures(std::vector< double > values, std::string units) -> void
Set the pressures for constructing interpolation tables of thermodynamic properties.
Definition: ChemicalEditor.cpp:428
virtual ~ChemicalEditor()
Destroy the ChemicalEditor instance.
Definition: ChemicalEditor.cpp:414
A class that represents a system of chemical reactions.
Definition: ReactionSystem.hpp:41
Class that defines a gaseous phase.
Definition: GaseousPhase.hpp:32
auto addGaseousPhase(std::vector< std::string > species) -> GaseousPhase &
Add a gaseous phase in the chemical editor.
Definition: ChemicalEditor.cpp:468
Definition: Units.cpp:38
auto database(std::string name) -> std::string
Return the contents of a built-in database as a string.
Definition: DatabaseUtils.cpp:65
auto createChemicalSystem() const -> ChemicalSystem
Create a ChemicalSystem instance with the current state of the chemical editor.
Definition: ChemicalEditor.cpp:538
auto createReactionSystem() const -> ReactionSystem
Create a ReactionSystem instance with the current state of the chemical editor.
Definition: ChemicalEditor.cpp:543
A type used to describe an aqueous phase.
Definition: AqueousPhase.hpp:35
auto operator=(const ChemicalEditor &other) -> ChemicalEditor &
Assign this ChemicalEditor instance with another.
Definition: ChemicalEditor.cpp:417
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
ChemicalEditor()
Construct a default ChemicalEditor instance.
Definition: ChemicalEditor.cpp:402
Class that defines an mineral phase.
Definition: MineralPhase.hpp:33