From d24e68e306a981193791ae88fbddb5e823742609 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Fri, 17 Jan 2020 11:47:36 +0100 Subject: [PATCH] [MeL] Remove templated copyElement from I/F. This function has internal usage only. --- .../MeshEditing/DuplicateMeshComponents.cpp | 26 ++++++++++--------- MeshLib/MeshEditing/DuplicateMeshComponents.h | 6 ----- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp index ab9220e73a7..cbe89d64d14 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp @@ -47,6 +47,20 @@ std::vector<MeshLib::Element*> copyElementVector( return new_elements; } +/// Copies an element without change, using the nodes vector from the result +/// mesh. +template <typename E> +MeshLib::Element* copyElement(MeshLib::Element const* const element, + const std::vector<MeshLib::Node*>& nodes) +{ + auto** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()]; + for (unsigned i = 0; i < element->getNumberOfNodes(); ++i) + { + new_nodes[i] = nodes[element->getNode(i)->getID()]; + } + return new E(new_nodes); +} + MeshLib::Element* copyElement(MeshLib::Element const* const element, const std::vector<MeshLib::Node*>& nodes) { @@ -83,18 +97,6 @@ MeshLib::Element* copyElement(MeshLib::Element const* const element, return nullptr; } -template <typename E> -MeshLib::Element* copyElement(MeshLib::Element const* const element, - const std::vector<MeshLib::Node*>& nodes) -{ - auto** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()]; - for (unsigned i = 0; i < element->getNumberOfNodes(); ++i) - { - new_nodes[i] = nodes[element->getNode(i)->getID()]; - } - return new E(new_nodes); -} - std::vector<MeshLib::Element*> cloneElements( std::vector<MeshLib::Element*> const& elements) { diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.h b/MeshLib/MeshEditing/DuplicateMeshComponents.h index 0214d5d4546..dc2de0a784e 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.h +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.h @@ -41,12 +41,6 @@ std::vector<MeshLib::Element*> copyElementVector( MeshLib::Element* copyElement(MeshLib::Element const* const element, const std::vector<MeshLib::Node*>& nodes); -/// Copies an element without change, using the nodes vector from the result -/// mesh. -template <typename E> -MeshLib::Element* copyElement(MeshLib::Element const* const element, - const std::vector<MeshLib::Node*>& nodes); - /// Clones a vector of elements using the Element::clone() function. std::vector<MeshLib::Element*> cloneElements( std::vector<MeshLib::Element*> const& elements); -- GitLab