Skip to content
Snippets Groups Projects
Commit 7b95c514 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MeL/SurfaceExtraction] Substitute get2DSurfaceNodes.

parent a8f001e2
No related branches found
No related tags found
No related merge requests found
...@@ -96,10 +96,8 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface( ...@@ -96,10 +96,8 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface(
return nullptr; return nullptr;
} }
std::vector<MeshLib::Node*> sfc_nodes; auto [sfc_nodes, node_id_map] =
std::vector<std::size_t> node_id_map(subsfc_mesh.getNumberOfNodes()); createNodesFromElements(sfc_elements, subsfc_mesh.getNumberOfNodes());
get2DSurfaceNodes(sfc_nodes, subsfc_mesh.getNumberOfNodes(), sfc_elements,
node_id_map);
// create new elements vector with newly created nodes (and delete // create new elements vector with newly created nodes (and delete
// temp-elements) // temp-elements)
...@@ -272,31 +270,6 @@ void MeshSurfaceExtraction::get2DSurfaceElements( ...@@ -272,31 +270,6 @@ void MeshSurfaceExtraction::get2DSurfaceElements(
} }
} }
void MeshSurfaceExtraction::get2DSurfaceNodes(
std::vector<MeshLib::Node*>& sfc_nodes, std::size_t n_all_nodes,
const std::vector<MeshLib::Element*>& sfc_elements,
std::vector<std::size_t>& node_id_map)
{
std::vector<const MeshLib::Node*> tmp_nodes(n_all_nodes, nullptr);
for (auto const* elem : sfc_elements)
{
for (unsigned j = 0; j < elem->getNumberOfBaseNodes(); ++j)
{
const MeshLib::Node* node(elem->getNode(j));
tmp_nodes[node->getID()] = node;
}
}
const std::size_t nNodes(tmp_nodes.size());
for (unsigned i = 0; i < nNodes; ++i)
{
if (tmp_nodes[i])
{
node_id_map[i] = sfc_nodes.size();
sfc_nodes.push_back(new MeshLib::Node(*tmp_nodes[i]));
}
}
}
std::vector<MeshLib::Node*> MeshSurfaceExtraction::getSurfaceNodes( std::vector<MeshLib::Node*> MeshSurfaceExtraction::getSurfaceNodes(
const MeshLib::Mesh& mesh, const MathLib::Vector3& dir, double angle) const MeshLib::Mesh& mesh, const MathLib::Vector3& dir, double angle)
{ {
...@@ -308,10 +281,8 @@ std::vector<MeshLib::Node*> MeshSurfaceExtraction::getSurfaceNodes( ...@@ -308,10 +281,8 @@ std::vector<MeshLib::Node*> MeshSurfaceExtraction::getSurfaceNodes(
mesh.getElements(), sfc_elements, element_to_bulk_element_id_map, mesh.getElements(), sfc_elements, element_to_bulk_element_id_map,
element_to_bulk_face_id_map, dir, angle, mesh.getDimension()); element_to_bulk_face_id_map, dir, angle, mesh.getDimension());
std::vector<MeshLib::Node*> sfc_nodes; auto [sfc_nodes, node_id_map] =
std::vector<std::size_t> node_id_map(mesh.getNumberOfNodes()); createNodesFromElements(sfc_elements, mesh.getNumberOfNodes());
get2DSurfaceNodes(sfc_nodes, mesh.getNumberOfNodes(), sfc_elements,
node_id_map);
for (auto e : sfc_elements) for (auto e : sfc_elements)
{ {
......
...@@ -112,12 +112,6 @@ private: ...@@ -112,12 +112,6 @@ private:
createSurfaceElements(MeshLib::Mesh const& bulk_mesh); createSurfaceElements(MeshLib::Mesh const& bulk_mesh);
/// Functionality needed for getSurfaceNodes() and getMeshSurface() /// Functionality needed for getSurfaceNodes() and getMeshSurface()
static void get2DSurfaceNodes(
std::vector<MeshLib::Node*>& sfc_nodes,
std::size_t n_all_nodes,
const std::vector<MeshLib::Element*>& sfc_elements,
std::vector<std::size_t>& node_id_map);
/// Creates the element vector for the 2d surface mesh /// Creates the element vector for the 2d surface mesh
static std::vector<MeshLib::Element*> createSfcElementVector( static std::vector<MeshLib::Element*> createSfcElementVector(
std::vector<MeshLib::Element*> const& sfc_elements, std::vector<MeshLib::Element*> const& sfc_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