OGS
CreateExchange.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "CreateExchange.h"
5
7#include "Exchange.h"
8#include "MeshLib/Mesh.h"
10
11namespace ChemistryLib
12{
13namespace PhreeqcIOData
14{
15std::vector<ExchangeSite> createExchange(
16 std::optional<BaseLib::ConfigTree> const& config, MeshLib::Mesh& mesh)
17{
18 if (!config)
19 {
20 return {};
21 }
22
23 std::vector<ExchangeSite> exchangers;
24 for (auto const& site_config :
26 config->getConfigSubtreeList("exchange_site"))
27 {
29 auto name = site_config.getConfigParameter<std::string>(
30 "ion_exchanging_species");
31
32 auto const molality = MeshLib::getOrCreateMeshProperty<double>(
34
35 exchangers.emplace_back(std::move(name), molality);
36 }
37
38 return exchangers;
39}
40} // namespace PhreeqcIOData
41} // namespace ChemistryLib
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)