From cd2cc8d8ca116744533c827c613a3670c0df173e Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Sun, 23 Apr 2017 23:55:22 +0200
Subject: [PATCH] [NL] Remove single-component deriveBoundaryMap().

---
 NumLib/DOF/LocalToGlobalIndexMap.cpp          | 21 -------------------
 NumLib/DOF/LocalToGlobalIndexMap.h            | 15 -------------
 .../GenericNaturalBoundaryCondition-impl.h    |  2 +-
 .../GenericNaturalBoundaryCondition-impl.h    |  2 +-
 Tests/NumLib/LocalToGlobalIndexMap.cpp        |  4 ++--
 .../LocalToGlobalIndexMapMultiComponent.cpp   |  5 +++--
 6 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/NumLib/DOF/LocalToGlobalIndexMap.cpp b/NumLib/DOF/LocalToGlobalIndexMap.cpp
index 7be3a1c3dcf..8aa12a72be0 100644
--- a/NumLib/DOF/LocalToGlobalIndexMap.cpp
+++ b/NumLib/DOF/LocalToGlobalIndexMap.cpp
@@ -256,27 +256,6 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
     }
 }
 
-LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
-    int const variable_id,
-    int const component_id,
-    std::unique_ptr<MeshLib::MeshSubsets>&& mesh_subsets,
-    std::vector<MeshLib::Element*> const& elements) const
-{
-    DBUG("Construct reduced local to global index map.");
-    // Create a subset of the current mesh component map.
-    auto const global_component_id =
-        getGlobalComponent(variable_id, component_id);
-
-    auto mesh_component_map =
-        _mesh_component_map.getSubset({global_component_id}, *mesh_subsets);
-
-    std::vector<std::unique_ptr<MeshLib::MeshSubsets>> all_mesh_subsets;
-    all_mesh_subsets.emplace_back(std::move(mesh_subsets));
-    return new LocalToGlobalIndexMap(std::move(all_mesh_subsets),
-                                     global_component_id, elements,
-                                     std::move(mesh_component_map));
-}
-
 LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
     int const variable_id,
     std::vector<int> const& component_ids,
diff --git a/NumLib/DOF/LocalToGlobalIndexMap.h b/NumLib/DOF/LocalToGlobalIndexMap.h
index fbbba84a825..b304aae6841 100644
--- a/NumLib/DOF/LocalToGlobalIndexMap.h
+++ b/NumLib/DOF/LocalToGlobalIndexMap.h
@@ -78,25 +78,10 @@ public:
         std::vector<std::vector<MeshLib::Element*>const*> const& vec_var_elements,
         NumLib::ComponentOrder const order);
 
-    /// Derive a LocalToGlobalIndexMap constrained to a set of mesh subsets and
-    /// elements. A new mesh component map will be constructed using the passed
-    /// mesh_subsets for the given variable and component id.
-    ///
-    /// This is single-component version.
-    ///
-    /// \note The elements are not necessarily those used in the mesh_subsets.
-    LocalToGlobalIndexMap* deriveBoundaryConstrainedMap(
-        int const variable_id,
-        int const component_id,
-        std::unique_ptr<MeshLib::MeshSubsets>&& mesh_subsets,
-        std::vector<MeshLib::Element*> const& elements) const;
-
     /// Derive a LocalToGlobalIndexMap constrained to a set of mesh subsets and
     /// elements. A new mesh component map will be constructed using the passed
     /// mesh_subsets for the given variable and component ids.
     ///
-    /// This is multi-component version.
-    ///
     /// \note The elements are not necessarily those used in the mesh_subsets.
     LocalToGlobalIndexMap* deriveBoundaryConstrainedMap(
         int const variable_id,
diff --git a/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h b/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
index 7613787b65e..fe4949de469 100644
--- a/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
+++ b/ProcessLib/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
@@ -55,7 +55,7 @@ GenericNaturalBoundaryCondition<BoundaryConditionData,
     // Create local DOF table from intersected mesh subsets for the given
     // variable and component ids.
     _dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
-        variable_id, component_id, std::move(all_mesh_subsets), _elements));
+        variable_id, {component_id}, std::move(all_mesh_subsets), _elements));
 
     createLocalAssemblers<LocalAssemblerImplementation>(
         global_dim, _elements, *_dof_table_boundary, shapefunction_order, _local_assemblers,
diff --git a/ProcessLib/LIE/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h b/ProcessLib/LIE/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
index 7fe1d52b7c7..0509fe0d242 100644
--- a/ProcessLib/LIE/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
+++ b/ProcessLib/LIE/BoundaryCondition/GenericNaturalBoundaryCondition-impl.h
@@ -62,7 +62,7 @@ GenericNaturalBoundaryCondition<BoundaryConditionData,
     // Create local DOF table from intersected mesh subsets for the given
     // variable and component ids.
     _dof_table_boundary.reset(dof_table_bulk.deriveBoundaryConstrainedMap(
-        variable_id, component_id, std::move(all_mesh_subsets), _elements));
+        variable_id, {component_id}, std::move(all_mesh_subsets), _elements));
 
     createLocalAssemblers<LocalAssemblerImplementation>(
         global_dim, _elements, *_dof_table_boundary, shapefunction_order, _local_assemblers,
diff --git a/Tests/NumLib/LocalToGlobalIndexMap.cpp b/Tests/NumLib/LocalToGlobalIndexMap.cpp
index f26ed7563f0..11ce39c3e04 100644
--- a/Tests/NumLib/LocalToGlobalIndexMap.cpp
+++ b/Tests/NumLib/LocalToGlobalIndexMap.cpp
@@ -107,8 +107,8 @@ TEST_F(NumLibLocalToGlobalIndexMapTest, DISABLED_SubsetByComponent)
         new MeshLib::MeshSubsets{selected_subset.get()}};
 
     auto dof_map_subset = std::unique_ptr<NumLib::LocalToGlobalIndexMap>{
-        dof_map->deriveBoundaryConstrainedMap(1,  // variable id
-                                              0,  // component id
+        dof_map->deriveBoundaryConstrainedMap(1,    // variable id
+                                              {0},  // component id
                                               std::move(selected_component),
                                               some_elements)};
 
diff --git a/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp b/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp
index 09fc9070b4c..0c416f3679f 100644
--- a/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp
+++ b/Tests/NumLib/LocalToGlobalIndexMapMultiComponent.cpp
@@ -77,7 +77,8 @@ public:
             delete e;
     }
 
-    void initComponents(const unsigned num_components, const unsigned selected_component,
+    void initComponents(const unsigned num_components,
+                        const int selected_component,
                         const NL::ComponentOrder order)
     {
         assert(selected_component < num_components);
@@ -97,7 +98,7 @@ public:
 
         dof_map_boundary.reset(dof_map->deriveBoundaryConstrainedMap(
             0,  // variable id
-            selected_component,
+            {selected_component},
             std::move(components_boundary),
             boundary_elements));
     }
-- 
GitLab