OGS
CreatePorosityFromMassBalance.cpp
Go to the documentation of this file.
1
11
12#include "BaseLib/ConfigTree.h"
13#include "ParameterLib/Utils.h"
15
16namespace MaterialPropertyLib
17{
18std::unique_ptr<PorosityFromMassBalance> createPorosityFromMassBalance(
19 BaseLib::ConfigTree const& config,
20 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
21{
23 config.checkConfigParameter("type", "PorosityFromMassBalance");
24
25 // Second access for storage.
27 auto property_name = config.peekConfigParameter<std::string>("name");
28
29 DBUG("Create PorosityFromMassBalance medium property {:s}.", property_name);
30
31 std::string const& parameter_name =
33 config.getConfigParameter<std::string>("initial_porosity");
34 auto const& initial_porosity = ParameterLib::findParameter<double>(
35 parameter_name, parameters, 0, nullptr);
36
38 auto const& phi_min = config.getConfigParameter<double>("minimal_porosity");
39
41 auto const& phi_max = config.getConfigParameter<double>("maximal_porosity");
42
43 return std::make_unique<PorosityFromMassBalance>(
44 std::move(property_name), initial_porosity, phi_min, phi_max);
45}
46} // namespace MaterialPropertyLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
T peekConfigParameter(std::string const &param) const
T getConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, std::string_view const value) const
std::unique_ptr< PorosityFromMassBalance > createPorosityFromMassBalance(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const &parameters)
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
Definition Utils.h:102