Skip to content
Snippets Groups Projects
Commit 72b380a0 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MPL] Impl. of ParameterProperty.

parent 5d601c79
No related branches found
No related tags found
No related merge requests found
/**
* \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
/**
* \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
......@@ -15,3 +15,4 @@
#include "Constant.h"
#include "LinearProperty.h"
#include "ExponentialProperty.h"
#include "ParameterProperty.h"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment