OGS
CreateChemicalReactionData.cpp
Go to the documentation of this file.
1
12
13#include <boost/algorithm/string/predicate.hpp>
14
15#include "BaseLib/ConfigTree.h"
16#include "ChemicalReaction.h"
17
18namespace ChemistryLib
19{
20namespace SelfContainedSolverData
21{
22std::vector<std::unique_ptr<ChemicalReaction>> createChemicalReactionData(
23 BaseLib::ConfigTree const& config)
24{
25 std::vector<std::unique_ptr<ChemicalReaction>> chemical_reactions;
26
27 for (
28 auto const& reaction_config :
30 config.getConfigSubtreeList("chemical_reaction"))
31 {
32 auto const stoichiometric_vector =
34 reaction_config.getConfigParameter<std::vector<double>>(
35 "stoichiometric_coefficients");
36
37 auto const reaction_type =
39 reaction_config.getConfigParameter<std::string>("reaction_type");
40 if (boost::iequals(reaction_type, "FirstOrderReaction"))
41 {
42 chemical_reactions.emplace_back(std::make_unique<
44 stoichiometric_vector,
46 reaction_config.getConfigParameter<double>(
47 "first_order_rate_constant")));
48 }
49 }
50
51 return chemical_reactions;
52}
53} // namespace SelfContainedSolverData
54} // namespace ChemistryLib
Range< SubtreeIterator > getConfigSubtreeList(std::string const &root) const
std::vector< std::unique_ptr< ChemicalReaction > > createChemicalReactionData(BaseLib::ConfigTree const &config)