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

[MTL] Use ids view_closure simplifying code

parent fe04c976
No related branches found
No related tags found
No related merge requests found
...@@ -277,10 +277,9 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface( ...@@ -277,10 +277,9 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface(
std::for_each(sfc_elements.begin(), sfc_elements.end(), std::for_each(sfc_elements.begin(), sfc_elements.end(),
[](MeshLib::Element* e) { delete e; }); [](MeshLib::Element* e) { delete e; });
std::vector<std::size_t> id_map; auto sfc_node_ids = sfc_nodes | MeshLib::views::ids;
id_map.reserve(sfc_nodes.size()); std::vector<std::size_t> const id_map(sfc_node_ids.begin(),
std::transform(begin(sfc_nodes), end(sfc_nodes), std::back_inserter(id_map), sfc_node_ids.end());
[](MeshLib::Node* const n) { return n->getID(); });
MeshLib::Mesh* result(new MeshLib::Mesh(subsfc_mesh.getName() + "-Surface", MeshLib::Mesh* result(new MeshLib::Mesh(subsfc_mesh.getName() + "-Surface",
sfc_nodes, new_elements)); sfc_nodes, new_elements));
...@@ -500,11 +499,10 @@ std::unique_ptr<MeshLib::Mesh> getBoundaryElementsAsMesh( ...@@ -500,11 +499,10 @@ std::unique_ptr<MeshLib::Mesh> getBoundaryElementsAsMesh(
delete e; delete e;
} }
std::vector<std::size_t> nodes_to_bulk_nodes_id_map; auto boundary_node_ids = boundary_nodes | MeshLib::views::ids;
nodes_to_bulk_nodes_id_map.reserve(boundary_nodes.size());
std::transform(begin(boundary_nodes), end(boundary_nodes), std::vector<std::size_t> const nodes_to_bulk_nodes_id_map(
std::back_inserter(nodes_to_bulk_nodes_id_map), boundary_node_ids.begin(), boundary_node_ids.end());
[](MeshLib::Node* const n) { return n->getID(); });
std::unique_ptr<MeshLib::Mesh> boundary_mesh(new MeshLib::Mesh( std::unique_ptr<MeshLib::Mesh> boundary_mesh(new MeshLib::Mesh(
bulk_mesh.getName() + "-boundary", boundary_nodes, new_elements)); bulk_mesh.getName() + "-boundary", boundary_nodes, new_elements));
......
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