diff --git a/MeshLib/MeshSubset.h b/MeshLib/MeshSubset.h index 63f4b7b78001c1be789a6d9631a0768b39f7fe84..b5fbee28c61793ecabadb3ab259557a36305d689 100644 --- a/MeshLib/MeshSubset.h +++ b/MeshLib/MeshSubset.h @@ -103,8 +103,12 @@ public: return _msh.getElements().cend(); } + /// Constructs a new mesh subset which is a set intersection of the current + /// nodes and the provided vector of nodes. + /// An empty mesh subset may be returned, not a nullptr, in case of empty + /// intersection or empty input vector. MeshSubset* - setIntersectionByNodes(std::vector<Node*> const& nodes) const + getIntersectionByNodes(std::vector<Node*> const& nodes) const { std::vector<Node*>* active_nodes = new std::vector<Node*>; diff --git a/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp b/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp index 8bc40d0a4395166b7f5d81b80c0dc090ce521306..cd09666aab8b7de9054162502141d1a8c2a4282a 100644 --- a/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp +++ b/Tests/AssemblerLib/LocalToGlobalIndexMap.cpp @@ -91,7 +91,7 @@ TEST_F(AssemblerLibLocalToGlobalIndexMapTest, SubsetByComponent) std::vector<MeshLib::Node*> selected_nodes = MeshLib::selectNodes(some_elements); MeshLib::MeshSubset const* const selected_subset = - nodesSubset->setIntersectionByNodes(selected_nodes); + nodesSubset->getIntersectionByNodes(selected_nodes); std::vector<MeshLib::MeshSubsets*> selected_components; selected_components.emplace_back(new MeshLib::MeshSubsets(selected_subset)); selected_components.emplace_back(new MeshLib::MeshSubsets(selected_subset)); diff --git a/Tests/MeshLib/MeshSubsets.cpp b/Tests/MeshLib/MeshSubsets.cpp index 933fa8de36007fc61c409b89ded2d53eadecda23..eeeb20bcdf33ece13237005a0688f91a1be3d1d0 100644 --- a/Tests/MeshLib/MeshSubsets.cpp +++ b/Tests/MeshLib/MeshSubsets.cpp @@ -34,7 +34,7 @@ TEST(MeshLibMeshSubsets, UniqueMeshIds) } -TEST(MeshLibMeshSubsets, SetIntersectionByNodes) +TEST(MeshLibMeshSubsets, GetIntersectionByNodes) { Mesh const* const mesh = MeshGenerator::generateLineMesh(1., 10); MeshSubset all_nodes_mesh_subset(*mesh, mesh->getNodes()); @@ -47,7 +47,7 @@ TEST(MeshLibMeshSubsets, SetIntersectionByNodes) const_cast<Node*>(mesh->getNode(5)), const_cast<Node*>(mesh->getNode(7)) }); MeshSubset const* const some_nodes_mesh_subset = - all_nodes_mesh_subset.setIntersectionByNodes(some_nodes); + all_nodes_mesh_subset.getIntersectionByNodes(some_nodes); // Check sizes. ASSERT_EQ(some_nodes.size(), some_nodes_mesh_subset->getNNodes());