diff --git a/MaterialLib/MPL/Properties/ParameterProperty.cpp b/MaterialLib/MPL/Properties/ParameterProperty.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5406b62396c579db5116e7a1d8768048f9da8bcd --- /dev/null +++ b/MaterialLib/MPL/Properties/ParameterProperty.cpp @@ -0,0 +1,45 @@ +/** + * \file + * + * \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 "MaterialLib/MPL/Properties/ParameterProperty.h" + +namespace MaterialPropertyLib +{ +ParameterProperty::ParameterProperty( + ParameterLib::Parameter<double> const& parameter) + : _parameter(parameter) +{ +} + +PropertyDataType ParameterProperty::value( + VariableArray const& /*variable_array*/, + ParameterLib::SpatialPosition const& pos, + double const t) const +{ + return _parameter(t, pos)[0]; +} + +PropertyDataType ParameterProperty::dValue( + VariableArray const& /*variable_array*/, + Variable const /*primary_variable*/) const +{ + return double{}; +} + +PropertyDataType ParameterProperty::d2Value( + VariableArray const& /*variable_array*/, + Variable const /*pv1*/, + Variable const /*pv2*/) const +{ + return double{}; +} + +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/ParameterProperty.h b/MaterialLib/MPL/Properties/ParameterProperty.h new file mode 100644 index 0000000000000000000000000000000000000000..923e8d52683ebad9d95bcb84f75e2c35d996c004 --- /dev/null +++ b/MaterialLib/MPL/Properties/ParameterProperty.h @@ -0,0 +1,49 @@ +/** + * \file + * + * \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 + +#include "MaterialLib/MPL/Property.h" +#include "MaterialLib/MPL/VariableType.h" + +#include "ParameterLib/Parameter.h" + +namespace MaterialPropertyLib +{ + +/// The parameter property class. The property reads the value from a parameter. +/// The current implementation accepts only the double datatype defined in +/// PropertyDataType. +class ParameterProperty final : public Property +{ +public: + /// This constructor accepts a Parameter. + ParameterProperty(ParameterLib::Parameter<double> const& parameter); + + /// This method computes the value of a property depending linearly on + /// the value of the given primary variable. + PropertyDataType value(VariableArray const& variable_array, + ParameterLib::SpatialPosition const& pos, + double const t) const override; + + /// This method will compute the derivative of a property with respect to + /// the given primary variable. + PropertyDataType dValue(VariableArray const& variable_array, + Variable const primary_variable) const override; + /// This method will compute the second derivative of a + /// property with respect to the given primary variables pv1 and pv2. + PropertyDataType d2Value(VariableArray const& variable_array, + Variable const pv1, + Variable const pv2) const override; + +private: + ParameterLib::Parameter<double> const& _parameter; +}; +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/Properties.h b/MaterialLib/MPL/Properties/Properties.h index 0d4ca2876b3c533747615218208419a0508fb8af..0928c34841540950ec8aa081c39a3afe880c9a9c 100644 --- a/MaterialLib/MPL/Properties/Properties.h +++ b/MaterialLib/MPL/Properties/Properties.h @@ -15,3 +15,4 @@ #include "Constant.h" #include "LinearProperty.h" #include "ExponentialProperty.h" +#include "ParameterProperty.h"