From 33d1dfdcdf2b2167015c66ed4bd98ef21c1e9c4c Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 19 Feb 2019 15:52:58 +0100
Subject: [PATCH] [Mat/MPL] Init. impl. of reading a LinearProperty.

---
 MaterialLib/MPL/CreateProperty.cpp | 34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/MaterialLib/MPL/CreateProperty.cpp b/MaterialLib/MPL/CreateProperty.cpp
index 9113a8eb53f..a8f7ee4f1e7 100644
--- a/MaterialLib/MPL/CreateProperty.cpp
+++ b/MaterialLib/MPL/CreateProperty.cpp
@@ -99,6 +99,40 @@ std::unique_ptr<MaterialPropertyLib::Property> createProperty(
     // Note that most property constructors (only those that request material
     // pointers) must be overloaded for any type of material.
 
+    if (property_type == "Linear")
+    {
+        double const reference_value =
+            //! \ogs_file_param{properties__property__LinearProperty__reference_value}
+            config.getConfigParameter<double>("reference_value");
+
+        auto const& independent_variable_config =
+            //! \ogs_file_param{properties__property__LinearProperty__independent_variable}
+            config.getConfigSubtree("independent_variable");
+
+        auto const& variable_name =
+            //! \ogs_file_param{properties__property__LinearProperty__independent_variable__variable_name}
+            independent_variable_config.getConfigParameter<std::string>(
+                "variable_name");
+        double const reference_condition =
+            //! \ogs_file_param{properties__property__LinearProperty__independent_variable__reference_condition}
+            independent_variable_config.getConfigParameter<double>(
+                "reference_condition");
+        double const slope =
+            //! \ogs_file_param{properties__property__LinearProperty__independent_variable__slope}
+            independent_variable_config.getConfigParameter<double>("slope");
+
+        MaterialPropertyLib::Variables ivt =
+            MaterialPropertyLib::convertStringToVariable(variable_name);
+
+        MaterialPropertyLib::IndependentVariable const iv{
+            ivt, reference_condition, slope};
+        MaterialPropertyLib::LinearProperty linear_property{reference_value,
+                                                            iv};
+
+        return std::make_unique<MaterialPropertyLib::LinearProperty>(
+            reference_value, iv);
+    }
+
     /* TODO Additional properties go here, for example:
     if (boost::iequals(property_type, "BilinearTemperaturePressure"))
     {
-- 
GitLab