swh:1:snp:6088ab52ef49920e01e3f334cdf4d5d6c8a822b9
Raw File
Tip revision: 7b40136be0bc230d25fb5edeb4825a28cf4befca authored by Dmitri Naumov on 18 February 2021, 12:19:27 UTC
Cppcheck uses C++20 standard now.
Tip revision: 7b40136
CreateSolutionComponent.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 "CreateSolutionComponent.h"
#include "AqueousSolution.h"
#include "BaseLib/ConfigTree.h"

namespace ChemistryLib
{
namespace PhreeqcIOData
{
std::vector<Component> createSolutionComponents(
    BaseLib::ConfigTree const& config)
{
    std::vector<Component> components;
    //! \ogs_file_param{prj__chemical_system__solution__components}
    auto components_config = config.getConfigSubtree("components");

    for (
        auto const& component_config :
        //! \ogs_file_param{prj__chemical_system__solution__components__component}
        components_config.getConfigSubtreeList("component"))
    {
        auto const component_name = component_config.getValue<std::string>();
        auto const chemical_formula =
            //! \ogs_file_attr{prj__chemical_system__solution__components__component__chemical_formula}
            component_config.getConfigAttribute<std::string>("chemical_formula",
                                                             "");
        components.emplace_back(component_name, chemical_formula);
    }

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