From 4063c9f7ba15cc98da639fc0dc0e3b5f1d305f55 Mon Sep 17 00:00:00 2001
From: Norbert Grunwald <Norbert.Grunwald@ufz.de>
Date: Wed, 11 Sep 2019 07:44:37 +0200
Subject: [PATCH] extract RelPermBrooksCorey Property create method

---
 MaterialLib/MPL/Properties/CreateProperties.h |  1 +
 .../Properties/CreateRelPermBrooksCorey.cpp   | 50 +++++++++++++++++++
 .../MPL/Properties/CreateRelPermBrooksCorey.h | 26 ++++++++++
 .../MPL/Properties/RelPermBrooksCorey.h       | 36 -------------
 4 files changed, 77 insertions(+), 36 deletions(-)
 create mode 100644 MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.cpp
 create mode 100644 MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.h

diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h
index 646a6e2213a..386d7be0313 100644
--- a/MaterialLib/MPL/Properties/CreateProperties.h
+++ b/MaterialLib/MPL/Properties/CreateProperties.h
@@ -17,4 +17,5 @@
 #include "CreateIdealGasLaw.h"
 #include "CreateLinearProperty.h"
 #include "CreateParameterProperty.h"
+#include "CreateRelPermBrooksCorey.h"
 #include "CreateSaturationBrooksCorey.h"
\ No newline at end of file
diff --git a/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.cpp b/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.cpp
new file mode 100644
index 00000000000..df32753c7b0
--- /dev/null
+++ b/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.cpp
@@ -0,0 +1,50 @@
+/**
+ * \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 "BaseLib/ConfigTree.h"
+#include "RelPermBrooksCorey.h"
+
+namespace MaterialPropertyLib
+{
+std::unique_ptr<RelPermBrooksCorey> createRelPermBrooksCorey(
+    BaseLib::ConfigTree const& config)
+{
+    // check is reading the parameter, not peeking it...
+    //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey}
+    config.checkConfigParameter("type", "RelPermBrooksCorey");
+    DBUG("Create RelPermBrooksCorey medium property");
+
+    auto const residual_liquid_saturation =
+        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__residual_liquid_saturation}
+        config.getConfigParameter<double>("residual_liquid_saturation");
+    auto const residual_gas_saturation =
+        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__residual_gas_saturation}
+        config.getConfigParameter<double>("residual_gas_saturation");
+    auto const min_relative_permeability_liquid =
+        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__k_rel_min_liquid}
+        config.getConfigParameter<double>("min_relative_permeability_liquid");
+    auto const min_relative_permeability_gas =
+        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__k_rel_min_gas}
+        config.getConfigParameter<double>("min_relative_permeability_gas");
+    auto const exponent =
+        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__lambda}
+        config.getConfigParameter<double>("lambda");
+    if (exponent == 0.)
+    {
+        OGS_FATAL("Exponent 'lambda' must be positive.");
+    }
+
+    return std::make_unique<RelPermBrooksCorey>(
+        residual_liquid_saturation,
+        residual_gas_saturation,
+        min_relative_permeability_liquid,
+        min_relative_permeability_gas,
+        exponent);
+}
+}  // namespace MaterialPropertyLib
diff --git a/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.h b/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.h
new file mode 100644
index 00000000000..459c03fe34e
--- /dev/null
+++ b/MaterialLib/MPL/Properties/CreateRelPermBrooksCorey.h
@@ -0,0 +1,26 @@
+/**
+ * \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
+
+namespace BaseLib
+{
+class ConfigTree;
+}
+
+namespace MaterialPropertyLib
+{
+class RelPermBrooksCorey;
+}
+
+namespace MaterialPropertyLib
+{
+std::unique_ptr<RelPermBrooksCorey> createRelPermBrooksCorey(
+    BaseLib::ConfigTree const& config);
+}  // namespace MaterialPropertyLib
diff --git a/MaterialLib/MPL/Properties/RelPermBrooksCorey.h b/MaterialLib/MPL/Properties/RelPermBrooksCorey.h
index 247a9b600ec..9043894a5f7 100644
--- a/MaterialLib/MPL/Properties/RelPermBrooksCorey.h
+++ b/MaterialLib/MPL/Properties/RelPermBrooksCorey.h
@@ -72,40 +72,4 @@ public:
                             double const t) const override;
 };
 
-inline std::unique_ptr<RelPermBrooksCorey> createRelPermBrooksCorey(
-    BaseLib::ConfigTree const& config)
-{
-    // check is reading the parameter, not peeking it...
-    //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey}
-    // config.checkConfigParameter("type", "RelPermBrooksCorey");
-    DBUG("Create RelPermBrooksCorey medium property");
-
-    auto const residual_liquid_saturation =
-        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__residual_liquid_saturation}
-        config.getConfigParameter<double>("residual_liquid_saturation");
-    auto const residual_gas_saturation =
-        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__residual_gas_saturation}
-        config.getConfigParameter<double>("residual_gas_saturation");
-    auto const min_relative_permeability_liquid =
-        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__k_rel_min_liquid}
-        config.getConfigParameter<double>("min_relative_permeability_liquid");
-    auto const min_relative_permeability_gas =
-        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__k_rel_min_gas}
-        config.getConfigParameter<double>("min_relative_permeability_gas");
-    auto const exponent =
-        //! \ogs_file_param{prj__media__medium__properties__property__RelPermBrooksCorey__lambda}
-        config.getConfigParameter<double>("lambda");
-    if (exponent == 0.)
-    {
-        OGS_FATAL("Exponent 'lambda' must be positive.");
-    }
-
-    return std::make_unique<RelPermBrooksCorey>(
-        residual_liquid_saturation,
-        residual_gas_saturation,
-        min_relative_permeability_liquid,
-        min_relative_permeability_gas,
-        exponent);
-}
-
 }  // namespace MaterialPropertyLib
-- 
GitLab