OGS
CreateConstant.cpp
Go to the documentation of this file.
1
13#include "BaseLib/ConfigTree.h"
14#include "Constant.h"
15
16namespace MaterialPropertyLib
17{
18std::unique_ptr<Constant> createConstant(BaseLib::ConfigTree const& config)
19{
21 config.checkConfigParameter("type", "Constant");
22
23 // Second access for storage.
25 auto property_name = config.peekConfigParameter<std::string>("name");
26
27 DBUG("Create Constant property {:s}.", property_name);
28 std::vector<double> const values =
30 config.getConfigParameter<std::vector<double>>("value");
31
32 return std::make_unique<Constant>(std::move(property_name),
33 fromVector(values));
34}
35} // 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
PropertyDataType fromVector(std::vector< double > const &values)
Definition Property.cpp:23
std::unique_ptr< Constant > createConstant(BaseLib::ConfigTree const &config)