OGS
CreateChemicalSystem.cpp
Go to the documentation of this file.
1 
11 #include "CreateChemicalSystem.h"
12 
13 #include "BaseLib/ConfigTree.h"
14 #include "ChemicalSystem.h"
15 #include "CreateAqueousSolution.h"
17 #include "CreateExchange.h"
18 #include "CreateKineticReactant.h"
19 #include "EquilibriumReactant.h"
20 #include "Exchange.h"
21 #include "KineticReactant.h"
22 
23 namespace ChemistryLib
24 {
25 namespace PhreeqcIOData
26 {
27 std::unique_ptr<ChemicalSystem> createChemicalSystem(
28  BaseLib::ConfigTree const& config, MeshLib::Mesh& mesh)
29 {
30  // solution
31  auto aqueous_solution = createAqueousSolution(
33  config.getConfigSubtree("solution"), mesh);
34 
35  // kinetic reactants
36  auto kinetic_reactants = createKineticReactants(
38  config.getConfigSubtreeOptional("kinetic_reactants"), mesh);
39 
40  // equilibrium reactants
41  auto equilibrium_reactants = createEquilibriumReactants(
43  config.getConfigSubtreeOptional("equilibrium_reactants"), mesh);
44 
45  // exchangers
46  auto exchangers = createExchange(
48  config.getConfigSubtreeOptional("exchangers"), mesh);
49 
50  return std::make_unique<ChemicalSystem>(std::move(aqueous_solution),
51  std::move(kinetic_reactants),
52  std::move(equilibrium_reactants),
53  std::move(exchangers));
54 }
55 } // namespace PhreeqcIOData
56 } // namespace ChemistryLib
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
Definition: ConfigTree.cpp:155
ConfigTree getConfigSubtree(std::string const &root) const
Definition: ConfigTree.cpp:146
std::unique_ptr< AqueousSolution > createAqueousSolution(BaseLib::ConfigTree const &config, MeshLib::Mesh &mesh)
std::unique_ptr< ChemicalSystem > createChemicalSystem(BaseLib::ConfigTree const &config, MeshLib::Mesh &mesh)
std::vector< ExchangeSite > createExchange(std::optional< BaseLib::ConfigTree > const &config, MeshLib::Mesh &mesh)
std::vector< EquilibriumReactant > createEquilibriumReactants(std::optional< BaseLib::ConfigTree > const &config, MeshLib::Mesh &mesh)
std::vector< KineticReactant > createKineticReactants(std::optional< BaseLib::ConfigTree > const &config, MeshLib::Mesh &mesh)