diff --git a/MaterialLib/MPL/CreateProperty.cpp b/MaterialLib/MPL/CreateProperty.cpp index 955c9573188cf581b0cb5ead40998a5d1c46ed81..4d6eb09f375a007d9084b4b7985675d623c1a045 100644 --- a/MaterialLib/MPL/CreateProperty.cpp +++ b/MaterialLib/MPL/CreateProperty.cpp @@ -16,8 +16,6 @@ #include <string> #include <vector> #include "BaseLib/ConfigTree.h" -#include "ParameterLib/Parameter.h" -#include "ParameterLib/Utils.h" #include "Properties/CreateProperties.h" #include "Properties/Properties.h" @@ -53,13 +51,7 @@ std::unique_ptr<MaterialPropertyLib::Property> createProperty( if (property_type == "Parameter") { - std::string const& parameter_name = - //! \ogs_file_param{properties__property__Parameter__parameter_name} - config.getConfigParameter<std::string>("parameter_name"); - auto const& parameter = ParameterLib::findParameter<double>( - parameter_name, parameters, 0, nullptr); - return std::make_unique<MaterialPropertyLib::ParameterProperty>( - parameter); + return createParameterProperty(config, parameters); } if (boost::iequals(property_type, "IdealGasLaw")) diff --git a/MaterialLib/MPL/Properties/CreateParameterProperty.cpp b/MaterialLib/MPL/Properties/CreateParameterProperty.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6d7418858cef5da2127a6461b30c9690caf41eb3 --- /dev/null +++ b/MaterialLib/MPL/Properties/CreateParameterProperty.cpp @@ -0,0 +1,36 @@ +/** + * \file + * \author Norbert Grunwald + * \date Sep 10, 2019 + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#include "BaseLib/ConfigTree.h" +#include "ParameterLib/Parameter.h" +#include "ParameterLib/Utils.h" + +#include "ParameterProperty.h" + +namespace MaterialPropertyLib +{ +std::unique_ptr<ParameterProperty> createParameterProperty( + BaseLib::ConfigTree const& config, + std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters) +{ + config.checkConfigParameter("type", "Parameter"); + DBUG("Create Parameter property"); + + std::string const& parameter_name = + //! \ogs_file_param{properties__property__Parameter__parameter_name} + config.getConfigParameter<std::string>("parameter_name"); + auto const& parameter = ParameterLib::findParameter<double>( + parameter_name, parameters, 0, nullptr); + return std::make_unique<MaterialPropertyLib::ParameterProperty>(parameter); +} +} // namespace MaterialPropertyLib \ No newline at end of file diff --git a/MaterialLib/MPL/Properties/CreateParameterProperty.h b/MaterialLib/MPL/Properties/CreateParameterProperty.h new file mode 100644 index 0000000000000000000000000000000000000000..590c47721ec79d9b85efd080cbc8573e146cefe1 --- /dev/null +++ b/MaterialLib/MPL/Properties/CreateParameterProperty.h @@ -0,0 +1,32 @@ +/** + * \file + * \author Norbert Grunwald + * \date Sep 10, 2019 + * + * \copyright + * Copyright (c) 2012-2019, OpenGeoSys Community (http://www.opengeosys.org) + * Distributed under a Modified BSD License. + * See accompanying file LICENSE.txt or + * http://www.opengeosys.org/project/license + * + */ + +#pragma once + +namespace BaseLib +{ +class ConfigTree; +} + +namespace MaterialPropertyLib +{ +class ParameterProperty; +} + +namespace MaterialPropertyLib +{ +std::unique_ptr<ParameterProperty> createParameterProperty( + BaseLib::ConfigTree const& config, + std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& + parameters); +} // namespace MaterialPropertyLib \ No newline at end of file diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h index 51952c4bafd88f9a9c537d92acaf55a804d25f76..160408503fa0ddafaf007d94ec333a0dba18e730 100644 --- a/MaterialLib/MPL/Properties/CreateProperties.h +++ b/MaterialLib/MPL/Properties/CreateProperties.h @@ -16,3 +16,4 @@ #include "CreateExponentialProperty.h" #include "CreateIdealGasLaw.h" #include "CreateLinearProperty.h" +#include "CreateParameterProperty.h" \ No newline at end of file