From 03fbcd1f8ff948f30f1324a0b93e0b377d735ed6 Mon Sep 17 00:00:00 2001
From: Norihiro Watanabe <norihiro.watanabe@ufz.de>
Date: Fri, 17 Jun 2016 07:11:25 +0200
Subject: [PATCH] move to cpp: TimeDiscretizationBuilder

---
 .../ODESolver/TimeDiscretizationBuilder.cpp   | 53 +++++++++++++++++++
 NumLib/ODESolver/TimeDiscretizationBuilder.h  | 37 +------------
 2 files changed, 54 insertions(+), 36 deletions(-)
 create mode 100644 NumLib/ODESolver/TimeDiscretizationBuilder.cpp

diff --git a/NumLib/ODESolver/TimeDiscretizationBuilder.cpp b/NumLib/ODESolver/TimeDiscretizationBuilder.cpp
new file mode 100644
index 00000000000..42fb5fbf4f1
--- /dev/null
+++ b/NumLib/ODESolver/TimeDiscretizationBuilder.cpp
@@ -0,0 +1,53 @@
+/**
+ * \copyright
+ * Copyright (c) 2012-2016, 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 "TimeDiscretizationBuilder.h"
+
+#include "BaseLib/Error.h"
+
+namespace NumLib
+{
+std::unique_ptr<TimeDiscretization> createTimeDiscretization(
+    BaseLib::ConfigTree const& config)
+{
+    using T = std::unique_ptr<TimeDiscretization>;
+
+    //! \ogs_file_param{process__time_discretization__type}
+    auto const type = config.getConfigParameter<std::string>("type");
+
+    if (type == "BackwardEuler")
+    {
+        using ConcreteTD = BackwardEuler;
+        return T(new ConcreteTD);
+    }
+    else if (type == "ForwardEuler")
+    {
+        using ConcreteTD = ForwardEuler;
+        return T(new ConcreteTD);
+    }
+    else if (type == "CrankNicolson")
+    {
+        //! \ogs_file_param{process__time_discretization__CrankNicolson__theta}
+        auto const theta = config.getConfigParameter<double>("theta");
+        using ConcreteTD = CrankNicolson;
+        return T(new ConcreteTD(theta));
+    }
+    else if (type == "BackwardDifferentiationFormula")
+    {
+        //! \ogs_file_param{process__time_discretization__BackwardDifferentiationFormula__order}
+        auto const order = config.getConfigParameter<unsigned>("order");
+        using ConcreteTD = BackwardDifferentiationFormula;
+        return T(new ConcreteTD(order));
+    }
+    else
+    {
+        OGS_FATAL("Unrecognized time discretization type `%s'", type.c_str());
+    }
+}
+}
diff --git a/NumLib/ODESolver/TimeDiscretizationBuilder.h b/NumLib/ODESolver/TimeDiscretizationBuilder.h
index c29fa855dc4..d41fb4d0560 100644
--- a/NumLib/ODESolver/TimeDiscretizationBuilder.h
+++ b/NumLib/ODESolver/TimeDiscretizationBuilder.h
@@ -19,42 +19,7 @@ namespace NumLib
 {
 
 std::unique_ptr<TimeDiscretization> createTimeDiscretization(
-    BaseLib::ConfigTree const& config)
-{
-    using T = std::unique_ptr<TimeDiscretization>;
-
-    //! \ogs_file_param{process__time_discretization__type}
-    auto const type = config.getConfigParameter<std::string>("type");
-
-    if (type == "BackwardEuler")
-    {
-        using ConcreteTD = BackwardEuler;
-        return T(new ConcreteTD);
-    }
-    else if (type == "ForwardEuler")
-    {
-        using ConcreteTD = ForwardEuler;
-        return T(new ConcreteTD);
-    }
-    else if (type == "CrankNicolson")
-    {
-        //! \ogs_file_param{process__time_discretization__CrankNicolson__theta}
-        auto const theta = config.getConfigParameter<double>("theta");
-        using ConcreteTD = CrankNicolson;
-        return T(new ConcreteTD(theta));
-    }
-    else if (type == "BackwardDifferentiationFormula")
-    {
-        //! \ogs_file_param{process__time_discretization__BackwardDifferentiationFormula__order}
-        auto const order = config.getConfigParameter<unsigned>("order");
-        using ConcreteTD = BackwardDifferentiationFormula;
-        return T(new ConcreteTD(order));
-    }
-    else
-    {
-        OGS_FATAL("Unrecognized time discretization type `%s'", type.c_str());
-    }
-}
+    BaseLib::ConfigTree const& config);
 }
 
 #endif  // NUMLIB_TIMEDISCRETIZATION_BUILDER_H
-- 
GitLab