From aa8697671d944958f7dd59a3542ceb10c686e868 Mon Sep 17 00:00:00 2001 From: Norbert Grunwald <Norbert.Grunwald@ufz.de> Date: Wed, 11 Sep 2019 06:15:24 +0200 Subject: [PATCH] [MPL] clang-format. --- MaterialLib/MPL/CreateComponent.h | 1 - MaterialLib/MPL/CreateMedium.h | 3 +- MaterialLib/MPL/CreateProperty.h | 1 - MaterialLib/MPL/Properties/CreateConstant.h | 3 +- .../Properties/CreateExponentialProperty.cpp | 55 +++++++++---------- .../MPL/Properties/ExponentialProperty.h | 1 - MaterialLib/MPL/Properties/LinearProperty.cpp | 18 +++--- MaterialLib/MPL/Properties/Properties.h | 2 +- MaterialLib/MPL/Property.cpp | 1 - 9 files changed, 39 insertions(+), 46 deletions(-) diff --git a/MaterialLib/MPL/CreateComponent.h b/MaterialLib/MPL/CreateComponent.h index ab092b8dc20..74c10d06ca6 100644 --- a/MaterialLib/MPL/CreateComponent.h +++ b/MaterialLib/MPL/CreateComponent.h @@ -25,7 +25,6 @@ namespace ParameterLib struct ParameterBase; } - namespace MaterialPropertyLib { /// The method creates components based on config subtree. diff --git a/MaterialLib/MPL/CreateMedium.h b/MaterialLib/MPL/CreateMedium.h index ebb36255d4f..2ac29040260 100644 --- a/MaterialLib/MPL/CreateMedium.h +++ b/MaterialLib/MPL/CreateMedium.h @@ -35,5 +35,6 @@ namespace MaterialPropertyLib /// assigned. std::unique_ptr<Medium> createMedium( BaseLib::ConfigTree const& config, - std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& parameters); + std::vector<std::unique_ptr<ParameterLib::ParameterBase>> const& + parameters); } // namespace MaterialPropertyLib diff --git a/MaterialLib/MPL/CreateProperty.h b/MaterialLib/MPL/CreateProperty.h index 8db96040da8..ddc72c39bbb 100644 --- a/MaterialLib/MPL/CreateProperty.h +++ b/MaterialLib/MPL/CreateProperty.h @@ -25,7 +25,6 @@ namespace ParameterLib struct ParameterBase; } - namespace MaterialPropertyLib { class Property; diff --git a/MaterialLib/MPL/Properties/CreateConstant.h b/MaterialLib/MPL/Properties/CreateConstant.h index 5919cdb472d..60f5b81e287 100644 --- a/MaterialLib/MPL/Properties/CreateConstant.h +++ b/MaterialLib/MPL/Properties/CreateConstant.h @@ -25,6 +25,5 @@ class Constant; namespace MaterialPropertyLib { -std::unique_ptr<Constant> createConstant( - BaseLib::ConfigTree const& config); +std::unique_ptr<Constant> createConstant(BaseLib::ConfigTree const& config); } // namespace MaterialPropertyLib \ No newline at end of file diff --git a/MaterialLib/MPL/Properties/CreateExponentialProperty.cpp b/MaterialLib/MPL/Properties/CreateExponentialProperty.cpp index 262bf0b702b..4aead81523e 100644 --- a/MaterialLib/MPL/Properties/CreateExponentialProperty.cpp +++ b/MaterialLib/MPL/Properties/CreateExponentialProperty.cpp @@ -21,34 +21,31 @@ std::unique_ptr<ExponentialProperty> createExponentialProperty( { config.checkConfigParameter("type", "Exponential"); DBUG("Create Exponential property"); - auto const reference_value = - //! \ogs_file_param{properties__property__ExponentialProperty__reference_value} - config.getConfigParameter<double>("reference_value"); - - auto const& exponent_data_config = - //! \ogs_file_param{properties__property__ExponentialProperty__exponent} - config.getConfigSubtree("exponent"); - - auto const& variable_name = - //! \ogs_file_param{properties__property__ExponentialProperty__exponent__variable_name} - exponent_data_config.getConfigParameter<std::string>( - "variable_name"); - auto const reference_condition = - //! \ogs_file_param{properties__property__ExponentialProperty__exponent__reference_condition} - exponent_data_config.getConfigParameter<double>( - "reference_condition"); - auto const factor = - //! \ogs_file_param{properties__property__ExponentialProperty__exponent__factor} - exponent_data_config.getConfigParameter<double>("factor"); - - MaterialPropertyLib::Variable exp_data_type = - MaterialPropertyLib::convertStringToVariable(variable_name); - - MaterialPropertyLib::ExponentData const exp_data{ - exp_data_type, reference_condition, factor}; - - return std::make_unique<MaterialPropertyLib::ExponentialProperty>( - reference_value, exp_data); - + auto const reference_value = + //! \ogs_file_param{properties__property__ExponentialProperty__reference_value} + config.getConfigParameter<double>("reference_value"); + + auto const& exponent_data_config = + //! \ogs_file_param{properties__property__ExponentialProperty__exponent} + config.getConfigSubtree("exponent"); + + auto const& variable_name = + //! \ogs_file_param{properties__property__ExponentialProperty__exponent__variable_name} + exponent_data_config.getConfigParameter<std::string>("variable_name"); + auto const reference_condition = + //! \ogs_file_param{properties__property__ExponentialProperty__exponent__reference_condition} + exponent_data_config.getConfigParameter<double>("reference_condition"); + auto const factor = + //! \ogs_file_param{properties__property__ExponentialProperty__exponent__factor} + exponent_data_config.getConfigParameter<double>("factor"); + + MaterialPropertyLib::Variable exp_data_type = + MaterialPropertyLib::convertStringToVariable(variable_name); + + MaterialPropertyLib::ExponentData const exp_data{ + exp_data_type, reference_condition, factor}; + + return std::make_unique<MaterialPropertyLib::ExponentialProperty>( + reference_value, exp_data); } } // namespace MaterialPropertyLib \ No newline at end of file diff --git a/MaterialLib/MPL/Properties/ExponentialProperty.h b/MaterialLib/MPL/Properties/ExponentialProperty.h index 9c2c9a53432..73693dcc305 100644 --- a/MaterialLib/MPL/Properties/ExponentialProperty.h +++ b/MaterialLib/MPL/Properties/ExponentialProperty.h @@ -15,7 +15,6 @@ namespace MaterialPropertyLib { - struct ExponentData { Variable type; diff --git a/MaterialLib/MPL/Properties/LinearProperty.cpp b/MaterialLib/MPL/Properties/LinearProperty.cpp index 39e157a406a..dddfe088233 100644 --- a/MaterialLib/MPL/Properties/LinearProperty.cpp +++ b/MaterialLib/MPL/Properties/LinearProperty.cpp @@ -27,15 +27,15 @@ PropertyDataType LinearProperty::value( ParameterLib::SpatialPosition const& /*pos*/, double const /*t*/) const { - auto calculate_linearized_ratio = - [&variable_array](double const initial_linearized_ratio, - auto const& iv) { - return initial_linearized_ratio + - std::get<double>(iv.slope) * - (std::get<double>( - variable_array[static_cast<int>(iv.type)]) - - std::get<double>(iv.reference_condition)); - }; + auto calculate_linearized_ratio = [&variable_array]( + double const initial_linearized_ratio, + auto const& iv) { + return initial_linearized_ratio + + std::get<double>(iv.slope) * + (std::get<double>( + variable_array[static_cast<int>(iv.type)]) - + std::get<double>(iv.reference_condition)); + }; double const linearized_ratio_to_reference_value = std::accumulate(_independent_variables.begin(), diff --git a/MaterialLib/MPL/Properties/Properties.h b/MaterialLib/MPL/Properties/Properties.h index ff42aea9ca8..f8ca051af51 100644 --- a/MaterialLib/MPL/Properties/Properties.h +++ b/MaterialLib/MPL/Properties/Properties.h @@ -13,7 +13,7 @@ #pragma once #include "Constant.h" +#include "ExponentialProperty.h" #include "IdealGasLaw.h" #include "LinearProperty.h" -#include "ExponentialProperty.h" #include "ParameterProperty.h" diff --git a/MaterialLib/MPL/Property.cpp b/MaterialLib/MPL/Property.cpp index e6fcfaf4df2..a3db05f4cab 100644 --- a/MaterialLib/MPL/Property.cpp +++ b/MaterialLib/MPL/Property.cpp @@ -17,7 +17,6 @@ namespace MaterialPropertyLib { - PropertyDataType Property::value() const { return _value; -- GitLab