diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp index ab9220e73a789d910a9500d8564c914efa2254ae..cbe89d64d147984521e6d08b3b3bbbad997a4125 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 0214d5d4546b1d849d87d87e7933ccb5dedcee36..dc2de0a784edca50b32d4171f58b065bf39ca427 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);