From ce5f6d695ce6b3187002178edeb7ad7ac400abba Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Wed, 1 Jan 2025 15:53:23 +0100 Subject: [PATCH] all tests passing for PointIndex::BASE=0 --- libsrc/include/nginterface_v2_impl.hpp | 2 +- libsrc/meshing/meshtype.hpp | 2 +- libsrc/meshing/topology.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libsrc/include/nginterface_v2_impl.hpp b/libsrc/include/nginterface_v2_impl.hpp index d0db9a2b..305c0073 100644 --- a/libsrc/include/nginterface_v2_impl.hpp +++ b/libsrc/include/nginterface_v2_impl.hpp @@ -327,7 +327,7 @@ template <> NGX_INLINE DLL_HEADER const Ng_Node<2> Ngx_Mesh :: GetNode<2> (int n { Ng_Node<2> node; node.vertices.ptr = (const int*)mesh->GetTopology().GetFaceVerticesPtr(nr); - node.vertices.nv = (node.vertices.ptr[3] == 0) ? 3 : 4; + node.vertices.nv = (node.vertices.ptr[3]+1 == PointIndex::BASE) ? 3 : 4; node.surface_el = mesh->GetTopology().GetFace2SurfaceElement (nr+1)-1; return node; } diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 91c5123a..4f988b81 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -244,7 +244,7 @@ namespace netgen - class PointIndex : public Index + class PointIndex : public Index { public: using Index::Index; diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 2af9c76b..622512fb 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -160,7 +160,7 @@ namespace netgen { // triangle PointIndices<4> face(el[elfaces[j][0]], el[elfaces[j][1]], - el[elfaces[j][2]], 0); + el[elfaces[j][2]], PointIndex(PointIndex::INVALID)); [[maybe_unused]] int facedir = 0; @@ -266,7 +266,7 @@ namespace netgen PointIndices<4> face(el.PNum(elfaces[0][0]), el.PNum(elfaces[0][1]), - el.PNum(elfaces[0][2]),0); + el.PNum(elfaces[0][2]), PointIndex(PointIndex::INVALID)); // facedir = 0; if (face[0] > face[1]) @@ -1161,7 +1161,7 @@ namespace netgen size_t pos; if (vert2face.PositionCreate(face, pos)) { - face2vert[nfa] = { face[0], face[1], face[2], 0 }; // i4; + face2vert[nfa] = { face[0], face[1], face[2], PointIndex::BASE-1 }; // i4; vert2face.SetData (pos, face, nfa); nfa++; } @@ -2136,7 +2136,7 @@ namespace netgen if (elfaces[j][3] < 0) { // triangle INDEX_4 face(el[elfaces[j][0]], el[elfaces[j][1]], - el[elfaces[j][2]], 0); + el[elfaces[j][2]], PointIndex::BASE-1 ); int facedir = 0; if (face.I1() > face.I2()) @@ -2203,7 +2203,7 @@ namespace netgen if (elfaces[j][3] < 0) { // triangle INDEX_4 face(el[elfaces[j][0]], el[elfaces[j][1]], - el[elfaces[j][2]], 0); + el[elfaces[j][2]], PointIndex(PointIndex::INVALID)); int facedir = 0; if (face.I1() > face.I2()) @@ -2272,7 +2272,7 @@ namespace netgen vertices.SetSize(4); for (int i = 0; i < 4; i++) vertices[i] = face2vert[fnr-1][i]; - if (vertices[3] == 0) + if (vertices[3]+1==PointIndex::BASE) vertices.SetSize(3); }