Skip to content
Snippets Groups Projects
Commit 19508d76 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MeL] Rename and document searchByElementIDs.

parent b3be7658
No related branches found
No related tags found
No related merge requests found
...@@ -63,7 +63,7 @@ MeshLib::Mesh* removeElements(const MeshLib::Mesh& mesh, const std::vector<std:: ...@@ -63,7 +63,7 @@ MeshLib::Mesh* removeElements(const MeshLib::Mesh& mesh, const std::vector<std::
// delete unused nodes // delete unused nodes
NodeSearch ns(mesh); NodeSearch ns(mesh);
ns.searchByElementIDs(removed_element_ids); ns.markNodesConnectedToElements(removed_element_ids);
auto &removed_node_ids(ns.getSearchedNodeIDs()); auto &removed_node_ids(ns.getSearchedNodeIDs());
INFO("Removing total %d nodes...", removed_node_ids.size()); INFO("Removing total %d nodes...", removed_node_ids.size());
for (auto nodeid : removed_node_ids) for (auto nodeid : removed_node_ids)
......
...@@ -24,7 +24,8 @@ NodeSearch::NodeSearch(const MeshLib::Mesh &mesh) ...@@ -24,7 +24,8 @@ NodeSearch::NodeSearch(const MeshLib::Mesh &mesh)
{ {
} }
std::vector<std::size_t> NodeSearch::searchByElementIDsMatchAllConnectedElements(const std::vector<std::size_t> &elements) std::size_t NodeSearch::markNodesConnectedToElements(
const std::vector<std::size_t> &elements)
{ {
// Find out by how many elements a node would be removed. // Find out by how many elements a node would be removed.
// //
...@@ -49,7 +50,9 @@ std::vector<std::size_t> NodeSearch::searchByElementIDsMatchAllConnectedElements ...@@ -49,7 +50,9 @@ std::vector<std::size_t> NodeSearch::searchByElementIDsMatchAllConnectedElements
if (node_marked_counts[i] == _mesh.getNode(i)->getElements().size()) if (node_marked_counts[i] == _mesh.getNode(i)->getElements().size())
connected_nodes.push_back(i); connected_nodes.push_back(i);
} }
return connected_nodes;
this->updateUnion(connected_nodes);
return connected_nodes.size();
} }
std::size_t NodeSearch::searchUnused() std::size_t NodeSearch::searchUnused()
......
...@@ -30,14 +30,8 @@ public: ...@@ -30,14 +30,8 @@ public:
const std::vector<std::size_t>& getSearchedNodeIDs() const {return _marked_nodes; } const std::vector<std::size_t>& getSearchedNodeIDs() const {return _marked_nodes; }
/// Marks all nodes connected to any of the given elements ids. /// Marks all nodes connected to any of the given elements ids.
std::size_t searchByElementIDs(const std::vector<std::size_t> &element_ids) /// \return number of connected nodes.
{ std::size_t markNodesConnectedToElements(const std::vector<std::size_t> &element_ids);
std::vector<std::size_t> connected_nodes =
searchByElementIDsMatchAllConnectedElements(element_ids);
this->updateUnion(connected_nodes);
return connected_nodes.size();
}
/// Marks all unused nodes /// Marks all unused nodes
std::size_t searchUnused(); std::size_t searchUnused();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment