From 2fbdd7c59d57ff6c6dd778ec30388bec5507b7ba Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Mon, 4 Jul 2016 12:32:56 +0200
Subject: [PATCH] [PL] GWFlow w/o VecMatAsm

---
 .../GroundwaterFlow/GroundwaterFlowFEM.h      | 19 +++++++++++--------
 .../GroundwaterFlowProcess.cpp                | 11 ++++-------
 .../GroundwaterFlow/GroundwaterFlowProcess.h  |  5 -----
 3 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h
index 6f8a918fff3..1c61940838c 100644
--- a/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h
+++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowFEM.h
@@ -74,10 +74,16 @@ public:
         assert(local_matrix_size == ShapeFunction::NPOINTS * NUM_NODAL_DOF);
     }
 
-    void assemble(double const /*t*/, std::vector<double> const& local_x) override
+    void assemble(std::size_t const id,
+                  NumLib::LocalToGlobalIndexMap const& dof_table,
+                  double const /*t*/, GlobalVector const& x,
+                  GlobalMatrix& /*M*/, GlobalMatrix& K,
+                  GlobalVector& b) override
     {
         _localA.setZero();
         _localRhs.setZero();
+        auto const indices = NumLib::detail::getIndices(id, dof_table);
+        auto const local_x = NumLib::detail::getLocalNodalDOFs(x, indices);
 
         IntegrationMethod integration_method(_integration_order);
         unsigned const n_integration_points = integration_method.getNumberOfPoints();
@@ -100,14 +106,11 @@ public:
                 _darcy_velocities[d][ip] = darcy_velocity[d];
             }
         }
-    }
 
-    void addToGlobal(NumLib::LocalToGlobalIndexMap::RowColumnIndices const& indices,
-        GlobalMatrix& /*M*/, GlobalMatrix& K, GlobalVector& b)
-        const override
-    {
-        K.add(indices, _localA);
-        b.add(indices.rows, _localRhs);
+        auto const r_c_indices =
+            NumLib::LocalToGlobalIndexMap::RowColumnIndices(indices, indices);
+        K.add(r_c_indices, _localA);
+        b.add(indices, _localRhs);
     }
 
     Eigen::Map<const Eigen::RowVectorXd>
diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp
index 71448c9c25d..a1e402fb086 100644
--- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp
+++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp
@@ -50,14 +50,11 @@ void GroundwaterFlowProcess::initializeConcreteProcess(
     MeshLib::Mesh const& mesh,
     unsigned const integration_order)
 {
-    DBUG("Create global assembler.");
-    _global_assembler.reset(new GlobalAssembler(dof_table));
-
     ProcessLib::createLocalAssemblers<LocalAssemblerData>(
         mesh.getDimension(), mesh.getElements(), dof_table, integration_order,
         _local_assemblers, _process_data);
 
-    // TOOD Later on the DOF table can change during the simulation!
+    // TODO Later on the DOF table can change during the simulation!
     _extrapolator.reset(new ExtrapolatorImplementation(
         Base::getMatrixSpecifications(), *Base::_local_to_global_index_map));
 
@@ -91,9 +88,9 @@ void GroundwaterFlowProcess::assembleConcreteProcess(const double t,
     DBUG("Assemble GroundwaterFlowProcess.");
 
     // Call global assembler for each local assembly item.
-    GlobalExecutor::executeMemberDereferenced(*_global_assembler,
-                                              &GlobalAssembler::assemble,
-                                              _local_assemblers, t, x, M, K, b);
+    GlobalExecutor::executeMemberOnDereferenced(
+        &GroundwaterFlowLocalAssemblerInterface::assemble,
+        _local_assemblers, *_local_to_global_index_map, t, x, M, K, b);
 }
 
 }   // namespace GroundwaterFlow
diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h
index d4b84bac2b6..adaaf66d597 100644
--- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h
+++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h
@@ -42,10 +42,6 @@ public:
     //! @}
 
 private:
-    using GlobalAssembler = NumLib::VectorMatrixAssembler<
-        GroundwaterFlowLocalAssemblerInterface,
-        NumLib::ODESystemTag::FirstOrderImplicitQuasilinear>;
-
     using ExtrapolatorInterface =
         NumLib::Extrapolator<IntegrationPointValue,
                              GroundwaterFlowLocalAssemblerInterface>;
@@ -64,7 +60,6 @@ private:
 
     GroundwaterFlowProcessData _process_data;
 
-    std::unique_ptr<GlobalAssembler> _global_assembler;
     std::vector<std::unique_ptr<GroundwaterFlowLocalAssemblerInterface>>
         _local_assemblers;
 
-- 
GitLab