OGS
CreateParameter.cpp
Go to the documentation of this file.
1
13#include "CreateParameter.h"
14
15#include "BaseLib/ConfigTree.h"
16#include "Parameter.h"
18#include "ParameterLib/Utils.h"
19
20namespace MaterialPropertyLib
21{
22std::unique_ptr<Parameter> createParameterProperty(
23 BaseLib::ConfigTree const& config,
24 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
25{
27 config.checkConfigParameter("type", "Parameter");
28
29 // Second access for storage.
31 auto property_name = config.peekConfigParameter<std::string>("name");
32
33 DBUG("Create Parameter property {:s}.", property_name);
34
35 std::string const& parameter_name =
37 config.getConfigParameter<std::string>("parameter_name");
38 auto const& parameter = ParameterLib::findParameter<double>(
39 parameter_name, parameters, 0, nullptr);
40 return std::make_unique<MaterialPropertyLib::Parameter>(
41 std::move(property_name), parameter);
42}
43} // 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< Parameter > createParameterProperty(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