swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: 85b254592b1664a3e2a45764631d77086f865eee authored by Lars Bilke on 23 August 2021, 13:03:41 UTC
[ci] Fix pre-commit jobs on fork pipelines.
Tip revision: 85b2545
CreateExchange.cpp
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#include "CreateExchange.h"

#include "BaseLib/ConfigTree.h"
#include "Exchange.h"
#include "MeshLib/Mesh.h"

namespace ChemistryLib
{
namespace PhreeqcIOData
{
std::vector<ExchangeSite> createExchange(
    std::optional<BaseLib::ConfigTree> const& config, MeshLib::Mesh& mesh)
{
    if (!config)
    {
        return {};
    }

    std::vector<ExchangeSite> exchangers;
    for (auto const& site_config :
         //! \ogs_file_param{prj__chemical_system__exchangers__exchange_site}
         config->getConfigSubtreeList("exchange_site"))
    {
        //! \ogs_file_param{prj__chemical_system__exchangers__exchange_site__ion_exchanging_species}
        auto name = site_config.getConfigParameter<std::string>(
            "ion_exchanging_species");

        auto const molality = MeshLib::getOrCreateMeshProperty<double>(
            mesh, name, MeshLib::MeshItemType::IntegrationPoint, 1);

        exchangers.emplace_back(std::move(name), molality);
    }

    return exchangers;
}
}  // namespace PhreeqcIOData
}  // namespace ChemistryLib
back to top