OGS
CreateParameter.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#include "CreateParameter.h"
5
7#include "Parameter.h"
10
11namespace MaterialPropertyLib
12{
13std::unique_ptr<Parameter> createParameterProperty(
14 BaseLib::ConfigTree const& config,
15 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters)
16{
18 config.checkConfigParameter("type", "Parameter");
19
20 // Second access for storage.
22 auto property_name = config.peekConfigParameter<std::string>("name");
23
24 DBUG("Create Parameter property {:s}.", property_name);
25
26 std::string const& parameter_name =
28 config.getConfigParameter<std::string>("parameter_name");
29 auto const& parameter = ParameterLib::findParameter<double>(
30 parameter_name, parameters, 0, nullptr);
31 return std::make_unique<MaterialPropertyLib::Parameter>(
32 std::move(property_name), parameter);
33}
34} // namespace MaterialPropertyLib
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:22
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)