From 8476199e6eabd38c61289b6f75e31cde43e5d15a Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Thu, 9 Nov 2017 15:38:57 +0100
Subject: [PATCH] [PL] LIE/HM; Move pcs instantiations to cpp.

---
 .../HydroMechanicsProcess-fwd.h               | 15 -----
 .../HydroMechanics/HydroMechanicsProcess.cpp  | 66 +++++++++++++++----
 .../HydroMechanics/HydroMechanicsProcess.h    | 50 +++-----------
 3 files changed, 63 insertions(+), 68 deletions(-)
 delete mode 100644 ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess-fwd.h

diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess-fwd.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess-fwd.h
deleted file mode 100644
index c82d43caa63..00000000000
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess-fwd.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * \copyright
- * Copyright (c) 2012-2017, 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 "HydroMechanicsProcess.h"
-
-extern template class ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess<2>;
-extern template class ProcessLib::LIE::HydroMechanics::HydroMechanicsProcess<3>;
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
index 898b4e6f487..8fe3b9bd5d7 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp
@@ -8,30 +8,23 @@
  */
 
 #include "HydroMechanicsProcess.h"
-#include "HydroMechanicsProcess-fwd.h"
-
-#include <algorithm>
-#include <cassert>
-#include <vector>
 
 #include "MeshLib/ElementCoordinatesMappingLocal.h"
 #include "MeshLib/ElementStatus.h"
-#include "MeshLib/Elements/Element.h"
 #include "MeshLib/Elements/Utils.h"
 #include "MeshLib/Mesh.h"
 #include "MeshLib/MeshInformation.h"
-#include "MeshLib/Node.h"
 #include "MeshLib/Properties.h"
 
 #include "NumLib/DOF/LocalToGlobalIndexMap.h"
 
 #include "ProcessLib/LIE/BoundaryCondition/BoundaryConditionBuilder.h"
-#include "ProcessLib/LIE/Common/LevelSetFunction.h"
 #include "ProcessLib/LIE/Common/MeshUtils.h"
-#include "ProcessLib/LIE/Common/Utils.h"
-#include "ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerFracture.h"
-#include "ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h"
-#include "ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h"
+
+#include "LocalAssembler/CreateLocalAssemblers.h"
+#include "LocalAssembler/HydroMechanicsLocalAssemblerFracture.h"
+#include "LocalAssembler/HydroMechanicsLocalAssemblerMatrix.h"
+#include "LocalAssembler/HydroMechanicsLocalAssemblerMatrixNearFracture.h"
 
 namespace ProcessLib
 {
@@ -485,6 +478,55 @@ void HydroMechanicsProcess<GlobalDim>::computeSecondaryVariableConcrete(
     }
 }
 
+template <unsigned GlobalDim>
+bool HydroMechanicsProcess<GlobalDim>::isLinear() const
+{
+    return false;
+}
+
+template <unsigned GlobalDim>
+void HydroMechanicsProcess<GlobalDim>::assembleConcreteProcess(
+    const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K,
+    GlobalVector& b)
+{
+    DBUG("Assemble HydroMechanicsProcess.");
+
+    // Call global assembler for each local assembly item.
+    GlobalExecutor::executeMemberDereferenced(
+        _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers,
+        *_local_to_global_index_map, t, x, M, K, b, _coupled_solutions);
+}
+
+template <unsigned GlobalDim>
+void HydroMechanicsProcess<GlobalDim>::assembleWithJacobianConcreteProcess(
+    const double t, GlobalVector const& x, GlobalVector const& xdot,
+    const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K,
+    GlobalVector& b, GlobalMatrix& Jac)
+{
+    DBUG("AssembleWithJacobian HydroMechanicsProcess.");
+
+    // Call global assembler for each local assembly item.
+    GlobalExecutor::executeMemberDereferenced(
+        _global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
+        _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx,
+        dx_dx, M, K, b, Jac, _coupled_solutions);
+}
+
+template <unsigned GlobalDim>
+void HydroMechanicsProcess<GlobalDim>::preTimestepConcreteProcess(
+    GlobalVector const& x, double const t,
+    double const dt, const int /*process_id*/)
+{
+    DBUG("PreTimestep HydroMechanicsProcess.");
+
+    _process_data.dt = dt;
+    _process_data.t = t;
+
+    GlobalExecutor::executeMemberOnDereferenced(
+        &HydroMechanicsLocalAssemblerInterface::preTimestep, _local_assemblers,
+        *_local_to_global_index_map, x, t, dt);
+}
+
 // ------------------------------------------------------------------------------------
 // template instantiation
 // ------------------------------------------------------------------------------------
diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
index 42b56207683..591de7f991a 100644
--- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
+++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h
@@ -9,14 +9,10 @@
 
 #pragma once
 
-#include <cassert>
-
 #include "ProcessLib/Process.h"
 
-#include "ProcessLib/LIE/HydroMechanics/LocalAssembler/CreateLocalAssemblers.h"
-#include "ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h"
-
 #include "HydroMechanicsProcessData.h"
+#include "LocalAssembler/HydroMechanicsLocalAssemblerInterface.h"
 
 namespace ProcessLib
 {
@@ -24,6 +20,8 @@ namespace LIE
 {
 namespace HydroMechanics
 {
+class HydroMechanicsLocalAssemblerInterface;
+
 template <unsigned GlobalDim>
 class HydroMechanicsProcess final : public Process
 {
@@ -48,8 +46,7 @@ public:
 
     //! \name ODESystem interface
     //! @{
-
-    bool isLinear() const override { return false; }
+    bool isLinear() const override;
     //! @}
 
     void computeSecondaryVariableConcrete(double const t,
@@ -67,44 +64,15 @@ private:
 
     void assembleConcreteProcess(const double t, GlobalVector const& x,
                                  GlobalMatrix& M, GlobalMatrix& K,
-                                 GlobalVector& b) override
-    {
-        DBUG("Assemble HydroMechanicsProcess.");
-
-        // Call global assembler for each local assembly item.
-        GlobalExecutor::executeMemberDereferenced(
-            _global_assembler, &VectorMatrixAssembler::assemble,
-            _local_assemblers, *_local_to_global_index_map, t, x, M, K, b,
-            _coupled_solutions);
-    }
+                                 GlobalVector& b) override;
 
     void assembleWithJacobianConcreteProcess(
         const double t, GlobalVector const& x, GlobalVector const& xdot,
         const double dxdot_dx, const double dx_dx, GlobalMatrix& M,
-        GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override
-    {
-        DBUG("AssembleWithJacobian HydroMechanicsProcess.");
-
-        // Call global assembler for each local assembly item.
-        GlobalExecutor::executeMemberDereferenced(
-            _global_assembler, &VectorMatrixAssembler::assembleWithJacobian,
-            _local_assemblers, *_local_to_global_index_map, t, x, xdot,
-            dxdot_dx, dx_dx, M, K, b, Jac, _coupled_solutions);
-    }
-
-    void preTimestepConcreteProcess(
-        GlobalVector const& x, double const t, double const dt,
-        const int /*process_id*/) override
-    {
-        DBUG("PreTimestep HydroMechanicsProcess.");
-
-        _process_data.dt = dt;
-        _process_data.t = t;
-
-        GlobalExecutor::executeMemberOnDereferenced(
-            &HydroMechanicsLocalAssemblerInterface::preTimestep,
-            _local_assemblers, *_local_to_global_index_map, x, t, dt);
-    }
+        GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) override;
+    void preTimestepConcreteProcess(GlobalVector const& x, double const t,
+                                    double const dt,
+                                    const int /*process_id*/) override;
 
 private:
     HydroMechanicsProcessData<GlobalDim> _process_data;
-- 
GitLab