From 05b8f273d59a2faeecd0c9fdd3317221ec8c7b06 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Tue, 26 May 2020 05:50:32 +0200 Subject: [PATCH] [MPL] Rename ParameterProperty -> Parameter for consistency. --- ...ameterProperty.cpp => CreateParameter.cpp} | 8 ++-- ...eParameterProperty.h => CreateParameter.h} | 4 +- MaterialLib/MPL/Properties/CreateProperties.h | 2 +- MaterialLib/MPL/Properties/Parameter.cpp | 46 ++++++++++++++++++ .../{ParameterProperty.h => Parameter.h} | 6 +-- .../MPL/Properties/ParameterProperty.cpp | 47 ------------------- MaterialLib/MPL/Properties/Properties.h | 2 +- 7 files changed, 57 insertions(+), 58 deletions(-) rename MaterialLib/MPL/Properties/{CreateParameterProperty.cpp => CreateParameter.cpp} (86%) rename MaterialLib/MPL/Properties/{CreateParameterProperty.h => CreateParameter.h} (89%) create mode 100644 MaterialLib/MPL/Properties/Parameter.cpp rename MaterialLib/MPL/Properties/{ParameterProperty.h => Parameter.h} (92%) delete mode 100644 MaterialLib/MPL/Properties/ParameterProperty.cpp diff --git a/MaterialLib/MPL/Properties/CreateParameterProperty.cpp b/MaterialLib/MPL/Properties/CreateParameter.cpp similarity index 86% rename from MaterialLib/MPL/Properties/CreateParameterProperty.cpp rename to MaterialLib/MPL/Properties/CreateParameter.cpp index f12a5e6869d..e4d20a5959f 100644 --- a/MaterialLib/MPL/Properties/CreateParameterProperty.cpp +++ b/MaterialLib/MPL/Properties/CreateParameter.cpp @@ -10,17 +10,17 @@ * http://www.opengeosys.org/project/license */ -#include "CreateParameterProperty.h" +#include "CreateParameter.h" #include "BaseLib/ConfigTree.h" #include "ParameterLib/Parameter.h" #include "ParameterLib/Utils.h" -#include "ParameterProperty.h" +#include "Parameter.h" namespace MaterialPropertyLib { -std::unique_ptr<ParameterProperty> createParameterProperty( +std::unique_ptr<Parameter> createParameterProperty( BaseLib::ConfigTree const& config, std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters) { @@ -38,7 +38,7 @@ std::unique_ptr<ParameterProperty> createParameterProperty( config.getConfigParameter<std::string>("parameter_name"); auto const& parameter = ParameterLib::findParameter<double>( parameter_name, parameters, 0, nullptr); - return std::make_unique<MaterialPropertyLib::ParameterProperty>( + return std::make_unique<MaterialPropertyLib::Parameter>( std::move(property_name), parameter); } } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/CreateParameterProperty.h b/MaterialLib/MPL/Properties/CreateParameter.h similarity index 89% rename from MaterialLib/MPL/Properties/CreateParameterProperty.h rename to MaterialLib/MPL/Properties/CreateParameter.h index 45f3547540f..29fbbcd4be7 100644 --- a/MaterialLib/MPL/Properties/CreateParameterProperty.h +++ b/MaterialLib/MPL/Properties/CreateParameter.h @@ -22,7 +22,7 @@ class ConfigTree; namespace MaterialPropertyLib { -class ParameterProperty; +class Parameter; } namespace ParameterLib @@ -32,7 +32,7 @@ struct ParameterBase; namespace MaterialPropertyLib { -std::unique_ptr<ParameterProperty> createParameterProperty( +std::unique_ptr<Parameter> createParameterProperty( BaseLib::ConfigTree const& config, std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters); diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h index e296d4b3f29..301448d0395 100644 --- a/MaterialLib/MPL/Properties/CreateProperties.h +++ b/MaterialLib/MPL/Properties/CreateProperties.h @@ -23,7 +23,7 @@ #include "CreateExponential.h" #include "CreateIdealGasLaw.h" #include "CreateLinear.h" -#include "CreateParameterProperty.h" +#include "CreateParameter.h" #include "CreatePermeabilityOrthotropicPowerLaw.h" #include "CreatePorosityFromMassBalance.h" #include "CreateSaturationDependentSwelling.h" diff --git a/MaterialLib/MPL/Properties/Parameter.cpp b/MaterialLib/MPL/Properties/Parameter.cpp new file mode 100644 index 00000000000..1b01cfdaee6 --- /dev/null +++ b/MaterialLib/MPL/Properties/Parameter.cpp @@ -0,0 +1,46 @@ +/** + * \file + * + * \copyright + * Copyright (c) 2012-2020, 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/Parameter.h" + +namespace MaterialPropertyLib +{ +Parameter::Parameter(std::string name, + ParameterLib::Parameter<double> const& parameter) + : parameter_(parameter) +{ + name_ = std::move(name); +} + +PropertyDataType Parameter::value(VariableArray const& /*variable_array*/, + ParameterLib::SpatialPosition const& pos, + double const t, double const /*dt*/) const +{ + return fromVector(parameter_(t, pos)); +} + +PropertyDataType Parameter::dValue(VariableArray const& /*variable_array*/, + Variable const /*primary_variable*/, + ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/, + double const /*dt*/) const +{ + return double{}; +} + +PropertyDataType Parameter::d2Value( + VariableArray const& /*variable_array*/, Variable const /*pv1*/, + Variable const /*pv2*/, ParameterLib::SpatialPosition const& /*pos*/, + double const /*t*/, double const /*dt*/) const +{ + return double{}; +} + +} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/ParameterProperty.h b/MaterialLib/MPL/Properties/Parameter.h similarity index 92% rename from MaterialLib/MPL/Properties/ParameterProperty.h rename to MaterialLib/MPL/Properties/Parameter.h index 874cfa2d5d5..c30bd6bcb7e 100644 --- a/MaterialLib/MPL/Properties/ParameterProperty.h +++ b/MaterialLib/MPL/Properties/Parameter.h @@ -19,11 +19,11 @@ 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 +class Parameter final : public Property { public: - ParameterProperty(std::string name, - ParameterLib::Parameter<double> const& parameter); + Parameter(std::string name, + ParameterLib::Parameter<double> const& parameter); /// This method computes the value of a property depending linearly on /// the value of the given primary variable. diff --git a/MaterialLib/MPL/Properties/ParameterProperty.cpp b/MaterialLib/MPL/Properties/ParameterProperty.cpp deleted file mode 100644 index 37f426e6616..00000000000 --- a/MaterialLib/MPL/Properties/ParameterProperty.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/** - * \file - * - * \copyright - * Copyright (c) 2012-2020, 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( - std::string name, ParameterLib::Parameter<double> const& parameter) - : parameter_(parameter) -{ - name_ = std::move(name); -} - -PropertyDataType ParameterProperty::value( - VariableArray const& /*variable_array*/, - ParameterLib::SpatialPosition const& pos, double const t, - double const /*dt*/) const -{ - return fromVector(parameter_(t, pos)); -} - -PropertyDataType ParameterProperty::dValue( - VariableArray const& /*variable_array*/, - Variable const /*primary_variable*/, - ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/, - double const /*dt*/) const -{ - return double{}; -} - -PropertyDataType ParameterProperty::d2Value( - VariableArray const& /*variable_array*/, Variable const /*pv1*/, - Variable const /*pv2*/, ParameterLib::SpatialPosition const& /*pos*/, - double const /*t*/, double const /*dt*/) const -{ - return double{}; -} - -} // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/Properties/Properties.h b/MaterialLib/MPL/Properties/Properties.h index c4dd7365729..8004ac7c83e 100644 --- a/MaterialLib/MPL/Properties/Properties.h +++ b/MaterialLib/MPL/Properties/Properties.h @@ -22,7 +22,7 @@ #include "Exponential.h" #include "IdealGasLaw.h" #include "Linear.h" -#include "ParameterProperty.h" +#include "Parameter.h" #include "PorosityFromMassBalance.h" #include "RelativePermeability/RelPermBrooksCorey.h" #include "RelativePermeability/RelPermLiakopoulos.h" -- GitLab