Skip to content
Snippets Groups Projects
Commit 86e626db authored by renchao.lu's avatar renchao.lu Committed by Dmitri Naumov
Browse files

[CL] Create class Reaction Rate.

parent 6be6a186
No related branches found
No related tags found
No related merge requests found
/**
* \copyright
* Copyright (c) 2012-2019, 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 "ReactionRate.h"
#include "BaseLib/ConfigTreeUtil.h"
namespace ChemistryLib
{
std::vector<ReactionRate> createReactionRates(
boost::optional<BaseLib::ConfigTree> const& config)
{
if (!config)
return {};
std::vector<ReactionRate> reaction_rates;
for (auto const& rate_config :
//! \ogs_file_param{prj__chemical_system__rates__rate}
config->getConfigSubtreeList("rate"))
{
auto kinetic_reactant =
//! \ogs_file_param{prj__chemical_system__rates__rate__kinetic_reactant}
rate_config.getConfigParameter<std::string>("kinetic_reactant");
std::vector<std::string> expression_statements;
auto const expression_config =
//! \ogs_file_param{prj__chemical_system__rates__rate__expression}
rate_config.getConfigSubtree("expression");
for (
auto const& expression_statement :
//! \ogs_file_param{prj__chemical_system__rates__rate__expression__statement}
expression_config.getConfigParameterList<std::string>("statement"))
expression_statements.push_back(expression_statement);
reaction_rates.emplace_back(std::move(kinetic_reactant),
std::move(expression_statements));
}
return reaction_rates;
}
} // namespace ChemistryLib
/**
* \copyright
* Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <boost/optional/optional.hpp>
#include <string>
#include <vector>
namespace BaseLib
{
class ConfigTree;
}
namespace ChemistryLib
{
struct ReactionRate
{
ReactionRate(std::string kinetic_reactant_,
std::vector<std::string>
expression_statements_)
: kinetic_reactant(std::move(kinetic_reactant_)),
expression_statements(std::move(expression_statements_))
{
}
std::string const kinetic_reactant;
std::vector<std::string> const expression_statements;
};
std::vector<ReactionRate> createReactionRates(
boost::optional<BaseLib::ConfigTree> const& config);
} // namespace ChemistryLib
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment