From 4744f7077605a3907528e2ce43480d28aebfb550 Mon Sep 17 00:00:00 2001
From: Norbert Grunwald <Norbert.Grunwald@ufz.de>
Date: Tue, 10 Sep 2019 08:17:43 +0200
Subject: [PATCH] extract create property method from property header into own
 file

---
 MaterialLib/MPL/CreateProperty.cpp            |  1 +
 .../MPL/Properties/CreateIdealGasLaw.cpp      | 26 ++++++++++++++++
 .../MPL/Properties/CreateIdealGasLaw.h        | 30 +++++++++++++++++++
 MaterialLib/MPL/Properties/CreateProperties.h | 15 ++++++++++
 MaterialLib/MPL/Properties/IdealGasLaw.h      |  7 -----
 Tests/MaterialLib/TestMPLIdealGasLaw.cpp      |  2 +-
 6 files changed, 73 insertions(+), 8 deletions(-)
 create mode 100644 MaterialLib/MPL/Properties/CreateIdealGasLaw.cpp
 create mode 100644 MaterialLib/MPL/Properties/CreateIdealGasLaw.h
 create mode 100644 MaterialLib/MPL/Properties/CreateProperties.h

diff --git a/MaterialLib/MPL/CreateProperty.cpp b/MaterialLib/MPL/CreateProperty.cpp
index c2856930472..94efb907ae7 100644
--- a/MaterialLib/MPL/CreateProperty.cpp
+++ b/MaterialLib/MPL/CreateProperty.cpp
@@ -19,6 +19,7 @@
 #include "ParameterLib/Parameter.h"
 #include "ParameterLib/Utils.h"
 
+#include "Properties/CreateProperties.h"
 #include "Properties/Properties.h"
 
 #include "Component.h"
diff --git a/MaterialLib/MPL/Properties/CreateIdealGasLaw.cpp b/MaterialLib/MPL/Properties/CreateIdealGasLaw.cpp
new file mode 100644
index 00000000000..23f9e90fb02
--- /dev/null
+++ b/MaterialLib/MPL/Properties/CreateIdealGasLaw.cpp
@@ -0,0 +1,26 @@
+/**
+ * \file
+ * \author Norbert Grunwald
+ * \date   Sep 10, 2019
+ *
+ * \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 "IdealGasLaw.h"
+
+namespace MaterialPropertyLib
+{
+std::unique_ptr<IdealGasLaw> createIdealGasLaw(
+    BaseLib::ConfigTree const& config)
+{
+    config.checkConfigParameter("type", "IdealGasLaw");
+    DBUG("Create IdealGasLaw medium property");
+    return std::make_unique<IdealGasLaw>();
+}
+}  // namespace MaterialPropertyLib
\ No newline at end of file
diff --git a/MaterialLib/MPL/Properties/CreateIdealGasLaw.h b/MaterialLib/MPL/Properties/CreateIdealGasLaw.h
new file mode 100644
index 00000000000..3f1c037b3d7
--- /dev/null
+++ b/MaterialLib/MPL/Properties/CreateIdealGasLaw.h
@@ -0,0 +1,30 @@
+/**
+ * \file
+ * \author Norbert Grunwald
+ * \date   Sep 10, 2019
+ *
+ * \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 IdealGasLaw;
+}
+
+namespace MaterialPropertyLib
+{
+std::unique_ptr<IdealGasLaw> createIdealGasLaw(
+    BaseLib::ConfigTree const& config);
+}  // namespace MaterialPropertyLib
\ No newline at end of file
diff --git a/MaterialLib/MPL/Properties/CreateProperties.h b/MaterialLib/MPL/Properties/CreateProperties.h
new file mode 100644
index 00000000000..e13780c4607
--- /dev/null
+++ b/MaterialLib/MPL/Properties/CreateProperties.h
@@ -0,0 +1,15 @@
+/**
+ * \file
+ * \author Norbert Grunwald
+ * \date   Sep 10, 2019
+ *
+ * \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 "CreateIdealGasLaw.h"
diff --git a/MaterialLib/MPL/Properties/IdealGasLaw.h b/MaterialLib/MPL/Properties/IdealGasLaw.h
index 69b35cba655..6e86069cc73 100644
--- a/MaterialLib/MPL/Properties/IdealGasLaw.h
+++ b/MaterialLib/MPL/Properties/IdealGasLaw.h
@@ -71,11 +71,4 @@ private:
     Component* _component;
 };
 
-inline std::unique_ptr<IdealGasLaw> createIdealGasLaw(
-    BaseLib::ConfigTree const& /*config*/)
-{
-    DBUG("Create IdealGasLaw medium property");
-    return std::make_unique<IdealGasLaw>();
-}
-
 }  // namespace MaterialPropertyLib
diff --git a/Tests/MaterialLib/TestMPLIdealGasLaw.cpp b/Tests/MaterialLib/TestMPLIdealGasLaw.cpp
index bcdeb1d4e0e..22e4030d32c 100644
--- a/Tests/MaterialLib/TestMPLIdealGasLaw.cpp
+++ b/Tests/MaterialLib/TestMPLIdealGasLaw.cpp
@@ -44,7 +44,7 @@ TEST(MaterialPropertyLib, IdealGasLawOfPurePhase)
     m << "  <properties>\n";
     m << "    <property>\n";
     m << "      <name>density</name>\n";
-    m << "      <type>IdealGaslaw</type>\n";
+    m << "      <type>IdealGasLaw</type>\n";
     m << "    </property>\n";
     m << "    <property>\n";
     m << "      <name>molar_mass</name>\n";
-- 
GitLab