From fbc1c33c183185d1392ba5c1368c82dfa04a7eff Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Tue, 25 Apr 2017 16:53:14 +0200
Subject: [PATCH] [T] Improve constness; remove unnecessary pointers

---
 Tests/NumLib/TestMeshComponentMap.cpp | 30 +++++++++++----------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/Tests/NumLib/TestMeshComponentMap.cpp b/Tests/NumLib/TestMeshComponentMap.cpp
index 14b6f5b9a59..71bf2b83790 100644
--- a/Tests/NumLib/TestMeshComponentMap.cpp
+++ b/Tests/NumLib/TestMeshComponentMap.cpp
@@ -157,15 +157,14 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_SubsetOfNodesByComponent)
     for (std::size_t id : ids)
         some_nodes.push_back(const_cast<MeshLib::Node*>(mesh->getNode(id)));
 
-    MeshLib::MeshSubset some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubset const some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubsets const selected_component{&some_nodes_mesh_subset};
 
     std::size_t const selected_component_id = 1;
-    auto selected_component = std::unique_ptr<MeshLib::MeshSubsets>{
-        new MeshLib::MeshSubsets{&some_nodes_mesh_subset}};
 
     // Subset the original cmap.
     MeshComponentMap cmap_subset =
-        cmap->getSubset({selected_component_id}, *selected_component);
+        cmap->getSubset({selected_component_id}, selected_component);
 
     // Check number of components as selected
     ASSERT_EQ(ids.size(), cmap_subset.dofSizeWithGhosts());
@@ -194,15 +193,14 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_SubsetOfNodesByLocation)
     for (std::size_t id : ids)
         some_nodes.push_back(const_cast<MeshLib::Node*>(mesh->getNode(id)));
 
-    MeshLib::MeshSubset some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubset const some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubsets const selected_component{&some_nodes_mesh_subset};
 
     std::size_t const selected_component_id = 1;
-    auto selected_component = std::unique_ptr<MeshLib::MeshSubsets>{
-        new MeshLib::MeshSubsets{&some_nodes_mesh_subset}};
 
     // Subset the original cmap.
     MeshComponentMap cmap_subset =
-        cmap->getSubset({selected_component_id}, *selected_component);
+        cmap->getSubset({selected_component_id}, selected_component);
 
     // Check number of components as selected
     ASSERT_EQ(ids.size(), cmap_subset.dofSizeWithGhosts());
@@ -231,15 +229,13 @@ TEST_F(NumLibMeshComponentMapTest, DISABLED_MulticomponentVariable)
     for (std::size_t id : ids)
         some_nodes.push_back(const_cast<MeshLib::Node*>(mesh->getNode(id)));
 
-    MeshLib::MeshSubset some_nodes_mesh_subset(*mesh, &some_nodes);
-
-    auto selected_component = std::unique_ptr<MeshLib::MeshSubsets>{
-        new MeshLib::MeshSubsets{&some_nodes_mesh_subset}};
+    MeshLib::MeshSubset const some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubsets const selected_component{&some_nodes_mesh_subset};
 
     // Subset the original cmap.
     std::vector<std::size_t> const selected_component_ids = {0, 1};
     MeshComponentMap cmap_subset =
-        cmap->getSubset(selected_component_ids, *selected_component);
+        cmap->getSubset(selected_component_ids, selected_component);
 
     // Check number of components as selected
     ASSERT_EQ(ids.size() * selected_component_ids.size(),
@@ -271,15 +267,13 @@ TEST_F(NumLibMeshComponentMapTest,
     for (std::size_t id : ids)
         some_nodes.push_back(const_cast<MeshLib::Node*>(mesh->getNode(id)));
 
-    MeshLib::MeshSubset some_nodes_mesh_subset(*mesh, &some_nodes);
-
-    auto selected_component = std::unique_ptr<MeshLib::MeshSubsets>{
-        new MeshLib::MeshSubsets{&some_nodes_mesh_subset}};
+    MeshLib::MeshSubset const some_nodes_mesh_subset(*mesh, &some_nodes);
+    MeshLib::MeshSubsets const selected_component{&some_nodes_mesh_subset};
 
     // Subset the original cmap.
     std::vector<std::size_t> const selected_component_ids = {1};
     MeshComponentMap cmap_subset =
-        cmap->getSubset(selected_component_ids, *selected_component);
+        cmap->getSubset(selected_component_ids, selected_component);
 
     // Check number of components as selected
     ASSERT_EQ(ids.size() * selected_component_ids.size(),
-- 
GitLab