diff --git a/libsrc/meshing/meshclass.cpp b/libsrc/meshing/meshclass.cpp index d9e50bde..9acfacaa 100644 --- a/libsrc/meshing/meshclass.cpp +++ b/libsrc/meshing/meshclass.cpp @@ -5817,34 +5817,17 @@ namespace netgen void Mesh :: ComputeNVertices () { - int i, j, nv; - int ne = GetNE(); - // int nse = GetNSE(); - numvertices = 0; - for (i = 1; i <= ne; i++) - { - const Element & el = VolumeElement(i); - nv = el.GetNV(); - for (j = 0; j < nv; j++) - if (el[j] > numvertices) - numvertices = el[j]; - } - /* - for (i = 1; i <= nse; i++) - { - const Element2d & el = SurfaceElement(i); - nv = el.GetNV(); - for (j = 1; j <= nv; j++) - if (el.PNum(j) > numvertices) - numvertices = el.PNum(j); - } - */ - for (auto & el : SurfaceElements()) + + for (const Element & el : VolumeElements()) + for (PointIndex v : el.Vertices()) + if (v > numvertices) numvertices = v; + + for (const Element2d & el : SurfaceElements()) for (PointIndex v : el.Vertices()) if (v > numvertices) numvertices = v; - numvertices += 1- PointIndex::BASE; + numvertices += 1-PointIndex::BASE; } int Mesh :: GetNV () const diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 5af489fd..41fdb11a 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -751,6 +751,8 @@ namespace netgen FlatArray PNums () const { return FlatArray (np, &pnum[0]); } + FlatArray Vertices() const { return { GetNV(), &pnum[0] }; } + /// PointIndex & PNum (int i) { return pnum[i-1]; } ///