OGS
CreateConstant.cpp
Go to the documentation of this file.
1 
13 #include "BaseLib/ConfigTree.h"
14 #include "Constant.h"
15 
16 namespace MaterialPropertyLib
17 {
18 std::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(char const *fmt, Args const &... args)
Definition: Logging.h:27
T peekConfigParameter(std::string const &param) const
void checkConfigParameter(std::string const &param, T const &value) const
T getConfigParameter(std::string const &param) const
PropertyDataType fromVector(std::vector< double > const &values)
Definition: Property.cpp:23
std::unique_ptr< Constant > createConstant(BaseLib::ConfigTree const &config)