diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp index cbe89d64d147984521e6d08b3b3bbbad997a4125..154969bc1458d32f7ca615bf7688e54b4a4350da 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp @@ -64,37 +64,28 @@ MeshLib::Element* copyElement(MeshLib::Element const* const element, MeshLib::Element* copyElement(MeshLib::Element const* const element, const std::vector<MeshLib::Node*>& nodes) { - if (element->getGeomType() == MeshElemType::LINE) + switch (element->getGeomType()) { - return copyElement<MeshLib::Line>(element, nodes); + case MeshElemType::LINE: + return copyElement<MeshLib::Line>(element, nodes); + case MeshElemType::TRIANGLE: + return copyElement<MeshLib::Tri>(element, nodes); + case MeshElemType::QUAD: + return copyElement<MeshLib::Quad>(element, nodes); + case MeshElemType::TETRAHEDRON: + return copyElement<MeshLib::Tet>(element, nodes); + case MeshElemType::HEXAHEDRON: + return copyElement<MeshLib::Hex>(element, nodes); + case MeshElemType::PYRAMID: + return copyElement<MeshLib::Pyramid>(element, nodes); + case MeshElemType::PRISM: + return copyElement<MeshLib::Prism>(element, nodes); + default: + { + ERR ("Error: Unknown element type."); + return nullptr; + } } - if (element->getGeomType() == MeshElemType::TRIANGLE) - { - return copyElement<MeshLib::Tri>(element, nodes); - } - if (element->getGeomType() == MeshElemType::QUAD) - { - return copyElement<MeshLib::Quad>(element, nodes); - } - if (element->getGeomType() == MeshElemType::TETRAHEDRON) - { - return copyElement<MeshLib::Tet>(element, nodes); - } - if (element->getGeomType() == MeshElemType::HEXAHEDRON) - { - return copyElement<MeshLib::Hex>(element, nodes); - } - if (element->getGeomType() == MeshElemType::PYRAMID) - { - return copyElement<MeshLib::Pyramid>(element, nodes); - } - if (element->getGeomType() == MeshElemType::PRISM) - { - return copyElement<MeshLib::Prism>(element, nodes); - } - - ERR("Error: Unknown element type."); - return nullptr; } std::vector<MeshLib::Element*> cloneElements(