diff --git a/MeshLib/Elements/HexRule8.cpp b/MeshLib/Elements/HexRule8.cpp index b049b0b075bcd8130316ea08036f8aaccea3ae0e..0264ac8d9af5d472a2f56ee166ea8efaa40f9796 100644 --- a/MeshLib/Elements/HexRule8.cpp +++ b/MeshLib/Elements/HexRule8.cpp @@ -9,6 +9,8 @@ #include "HexRule8.h" +#include <array> + #include "logog/include/logog.hpp" #include "GeoLib/AnalyticalGeometry.h" @@ -53,9 +55,8 @@ const Element* HexRule8::getFace(const Element* e, unsigned i) { if (i < n_faces) { - unsigned nFaceNodes (getNFaceNodes(i)); - Node** nodes = new Node*[nFaceNodes]; - for (unsigned j=0; j<nFaceNodes; j++) + std::array<Node*, 4> nodes; + for (unsigned j=0; j<4; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); return new Quad(nodes); } diff --git a/MeshLib/Elements/TetRule4.cpp b/MeshLib/Elements/TetRule4.cpp index f95ef2b37de864038ffda09f7eb7c92f13ea1e08..9ecb8868e1a50fe163072c043df96eac85091987 100644 --- a/MeshLib/Elements/TetRule4.cpp +++ b/MeshLib/Elements/TetRule4.cpp @@ -9,6 +9,8 @@ #include "TetRule4.h" +#include <array> + #include "logog/include/logog.hpp" #include "GeoLib/AnalyticalGeometry.h" @@ -43,11 +45,10 @@ const unsigned TetRule4::edge_nodes[6][2] = const Element* TetRule4::getFace(const Element* e, unsigned i) { - if (i<e->getNFaces()) + if (i<n_faces) { - unsigned nFaceNodes (e->getNFaceNodes(i)); - Node** nodes = new Node*[nFaceNodes]; - for (unsigned j=0; j<nFaceNodes; j++) + std::array<Node*,3> nodes; + for (unsigned j=0; j<3; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); return new Tri(nodes); }