OGS
CreateExchange.cpp
Go to the documentation of this file.
1
11#include "CreateExchange.h"
12
13#include "BaseLib/ConfigTree.h"
14#include "Exchange.h"
15#include "MeshLib/Mesh.h"
17
18namespace ChemistryLib
19{
20namespace PhreeqcIOData
21{
22std::vector<ExchangeSite> createExchange(
23 std::optional<BaseLib::ConfigTree> const& config, MeshLib::Mesh& mesh)
24{
25 if (!config)
26 {
27 return {};
28 }
29
30 std::vector<ExchangeSite> exchangers;
31 for (auto const& site_config :
33 config->getConfigSubtreeList("exchange_site"))
34 {
36 auto name = site_config.getConfigParameter<std::string>(
37 "ion_exchanging_species");
38
39 auto const molality = MeshLib::getOrCreateMeshProperty<double>(
41
42 exchangers.emplace_back(std::move(name), molality);
43 }
44
45 return exchangers;
46}
47} // namespace PhreeqcIOData
48} // namespace ChemistryLib
Definition of the Mesh class.
std::vector< ExchangeSite > createExchange(std::optional< BaseLib::ConfigTree > const &config, MeshLib::Mesh &mesh)
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)