From a04f0168839817b56e90f83e5b9bdbdad5ac118c Mon Sep 17 00:00:00 2001
From: Tom Fischer <thomas.fischer@ufz.de>
Date: Thu, 1 Aug 2024 12:55:44 +0200
Subject: [PATCH] [T/NL] Adjust SubsetOfNodesBy{Component/Location} tests for
 MeshComponentMap

Due to removal of the possibility of the selection of components in
MeshComponentMap::getSubset()
---
 Tests/NumLib/TestMeshComponentMap.cpp | 60 ++++-----------------------
 1 file changed, 7 insertions(+), 53 deletions(-)

diff --git a/Tests/NumLib/TestMeshComponentMap.cpp b/Tests/NumLib/TestMeshComponentMap.cpp
index fcf3e5956ab..e99a883a844 100644
--- a/Tests/NumLib/TestMeshComponentMap.cpp
+++ b/Tests/NumLib/TestMeshComponentMap.cpp
@@ -183,14 +183,12 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_SubsetOfNodesByComponent)
     MeshLib::MeshSubset const selected_component(boundary_mesh,
                                                  boundary_mesh.getNodes());
 
-    int const selected_component_id = 1;
-
     // Subset the original cmap.
-    MeshComponentMap const cmap_subset = cmap->getSubset(
-        components, selected_component, {selected_component_id});
+    MeshComponentMap const cmap_subset =
+        cmap->getSubset(components, selected_component);
 
     // Check number of components as selected
-    ASSERT_EQ(ids.size(), cmap_subset.dofSizeWithGhosts());
+    ASSERT_EQ(ids.size() * components.size(), cmap_subset.dofSizeWithGhosts());
 
     // .. and the content of the subset.
     for (auto const* n : boundary_mesh.getNodes())
@@ -221,14 +219,12 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_SubsetOfNodesByLocation)
     MeshLib::MeshSubset const selected_component(boundary_mesh,
                                                  boundary_mesh.getNodes());
 
-    int const selected_component_id = 1;
-
     // Subset the original cmap.
-    MeshComponentMap const cmap_subset = cmap->getSubset(
-        components, selected_component, {selected_component_id});
+    MeshComponentMap const cmap_subset =
+        cmap->getSubset(components, selected_component);
 
     // Check number of components as selected
-    ASSERT_EQ(ids.size(), cmap_subset.dofSizeWithGhosts());
+    ASSERT_EQ(ids.size() * components.size(), cmap_subset.dofSizeWithGhosts());
 
     // .. and the content of the subset.
     for (auto const* n : boundary_mesh.getNodes())
@@ -262,49 +258,7 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_MulticomponentVariable)
     // Subset the original cmap.
     std::vector<int> const selected_component_ids = {0, 1};
     MeshComponentMap const cmap_subset =
-        cmap->getSubset(components, selected_component, selected_component_ids);
-
-    // Check number of components as selected
-    ASSERT_EQ(ids.size() * selected_component_ids.size(),
-              cmap_subset.dofSizeWithGhosts());
-
-    // .. and the content of the subset.
-    for (auto const* n : boundary_mesh.getNodes())
-    {
-        std::size_t const id = n->getID();
-        Location const l_bulk(mesh->getID(), MeshItemType::Node, ids[id]);
-        Location const l_boundary(boundary_mesh.getID(), MeshItemType::Node,
-                                  id);
-        for (auto const& c : selected_component_ids)
-        {
-            EXPECT_EQ(cmap->getGlobalIndex(l_bulk, c),
-                      cmap_subset.getGlobalIndex(l_boundary, c));
-        }
-    }
-}
-
-#ifndef USE_PETSC
-TEST_F(NumLibMeshComponentMapTest, MulticomponentVariableSingleComponent)
-#else
-TEST_F(NumLibMeshComponentMapTest,
-       DISABLED_MulticomponentVariableSingleComponent)
-#endif
-{
-    cmap =
-        new MeshComponentMap(components, NumLib::ComponentOrder::BY_LOCATION);
-
-    // Select some nodes from the full mesh.
-    std::vector<std::size_t> const ids = {0, 5, 9};
-    // A smaller mesh without elements containing the selected nodes.
-    auto boundary_mesh = createMeshFromSelectedNodes(*mesh, ids);
-
-    MeshLib::MeshSubset const selected_component(boundary_mesh,
-                                                 boundary_mesh.getNodes());
-
-    // Subset the original cmap.
-    std::vector<int> const selected_component_ids = {1};
-    MeshComponentMap const cmap_subset =
-        cmap->getSubset(components, selected_component, selected_component_ids);
+        cmap->getSubset(components, selected_component);
 
     // Check number of components as selected
     ASSERT_EQ(ids.size() * selected_component_ids.size(),
-- 
GitLab