From c46329ebf77534054632acb5cf12d25f7c421faf Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 2 Apr 2013 20:29:53 +0000 Subject: [PATCH] improved usage of PointIndex --- libsrc/meshing/adfront3.cpp | 29 ++- libsrc/meshing/adfront3.hpp | 4 +- libsrc/meshing/bisect.cpp | 383 +++++++++++++++---------------- libsrc/meshing/boundarylayer.cpp | 4 +- libsrc/meshing/delaunay.cpp | 81 +++---- libsrc/meshing/delaunay2d.cpp | 4 +- libsrc/meshing/geomsearch.cpp | 2 +- libsrc/meshing/geomsearch.hpp | 4 +- libsrc/meshing/improve2.cpp | 3 +- libsrc/meshing/improve2gen.cpp | 2 +- libsrc/meshing/meshclass.hpp | 25 +- libsrc/meshing/meshfunc.cpp | 13 +- libsrc/meshing/meshing2.cpp | 3 +- libsrc/meshing/meshing3.cpp | 12 +- libsrc/meshing/meshtype.hpp | 23 +- libsrc/meshing/refine.cpp | 28 +-- libsrc/meshing/secondorder.cpp | 10 +- libsrc/meshing/smoothing2.5.cpp | 3 +- libsrc/meshing/smoothing3.cpp | 53 +++-- libsrc/meshing/specials.cpp | 4 +- libsrc/meshing/topology.cpp | 10 - libsrc/meshing/topology.hpp | 18 +- libsrc/meshing/zrefine.cpp | 10 +- 23 files changed, 334 insertions(+), 394 deletions(-) diff --git a/libsrc/meshing/adfront3.cpp b/libsrc/meshing/adfront3.cpp index e8863d9f..1499b2a1 100644 --- a/libsrc/meshing/adfront3.cpp +++ b/libsrc/meshing/adfront3.cpp @@ -86,8 +86,7 @@ AdFront3 :: ~AdFront3 () void AdFront3 :: GetPoints (Array > & apoints) const { - for (PointIndex pi = PointIndex::BASE; - pi < points.Size()+PointIndex::BASE; pi++) + for (PointIndex pi = points.Begin(); pi < points.End(); pi++) apoints.Append (points[pi].P()); } @@ -106,7 +105,8 @@ PointIndex AdFront3 :: AddPoint (const Point<3> & p, PointIndex globind) else { points.Append (FrontPoint3 (p, globind)); - return points.Size()-1+PointIndex::BASE; + return --points.End(); + // return points.Size()-1+PointIndex::BASE; } } @@ -301,9 +301,8 @@ void AdFront3 :: RebuildInternalTables () int np = points.Size(); - for (int i = PointIndex::BASE; - i < np+PointIndex::BASE; i++) - points[i].cluster = i; + for (PointIndex pi = points.Begin(); pi < points.End(); pi++) + points[pi].cluster = pi; NgProfiler::StopTimer (timer_a); NgProfiler::StartTimer (timer_b); @@ -400,9 +399,8 @@ void AdFront3 :: RebuildInternalTables () { for (int i = 1; i <= faces.Size(); i++) faces.Elem(i).cluster = 1; - for (int i = PointIndex::BASE; - i < points.Size()+PointIndex::BASE; i++) - points[i].cluster = 1; + for (PointIndex pi = points.Begin(); pi < points.End(); pi++) + points[pi].cluster = 1; } if (hashon) @@ -508,7 +506,6 @@ int AdFront3 :: GetLocals (int fstind, INDEX i, j; PointIndex pstind; - INDEX pi; Point3d midp, p0; // static Array invpindex; @@ -591,7 +588,7 @@ int AdFront3 :: GetLocals (int fstind, for (i = 1; i <= locfaces.Size(); i++) for (j = 1; j <= locfaces.Get(i).GetNP(); j++) { - pi = locfaces.Get(i).PNum(j); + PointIndex pi = locfaces.Get(i).PNum(j); invpindex[pi] = -1; } @@ -599,7 +596,7 @@ int AdFront3 :: GetLocals (int fstind, { for (j = 1; j <= locfaces.Get(i).GetNP(); j++) { - pi = locfaces.Get(i).PNum(j); + PointIndex pi = locfaces.Get(i).PNum(j); if (invpindex[pi] == -1) { pindex.Append (pi); @@ -703,12 +700,12 @@ void AdFront3 :: GetGroup (int fi, invpindex.SetSize (points.Size()); - for (i = 1; i <= points.Size(); i++) + for (PointIndex pi = points.Begin(); pi < points.End(); pi++) if (points.Get(i).Valid()) { - grouppoints.Append (points.Get(i).P()); - pindex.Append (i); - invpindex.Elem(i) = pindex.Size(); + grouppoints.Append (points[pi].P()); + pindex.Append (pi); + invpindex[pi] = pindex.Size(); } for (i = 1; i <= faces.Size(); i++) diff --git a/libsrc/meshing/adfront3.hpp b/libsrc/meshing/adfront3.hpp index 60c6aa10..11993733 100644 --- a/libsrc/meshing/adfront3.hpp +++ b/libsrc/meshing/adfront3.hpp @@ -176,7 +176,7 @@ public: class AdFront3 { /// -Array points; + Array points; /// Array faces; /// @@ -208,7 +208,7 @@ int rebuildcounter; int lasti; /// minimal selection-value of baseelements int minval; - Array invpindex; + Array invpindex; Array pingroup; /// diff --git a/libsrc/meshing/bisect.cpp b/libsrc/meshing/bisect.cpp index afa3400d..3da30ba6 100644 --- a/libsrc/meshing/bisect.cpp +++ b/libsrc/meshing/bisect.cpp @@ -6,18 +6,17 @@ namespace netgen { - //#include "../interface/writeuser.hpp" class MarkedTet; class MarkedPrism; class MarkedIdentification; class MarkedTri; class MarkedQuad; - typedef MoveableArray T_MTETS; - typedef MoveableArray T_MPRISMS; - typedef MoveableArray T_MIDS; - typedef MoveableArray T_MTRIS; - typedef MoveableArray T_MQUADS; + typedef Array T_MTETS; + typedef Array T_MPRISMS; + typedef Array T_MIDS; + typedef Array T_MTRIS; + typedef Array T_MQUADS; @@ -855,8 +854,7 @@ namespace netgen INDEX_2_CLOSED_HASHTABLE & edgenumber, MarkedTet & mt) { - int i, j, k; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) mt.pnums[i] = el[i]; mt.marked = 0; @@ -867,8 +865,8 @@ namespace netgen int val = 0; // find marked edge of tet: - for (i = 0; i < 3; i++) - for (j = i+1; j < 4; j++) + for (int i = 0; i < 3; i++) + for (int j = i+1; j < 4; j++) { INDEX_2 i2(mt.pnums[i], mt.pnums[j]); i2.Sort(); @@ -883,11 +881,11 @@ namespace netgen // find marked edges of faces: - for (k = 0; k < 4; k++) + for (int k = 0; k < 4; k++) { val = 0; - for (i = 0; i < 3; i++) - for (j = i+1; j < 4; j++) + for (int i = 0; i < 3; i++) + for (int j = i+1; j < 4; j++) if (i != k && j != k) { INDEX_2 i2(mt.pnums[i], mt.pnums[j]); @@ -910,19 +908,17 @@ namespace netgen INDEX_2_CLOSED_HASHTABLE & edgenumber, MarkedPrism & mp) { - int i, j; - if (el.GetType() == PRISM || el.GetType() == PRISM12) { - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) mp.pnums[i] = el[i]; } else if (el.GetType() == PYRAMID) { static int map[6] = { 1, 2, 5, 4, 3, 5 }; - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) mp.pnums[i] = el.PNum(map[i]); } else if (el.GetType() == TET || @@ -930,7 +926,7 @@ namespace netgen { static int map[6] = { 1, 4, 3, 2, 4, 3 }; - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) mp.pnums[i] = el.PNum(map[i]); } @@ -947,8 +943,8 @@ namespace netgen mp.order = 1; int val = 0; - for (i = 0; i < 2; i++) - for (j = i+1; j < 3; j++) + for (int i = 0; i < 2; i++) + for (int j = i+1; j < 3; j++) { INDEX_2 i2(mp.pnums[i], mp.pnums[j]); i2.Sort(); @@ -1016,8 +1012,7 @@ namespace netgen INDEX_2_CLOSED_HASHTABLE & edgenumber, MarkedTri & mt) { - int i, j; - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { mt.pnums[i] = el[i]; mt.pgeominfo[i] = el.GeomInfoPi (i+1); @@ -1030,8 +1025,8 @@ namespace netgen mt.order = 1; int val = 0; - for (i = 0; i < 2; i++) - for (j = i+1; j < 3; j++) + for (int i = 0; i < 2; i++) + for (int j = i+1; j < 3; j++) { INDEX_2 i2(mt.pnums[i], mt.pnums[j]); i2.Sort(); @@ -1073,8 +1068,7 @@ namespace netgen INDEX_2_CLOSED_HASHTABLE & edgenumber, MarkedQuad & mq) { - int i; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) mq.pnums[i] = el[i]; Swap (mq.pnums[2], mq.pnums[3]); @@ -1217,8 +1211,6 @@ namespace netgen *testout << "bisect tet " << oldtet << endl; #endif - int i, j, k; - // points vis a vis from tet-edge int vis1, vis2; @@ -1233,10 +1225,10 @@ namespace netgen // is tet of type P ? int istypep = 0; - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { int cnt = 0; - for (j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) if (oldtet.faceedges[j] == i) cnt++; if (cnt == 3) @@ -1245,7 +1237,7 @@ namespace netgen - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { newtet1.pnums[i] = oldtet.pnums[i]; newtet2.pnums[i] = oldtet.pnums[i]; @@ -1263,7 +1255,7 @@ namespace netgen *testout << "newtet2,before = " << newtet2 << endl; #endif - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { if (i == oldtet.tetedge1) { @@ -1272,10 +1264,10 @@ namespace netgen newtet2.faceedges[vis1] = i; // cut faces newtet2.faceedges[vis2] = i; - j = 0; + int j = 0; while (j == i || j == oldtet.faceedges[i]) j++; - k = 6 - i - oldtet.faceedges[i] - j; + int k = 6 - i - oldtet.faceedges[i] - j; newtet2.tetedge1 = j; // tet-edge newtet2.tetedge2 = k; @@ -1310,10 +1302,10 @@ namespace netgen newtet1.faceedges[i] = oldtet.faceedges[i]; // inherited face newtet1.faceedges[vis1] = i; newtet1.faceedges[vis2] = i; - j = 0; + int j = 0; while (j == i || j == oldtet.faceedges[i]) j++; - k = 6 - i - oldtet.faceedges[i] - j; + int k = 6 - i - oldtet.faceedges[i] - j; newtet1.tetedge1 = j; newtet1.tetedge2 = k; @@ -1353,19 +1345,16 @@ namespace netgen void BTBisectPrism (const MarkedPrism & oldprism, int newp1, int newp2, MarkedPrism & newprism1, MarkedPrism & newprism2) { - int i; - - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) { newprism1.pnums[i] = oldprism.pnums[i]; newprism2.pnums[i] = oldprism.pnums[i]; } - int pe1, pe2; - pe1 = 0; + int pe1 = 0; if (pe1 == oldprism.markededge) pe1++; - pe2 = 3 - oldprism.markededge - pe1; + int pe2 = 3 - oldprism.markededge - pe1; newprism1.pnums[pe2] = newp1; newprism1.pnums[pe2+3] = newp2; @@ -1390,7 +1379,7 @@ namespace netgen void BTBisectIdentification (const MarkedIdentification & oldid, - Array & newp, + Array & newp, MarkedIdentification & newid1, MarkedIdentification & newid2) { @@ -1440,9 +1429,7 @@ namespace netgen void BTBisectTri (const MarkedTri & oldtri, int newp, const PointGeomInfo & newpgi, MarkedTri & newtri1, MarkedTri & newtri2) { - int i; - - for (i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { newtri1.pnums[i] = oldtri.pnums[i]; newtri1.pgeominfo[i] = oldtri.pgeominfo[i]; @@ -1450,11 +1437,10 @@ namespace netgen newtri2.pgeominfo[i] = oldtri.pgeominfo[i]; } - int pe1, pe2; - pe1 = 0; + int pe1 = 0; if (pe1 == oldtri.markededge) pe1++; - pe2 = 3 - oldtri.markededge - pe1; + int pe2 = 3 - oldtri.markededge - pe1; newtri1.pnums[pe2] = newp; newtri1.pgeominfo[pe2] = newpgi; @@ -1477,8 +1463,6 @@ namespace netgen newtri1.order = oldtri.order; newtri2.incorder = 0; newtri2.order = oldtri.order; - - } @@ -1487,9 +1471,7 @@ namespace netgen int newp2, const PointGeomInfo & npgi2, MarkedQuad & newquad1, MarkedQuad & newquad2) { - int i; - - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { newquad1.pnums[i] = oldquad.pnums[i]; newquad1.pgeominfo[i] = oldquad.pgeominfo[i]; @@ -1581,12 +1563,10 @@ namespace netgen int MarkHangingIdentifications(T_MIDS & mids, - const INDEX_2_CLOSED_HASHTABLE & cutedges) + const INDEX_2_CLOSED_HASHTABLE & cutedges) { - int i, j; - int hanging = 0; - for (i = 1; i <= mids.Size(); i++) + for (int i = 1; i <= mids.Size(); i++) { if (mids.Elem(i).marked) { @@ -1595,8 +1575,7 @@ namespace netgen } const int np = mids.Get(i).np; - - for(j = 0; j < np; j++) + for(int j = 0; j < np; j++) { INDEX_2 edge1(mids.Get(i).pnums[j], mids.Get(i).pnums[(j+1) % np]); @@ -1678,12 +1657,10 @@ namespace netgen int MarkHangingTets (T_MTETS & mtets, - const INDEX_2_CLOSED_HASHTABLE & cutedges) + const INDEX_2_CLOSED_HASHTABLE & cutedges) { - int i, j, k; - int hanging = 0; - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) { MarkedTet & teti = mtets.Elem(i); @@ -1693,8 +1670,8 @@ namespace netgen continue; } - for (j = 0; j < 3; j++) - for (k = j+1; k < 4; k++) + for (int j = 0; j < 3; j++) + for (int k = j+1; k < 4; k++) { INDEX_2 edge(teti.pnums[j], teti.pnums[k]); @@ -1713,12 +1690,10 @@ namespace netgen int MarkHangingPrisms (T_MPRISMS & mprisms, - const INDEX_2_CLOSED_HASHTABLE & cutedges) + const INDEX_2_CLOSED_HASHTABLE & cutedges) { - int i, j, k; - int hanging = 0; - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) { if (mprisms.Elem(i).marked) { @@ -1726,8 +1701,8 @@ namespace netgen continue; } - for (j = 0; j < 2; j++) - for (k = j+1; k < 3; k++) + for (int j = 0; j < 2; j++) + for (int k = j+1; k < 3; k++) { INDEX_2 edge1(mprisms.Get(i).pnums[j], mprisms.Get(i).pnums[k]); @@ -1749,20 +1724,18 @@ namespace netgen int MarkHangingTris (T_MTRIS & mtris, - const INDEX_2_CLOSED_HASHTABLE & cutedges) + const INDEX_2_CLOSED_HASHTABLE & cutedges) { - int i, j, k; - int hanging = 0; - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) { if (mtris.Get(i).marked) { hanging = 1; continue; } - for (j = 0; j < 2; j++) - for (k = j+1; k < 3; k++) + for (int j = 0; j < 2; j++) + for (int k = j+1; k < 3; k++) { INDEX_2 edge(mtris.Get(i).pnums[j], mtris.Get(i).pnums[k]); @@ -1774,18 +1747,16 @@ namespace netgen } } } - return hanging; + return hanging; } int MarkHangingQuads (T_MQUADS & mquads, - const INDEX_2_CLOSED_HASHTABLE & cutedges) + const INDEX_2_CLOSED_HASHTABLE & cutedges) { - int i; - int hanging = 0; - for (i = 1; i <= mquads.Size(); i++) + for (int i = 1; i <= mquads.Size(); i++) { if (mquads.Elem(i).marked) { @@ -1834,11 +1805,10 @@ namespace netgen void ConnectToNodeRec (int node, int tonode, const TABLE & conto, Array & connecttonode) { - int i, n2; // (*testout) << "connect " << node << " to " << tonode << endl; - for (i = 1; i <= conto.EntrySize(node); i++) + for (int i = 1; i <= conto.EntrySize(node); i++) { - n2 = conto.Get(node, i); + int n2 = conto.Get(node, i); if (!connecttonode.Get(n2)) { connecttonode.Elem(n2) = tonode; @@ -1944,16 +1914,15 @@ namespace netgen const Array< Array* > & idmaps, const string & refinfofile) { - mtets.SetName ("bisection, tets"); - mprisms.SetName ("bisection, prisms"); - mtris.SetName ("bisection, trigs"); - mquads.SetName ("bisection, quads"); - mids.SetName ("bisection, identifications"); + // mtets.SetName ("bisection, tets"); + // mprisms.SetName ("bisection, prisms"); + // mtris.SetName ("bisection, trigs"); + // nmquads.SetName ("bisection, quads"); + // mids.SetName ("bisection, identifications"); //int np = mesh.GetNP(); int ne = mesh.GetNE(); int nse = mesh.GetNSE(); - int i, j, k, l, m; /* if (mtets.Size() + mprisms.Size() == mesh.GetNE()) @@ -1983,13 +1952,13 @@ namespace netgen INDEX_2_HASHTABLE shortedges(100); - for (i = 1; i <= ne; i++) + for (int i = 1; i <= ne; i++) { const Element & el = mesh.VolumeElement(i); if (el.GetType() == PRISM || el.GetType() == PRISM12) { - for (j = 1; j <= 3; j++) + for (int j = 1; j <= 3; j++) { INDEX_2 se(el.PNum(j), el.PNum(j+3)); se.Sort(); @@ -2006,7 +1975,7 @@ namespace netgen BTSortEdges (mesh, idmaps, edgenumber); - for (i = 1; i <= ne; i++) + for (int i = 1; i <= ne; i++) { const Element & el = mesh.VolumeElement(i); @@ -2018,8 +1987,8 @@ namespace netgen // if tet has short edge, it is handled as degenerated prism int foundse = 0; - for (j = 1; j <= 3; j++) - for (k = j+1; k <= 4; k++) + for (int j = 1; j <= 3; j++) + for (int k = j+1; k <= 4; k++) { INDEX_2 se(el.PNum(j), el.PNum(k)); se.Sort(); @@ -2040,8 +2009,8 @@ namespace netgen pi[2] = p3; pi[3] = p4; int cnt = 0; - for (l = 1; l <= 4; l++) - for (m = 0; m < 3; m++) + for (int l = 1; l <= 4; l++) + for (int m = 0; m < 3; m++) if (pi[m] > pi[m+1]) { Swap (pi[m], pi[m+1]); @@ -2110,7 +2079,7 @@ namespace netgen } } - for (i = 1; i <= nse; i++) + for (int i = 1; i <= nse; i++) { const Element2d & el = mesh.SurfaceElement(i); if (el.GetType() == TRIG || @@ -2128,7 +2097,7 @@ namespace netgen } MarkedIdentification mi; - for(j=0; j0) @@ -2417,12 +2386,18 @@ namespace netgen // const Array < Array* > & surfelements_before, // const Array < Array* > & markedsurfelts_num) { + /* T_MTETS mtets_old; mtets_old.Copy(mtets); T_MPRISMS mprisms_old; mprisms_old.Copy(mprisms); T_MIDS mids_old; mids_old.Copy(mids); T_MTRIS mtris_old; mtris_old.Copy(mtris); T_MQUADS mquads_old; mquads_old.Copy(mquads); - + */ + T_MTETS mtets_old (mtets); + T_MPRISMS mprisms_old (mprisms); + T_MIDS mids_old (mids); + T_MTRIS mtris_old (mtris); + T_MQUADS mquads_old (mquads); @@ -2704,7 +2679,7 @@ namespace netgen // int ne = mesh.GetNE(); // int nse = mesh.GetNSE(); - int i, j, l; + // int i, j, l; // int initnp = np; // int maxsteps = 3; @@ -2739,45 +2714,45 @@ namespace netgen mesh[sei].SetOrder(ox+2,oy+2); } - #ifndef SABINE //Nachbarelemente mit ordx,ordy,ordz - +#ifndef SABINE //Nachbarelemente mit ordx,ordy,ordz + Array v_order (mesh.GetNP()); v_order = 0; for (ElementIndex ei = 0; ei < ne; ei++) - for (j = 0; j < mesh[ei].GetNP(); j++) - if (mesh[ei].GetOrder() > v_order[mesh[ei][j]]) - v_order[mesh[ei][j]] = mesh[ei].GetOrder(); + for (int j = 0; j < mesh[ei].GetNP(); j++) + if (mesh[ei].GetOrder() > v_order[mesh[ei][j]]) + v_order[mesh[ei][j]] = mesh[ei].GetOrder(); for (SurfaceElementIndex sei = 0; sei < nse; sei++) - for (j = 0; j < mesh[sei].GetNP(); j++) - if (mesh[sei].GetOrder() > v_order[mesh[sei][j]]) - v_order[mesh[sei][j]] = mesh[sei].GetOrder(); + for (int j = 0; j < mesh[sei].GetNP(); j++) + if (mesh[sei].GetOrder() > v_order[mesh[sei][j]]) + v_order[mesh[sei][j]] = mesh[sei].GetOrder(); for (ElementIndex ei = 0; ei < ne; ei++) - for (j = 0; j < mesh[ei].GetNP(); j++) - if (mesh[ei].GetOrder() < v_order[mesh[ei][j]]-1) - mesh[ei].SetOrder(v_order[mesh[ei][j]]-1); + for (int j = 0; j < mesh[ei].GetNP(); j++) + if (mesh[ei].GetOrder() < v_order[mesh[ei][j]]-1) + mesh[ei].SetOrder(v_order[mesh[ei][j]]-1); for (SurfaceElementIndex sei = 0; sei < nse; sei++) - for (j = 0; j < mesh[sei].GetNP(); j++) - if (mesh[sei].GetOrder() < v_order[mesh[sei][j]]-1) - mesh[sei].SetOrder(v_order[mesh[sei][j]]-1); - - #endif - - PopStatus(); - return; + for (int j = 0; j < mesh[sei].GetNP(); j++) + if (mesh[sei].GetOrder() < v_order[mesh[sei][j]]-1) + mesh[sei].SetOrder(v_order[mesh[sei][j]]-1); + +#endif + + PopStatus(); + return; } // INDEX_2_HASHTABLE cutedges(10 + 5 * (mtets.Size()+mprisms.Size()+mtris.Size()+mquads.Size())); - INDEX_2_CLOSED_HASHTABLE cutedges(10 + 9 * (mtets.Size()+mprisms.Size()+mtris.Size()+mquads.Size())); + INDEX_2_CLOSED_HASHTABLE cutedges(10 + 9 * (mtets.Size()+mprisms.Size()+mtris.Size()+mquads.Size())); bool noprojection = false; - for (l = 1; l <= 1; l++) + for (int l = 1; l <= 1; l++) { int marked = 0; if (opt.refinementfilename) @@ -2790,15 +2765,15 @@ namespace netgen if(st == "refinementinfo") // new version { - for(i=1; i<=mtets.Size(); i++) + for(int i=1; i<=mtets.Size(); i++) mtets.Elem(i).marked = 0; - for(i=1; i<=mprisms.Size(); i++) + for(int i=1; i<=mprisms.Size(); i++) mprisms.Elem(i).marked = 0; - for(i=1; i<=mtris.Size(); i++) + for(int i=1; i<=mtris.Size(); i++) mtris.Elem(i).marked = 0; - for(i=1; i<=mquads.Size(); i++) + for(int i=1; i<=mquads.Size(); i++) mquads.Elem(i).marked = 0; - for(i=1; i<=mprisms.Size(); i++) + for(int i=1; i<=mprisms.Size(); i++) mids.Elem(i).marked = 0; inf >> st; @@ -2844,7 +2819,7 @@ namespace netgen else if(st == "orthobrick") { double bounds[6]; - for(i=0; i<6; i++) + for(int i=0; i<6; i++) inf >> bounds[i]; int cnt = 0; @@ -2855,14 +2830,14 @@ namespace netgen // Point<3> center(0,0,0); - for(i=0; i> ch; if(!inf) @@ -2940,7 +2915,7 @@ namespace netgen { int cnttet = 0; int cntprism = 0; - for (i = 1; i <= mesh.GetNE(); i++) + for (int i = 1; i <= mesh.GetNE(); i++) { if (mesh.VolumeElement(i).GetType() == TET || mesh.VolumeElement(i).GetType() == TET10) @@ -2963,7 +2938,7 @@ namespace netgen } } else - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) { mtets.Elem(i).marked = 3 * mesh.VolumeElement(i).TestRefinementFlag(); @@ -2989,7 +2964,7 @@ namespace netgen int cnttrig = 0; int cntquad = 0; - for (i = 1; i <= mesh.GetNSE(); i++) + for (int i = 1; i <= mesh.GetNSE(); i++) { if (mesh.SurfaceElement(i).GetType() == TRIG || mesh.SurfaceElement(i).GetType() == TRIG6) @@ -3064,26 +3039,26 @@ namespace netgen { PrintMessage(3,"refine p"); - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) mtets.Elem(i).incorder = mtets.Elem(i).marked ? 1 : 0; - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) if (mtets.Elem(i).incorder) mtets.Elem(i).marked = 0; - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) mprisms.Elem(i).incorder = mprisms.Elem(i).marked ? 1 : 0; - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) if (mprisms.Elem(i).incorder) mprisms.Elem(i).marked = 0; - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) mtris.Elem(i).incorder = mtris.Elem(i).marked ? 1 : 0; - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) { if (mtris.Elem(i).incorder) mtris.Elem(i).marked = 0; @@ -3098,7 +3073,7 @@ namespace netgen if (mesh.GetDimension() == 3) { - for (i = 1; i <= mesh.GetNSeg(); i++) + for (int i = 1; i <= mesh.GetNSeg(); i++) { const Segment & seg = mesh.LineSegment(i); singv.Set (seg[0]); @@ -3118,10 +3093,10 @@ namespace netgen // vertices with 2 different bnds Array bndind(np); bndind = 0; - for (i = 1; i <= mesh.GetNSeg(); i++) + for (int i = 1; i <= mesh.GetNSeg(); i++) { const Segment & seg = mesh.LineSegment(i); - for (j = 0; j < 2; j++) + for (int j = 0; j < 2; j++) { int pi = (j == 0) ? seg[0] : seg[1]; if (bndind.Elem(pi) == 0) @@ -3134,47 +3109,47 @@ namespace netgen - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) mtets.Elem(i).incorder = 1; - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) { if (!mtets.Elem(i).marked) mtets.Elem(i).incorder = 0; - for (j = 0; j < 4; j++) + for (int j = 0; j < 4; j++) if (singv.Test (mtets.Elem(i).pnums[j])) mtets.Elem(i).incorder = 0; } - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) if (mtets.Elem(i).incorder) mtets.Elem(i).marked = 0; - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) mprisms.Elem(i).incorder = 1; - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) { if (!mprisms.Elem(i).marked) mprisms.Elem(i).incorder = 0; - for (j = 0; j < 6; j++) + for (int j = 0; j < 6; j++) if (singv.Test (mprisms.Elem(i).pnums[j])) mprisms.Elem(i).incorder = 0; } - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) if (mprisms.Elem(i).incorder) mprisms.Elem(i).marked = 0; - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) mtris.Elem(i).incorder = 1; - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) { if (!mtris.Elem(i).marked) mtris.Elem(i).incorder = 0; - for (j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) if (singv.Test (mtris.Elem(i).pnums[j])) mtris.Elem(i).incorder = 0; } - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) { if (mtris.Elem(i).incorder) mtris.Elem(i).marked = 0; @@ -3195,12 +3170,12 @@ namespace netgen // refine volume elements int nel = mtets.Size(); - for (i = 1; i <= nel; i++) + for (int i = 1; i <= nel; i++) if (mtets.Elem(i).marked) { MarkedTet oldtet; MarkedTet newtet1, newtet2; - int newp; + PointIndex newp; oldtet = mtets.Get(i); @@ -3217,7 +3192,7 @@ namespace netgen { Point<3> npt = Center (mesh.Point (edge.I1()), mesh.Point (edge.I2())); - newp = mesh.AddPoint (npt); + newp = mesh.AddPoint (npt); cutedges.Set (edge, newp); } @@ -3236,12 +3211,12 @@ namespace netgen } int npr = mprisms.Size(); - for (i = 1; i <= npr; i++) + for (int i = 1; i <= npr; i++) if (mprisms.Elem(i).marked) { MarkedPrism oldprism; MarkedPrism newprism1, newprism2; - int newp1, newp2; + PointIndex newp1, newp2; oldprism = mprisms.Get(i); int pi1 = 0; @@ -3262,7 +3237,7 @@ namespace netgen { Point<3> npt = Center (mesh.Point (edge1.I1()), mesh.Point (edge1.I2())); - newp1 = mesh.AddPoint (npt); + newp1 = mesh.AddPoint (npt); cutedges.Set (edge1, newp1); } if (cutedges.Used (edge2)) @@ -3271,7 +3246,7 @@ namespace netgen { Point<3> npt = Center (mesh.Point (edge2.I1()), mesh.Point (edge2.I2())); - newp2 = mesh.AddPoint (npt); + newp2 = mesh.AddPoint (npt); cutedges.Set (edge2, newp2); } @@ -3284,11 +3259,11 @@ namespace netgen } int nid = mids.Size(); - for (i = 1; i <= nid; i++) + for (int i = 1; i <= nid; i++) if (mids.Elem(i).marked) { MarkedIdentification oldid,newid1,newid2; - Array newp; + Array newp; oldid = mids.Get(i); @@ -3305,7 +3280,7 @@ namespace netgen edges.Append(INDEX_2(oldid.pnums[(oldid.markededge+2)%oldid.np + oldid.np], oldid.pnums[(oldid.markededge+3)%oldid.np + oldid.np])); } - for (j = 0; j < edges.Size(); j++) + for (int j = 0; j < edges.Size(); j++) { edges[j].Sort(); @@ -3337,7 +3312,7 @@ namespace netgen int nsel = mtris.Size(); - for (i = 1; i <= nsel; i++) + for (int i = 1; i <= nsel; i++) if (mtris.Elem(i).marked) { MarkedTri oldtri; @@ -3389,12 +3364,12 @@ namespace netgen } int nquad = mquads.Size(); - for (i = 1; i <= nquad; i++) + for (int i = 1; i <= nquad; i++) if (mquads.Elem(i).marked) { MarkedQuad oldquad; MarkedQuad newquad1, newquad2; - int newp1, newp2; + PointIndex newp1, newp2; oldquad = mquads.Get(i); /* @@ -3431,7 +3406,7 @@ namespace netgen { Point<3> np1 = Center (mesh.Point (edge1.I1()), mesh.Point (edge1.I2())); - newp1 = mesh.AddPoint (np1); + newp1 = mesh.AddPoint (np1); cutedges.Set (edge1, newp1); } @@ -3488,7 +3463,7 @@ namespace netgen hangingedge = 0; int nseg = mesh.GetNSeg (); - for (i = 1; i <= nseg; i++) + for (int i = 1; i <= nseg; i++) { Segment & seg = mesh.LineSegment (i); INDEX_2 edge(seg[0], seg[1]); @@ -3561,34 +3536,34 @@ namespace netgen v_order = 0; if (mesh.GetDimension() == 3) { - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) if (mtets.Elem(i).incorder) mtets.Elem(i).order++; - for (i = 0; i < mtets.Size(); i++) - for (j = 0; j < 4; j++) + for (int i = 0; i < mtets.Size(); i++) + for (int j = 0; j < 4; j++) if (int(mtets[i].order) > v_order.Elem(mtets[i].pnums[j])) v_order.Elem(mtets[i].pnums[j]) = mtets[i].order; - for (i = 0; i < mtets.Size(); i++) - for (j = 0; j < 4; j++) + for (int i = 0; i < mtets.Size(); i++) + for (int j = 0; j < 4; j++) if (int(mtets[i].order) < v_order.Elem(mtets[i].pnums[j])-1) mtets[i].order = v_order.Elem(mtets[i].pnums[j])-1; } else { - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) if (mtris.Elem(i).incorder) { mtris.Elem(i).order++; } - for (i = 0; i < mtris.Size(); i++) - for (j = 0; j < 3; j++) + for (int i = 0; i < mtris.Size(); i++) + for (int j = 0; j < 3; j++) if (int(mtris[i].order) > v_order.Elem(mtris[i].pnums[j])) v_order.Elem(mtris[i].pnums[j]) = mtris[i].order; - for (i = 0; i < mtris.Size(); i++) + for (int i = 0; i < mtris.Size(); i++) { - for (j = 0; j < 3; j++) + for (int j = 0; j < 3; j++) if (int(mtris[i].order) < v_order.Elem(mtris[i].pnums[j])-1) mtris[i].order = v_order.Elem(mtris[i].pnums[j])-1; } @@ -3604,20 +3579,20 @@ namespace netgen mesh.ClearVolumeElements(); mesh.VolumeElements().SetAllocSize (mtets.Size()+mprisms.Size()); - for (i = 1; i <= mtets.Size(); i++) + for (int i = 1; i <= mtets.Size(); i++) { Element el(TET); el.SetIndex (mtets.Get(i).matindex); - for (j = 1; j <= 4; j++) + for (int j = 1; j <= 4; j++) el.PNum(j) = mtets.Get(i).pnums[j-1]; el.SetOrder (mtets.Get(i).order); mesh.AddVolumeElement (el); } - for (i = 1; i <= mprisms.Size(); i++) + for (int i = 1; i <= mprisms.Size(); i++) { Element el(PRISM); el.SetIndex (mprisms.Get(i).matindex); - for (j = 1; j <= 6; j++) + for (int j = 1; j <= 6; j++) el.PNum(j) = mprisms.Get(i).pnums[j-1]; el.SetOrder (mprisms.Get(i).order); @@ -3638,7 +3613,7 @@ namespace netgen { case 1: { - for (j = 1; j <= 5; j++) + for (int j = 1; j <= 5; j++) el.PNum(j) = mprisms.Get(i).pnums[map[j-1]-1]; el.SetType (PYRAMID); @@ -3652,7 +3627,7 @@ namespace netgen if (!deg1) map = tetmap1; if (!deg2) map = tetmap2; if (!deg3) map = tetmap3; - for (j = 1; j <= 4; j++) + for (int j = 1; j <= 4; j++) el.PNum(j) = mprisms.Get(i).pnums[map[j-1]-1]; /* if (!deg1) el.PNum(4) = el.PNum(4); @@ -3669,23 +3644,23 @@ namespace netgen } mesh.ClearSurfaceElements(); - for (i = 1; i <= mtris.Size(); i++) + for (int i = 1; i <= mtris.Size(); i++) { Element2d el(TRIG); el.SetIndex (mtris.Get(i).surfid); el.SetOrder (mtris.Get(i).order); - for (j = 1; j <= 3; j++) + for (int j = 1; j <= 3; j++) { el.PNum(j) = mtris.Get(i).pnums[j-1]; el.GeomInfoPi(j) = mtris.Get(i).pgeominfo[j-1]; } mesh.AddSurfaceElement (el); } - for (i = 1; i <= mquads.Size(); i++) + for (int i = 1; i <= mquads.Size(); i++) { Element2d el(QUAD); el.SetIndex (mquads.Get(i).surfid); - for (j = 1; j <= 4; j++) + for (int j = 1; j <= 4; j++) el.PNum(j) = mquads.Get(i).pnums[j-1]; Swap (el.PNum(3), el.PNum(4)); mesh.AddSurfaceElement (el); @@ -3699,7 +3674,7 @@ namespace netgen if (mesh.mglevels <= 2) { PrintMessage(4,"RESETTING mlbetweennodes"); - for (i = 1; i <= np; i++) + for (int i = 1; i <= np; i++) { mesh.mlbetweennodes.Elem(i).I1() = 0; mesh.mlbetweennodes.Elem(i).I2() = 0; @@ -3720,11 +3695,11 @@ namespace netgen BitArray isnewpoint(np); isnewpoint.Clear(); - for (i = 1; i <= cutedges.Size(); i++) + for (int i = 1; i <= cutedges.Size(); i++) if (cutedges.UsedPos(i)) { INDEX_2 edge; - int newpi; + PointIndex newpi; cutedges.GetData (i, edge, newpi); isnewpoint.Set(newpi); mesh.mlbetweennodes.Elem(newpi) = edge; @@ -3801,7 +3776,7 @@ namespace netgen // update identification tables - for (i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++) + for (int i = 1; i <= mesh.GetIdentifications().GetMaxNr(); i++) { Array identmap; @@ -3826,18 +3801,18 @@ namespace netgen } */ - for (j = 1; j <= cutedges.Size(); j++) + for (int j = 1; j <= cutedges.Size(); j++) if (cutedges.UsedPos(j)) { INDEX_2 i2; - int newpi; + PointIndex newpi; cutedges.GetData (j, i2, newpi); INDEX_2 oi2(identmap.Get(i2.I1()), identmap.Get(i2.I2())); oi2.Sort(); if (cutedges.Used (oi2)) { - int onewpi = cutedges.Get(oi2); + PointIndex onewpi = cutedges.Get(oi2); mesh.GetIdentifications().Add (newpi, onewpi, i); } } @@ -3913,8 +3888,8 @@ namespace netgen // update id-maps - j=0; - for(i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++) + int j=0; + for(int i=1; i<=mesh.GetIdentifications().GetMaxNr(); i++) { if(mesh.GetIdentifications().GetType(i) == Identifications::PERIODIC) { @@ -3969,7 +3944,7 @@ namespace netgen - for(i=0; i newels; @@ -505,12 +502,11 @@ namespace netgen for (int k = 0; k < 4; k++) tempels.Elem(celind)[k] = -1; - + ((ADTree6&)tettree.Tree()).DeleteElement (celind); freelist.Append (celind); } - int hasclose = 0; for (int j = 1; j <= closesphere.GetArray().Size(); j++) { @@ -605,9 +601,6 @@ namespace netgen Array & tempels, int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax) { - int i, j, k; - const Point<3> * pp[4]; - Array > centers; Array radi2; @@ -616,17 +609,17 @@ namespace netgen // new: local box mesh.GetBox (pmax, pmin); // lower bound for pmax, upper for pmin - for (i = 1; i <= adfront->GetNF(); i++) + for (int i = 1; i <= adfront->GetNF(); i++) { const MiniElement2d & face = adfront->GetFace(i); - for (j = 0; j < face.GetNP(); j++) + for (int j = 0; j < face.GetNP(); j++) { pmin.SetToMin (mesh.Point (face[j])); pmax.SetToMax (mesh.Point (face[j])); } } - for (i = 0; i < mesh.LockedPoints().Size(); i++) + for (int i = 0; i < mesh.LockedPoints().Size(); i++) { pmin.SetToMin (mesh.Point (mesh.LockedPoints()[i])); pmax.SetToMax (mesh.Point (mesh.LockedPoints()[i])); @@ -661,18 +654,18 @@ namespace netgen // flag points to use for Delaunay: BitArrayChar usep(np); usep.Clear(); - for (i = 1; i <= adfront->GetNF(); i++) + for (int i = 1; i <= adfront->GetNF(); i++) { const MiniElement2d & face = adfront->GetFace(i); - for (j = 0; j < face.GetNP(); j++) + for (int j = 0; j < face.GetNP(); j++) usep.Set (face[j]); } - for (i = oldnp + PointIndex::BASE; + for (int i = oldnp + PointIndex::BASE; i < np + PointIndex::BASE; i++) usep.Set (i); - for (i = 0; i < mesh.LockedPoints().Size(); i++) + for (int i = 0; i < mesh.LockedPoints().Size(); i++) usep.Set (mesh.LockedPoints()[i]); @@ -697,7 +690,7 @@ namespace netgen tpmin = tpmax = mesh.Point(startel[0]); - for (k = 1; k < 4; k++) + for (int k = 1; k < 4; k++) { tpmin.SetToMin (mesh.Point (startel[k])); tpmax.SetToMax (mesh.Point (startel[k])); @@ -705,14 +698,11 @@ namespace netgen tpmax = tpmax + 0.01 * (tpmax - tpmin); tettree.Insert (tpmin, tpmax, 1); - Point<3> pc; - for (k = 0; k < 4; k++) - { - pp[k] = &mesh.Point (startel[k]); - } - + const Point<3> * pp[4]; + for (int k = 0; k < 4; k++) + pp[k] = &mesh.Point (startel[k]); CalcSphereCenter (&pp[0], pc); centers.Append (pc); @@ -722,50 +712,50 @@ namespace netgen IndexSet insphere(mesh.GetNP()); IndexSet closesphere(mesh.GetNP()); - - // "random" reordering of points (speeds a factor 3 - 5 !!!) - - Array mixed(np); + Array mixed(np); int prims[] = { 11, 13, 17, 19, 23, 29, 31, 37 }; int prim; - i = 0; - while (np % prims[i] == 0) i++; - prim = prims[i]; + { + int i = 0; + while (np % prims[i] == 0) i++; + prim = prims[i]; + } - for (i = 1; i <= np; i++) - mixed.Elem(i) = (prim * i) % np + PointIndex::BASE; + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) + mixed[pi] = PointIndex ( (prim * pi) % np + PointIndex::BASE ); - for (i = 1; i <= np; i++) + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End()-4; pi++) { - if (i % 1000 == 0) + if (pi % 1000 == 0) { - if (i % 10000 == 0) + if (pi % 10000 == 0) PrintDot ('+'); else PrintDot ('.'); } - multithread.percent = 100.0 * i / np; + multithread.percent = 100.0 * pi / np; if (multithread.terminate) break; - PointIndex newpi = mixed.Get(i); + PointIndex newpi = mixed[pi]; if (!usep.Test(newpi)) continue; cntp++; - const Point3d & newp = mesh.Point(newpi); + const MeshPoint & newp = mesh[newpi]; AddDelaunayPoint (newpi, newp, tempels, mesh, tettree, meshnb, centers, radi2, connected, treesearch, freelist, list, insphere, closesphere); + } - for (i = tempels.Size(); i >= 1; i--) + for (int i = tempels.Size(); i >= 1; i--) if (tempels.Get(i)[0] <= 0) tempels.DeleteElement (i); @@ -819,7 +809,7 @@ namespace netgen // improve delaunay - mesh by swapping !!!! Mesh tempmesh; - for (PointIndex pi = PointIndex::BASE; pi < mesh.GetNP()+PointIndex::BASE; pi++) + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) tempmesh.AddPoint (mesh[pi]); for (int i = 1; i <= tempels.Size(); i++) @@ -874,8 +864,8 @@ namespace netgen // for (i = mesh.GetNP() - 3; i <= mesh.GetNP(); i++) // tempmesh.AddLockedPoint (i); - for (PointIndex pi = PointIndex::BASE; - pi < tempmesh.GetNP() + PointIndex::BASE; pi++) + for (PointIndex pi = tempmesh.Points().Begin(); + pi < tempmesh.Points().End(); pi++) tempmesh.AddLockedPoint (pi); // tempmesh.PrintMemInfo(cout); @@ -1288,8 +1278,7 @@ namespace netgen INDEX_3_CLOSED_HASHTABLE faceht(100); Element2d hel(TRIG); - for (PointIndex pi = PointIndex::BASE; - pi < mesh.GetNP()+PointIndex::BASE; pi++) + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) { faceht.SetSize (4 * elsonpoint[pi].Size()); for (int ii = 0; ii < elsonpoint[pi].Size(); ii++) diff --git a/libsrc/meshing/delaunay2d.cpp b/libsrc/meshing/delaunay2d.cpp index 2b1119f1..82f5b529 100644 --- a/libsrc/meshing/delaunay2d.cpp +++ b/libsrc/meshing/delaunay2d.cpp @@ -94,7 +94,7 @@ namespace netgen { if (meshbox.IsIn (npoints.Get(i))) { - int gpnum = mesh.AddPoint (npoints.Get(i)); + PointIndex gpnum = mesh.AddPoint (npoints.Get(i)); adfront->AddPoint (npoints.Get(i), gpnum); if (debugparam.slowchecks) @@ -149,7 +149,7 @@ namespace netgen { if (meshbox.IsIn (npoints.Get(i))) { - int gpnum = mesh.AddPoint (npoints.Get(i)); + PointIndex gpnum = mesh.AddPoint (npoints.Get(i)); adfront->AddPoint (npoints.Get(i), gpnum); } } diff --git a/libsrc/meshing/geomsearch.cpp b/libsrc/meshing/geomsearch.cpp index dc217a48..5a2192ea 100644 --- a/libsrc/meshing/geomsearch.cpp +++ b/libsrc/meshing/geomsearch.cpp @@ -19,7 +19,7 @@ namespace netgen } } - void GeomSearch3d :: Init (Array *pointsi, Array *facesi) + void GeomSearch3d :: Init (Array *pointsi, Array *facesi) { points = pointsi; faces = facesi; diff --git a/libsrc/meshing/geomsearch.hpp b/libsrc/meshing/geomsearch.hpp index 052073de..d483c823 100644 --- a/libsrc/meshing/geomsearch.hpp +++ b/libsrc/meshing/geomsearch.hpp @@ -22,7 +22,7 @@ public: virtual ~GeomSearch3d(); /// - void Init (Array *pointsi, Array *facesi); + void Init (Array *pointsi, Array *facesi); ///get elements max extension void ElemMaxExt(Point3d& minp, Point3d& maxp, const MiniElement2d& elem); @@ -47,7 +47,7 @@ public: private: Array *faces; // Pointers to Arrays in Adfront - Array *points; + Array *points; Array *> hashtable; diff --git a/libsrc/meshing/improve2.cpp b/libsrc/meshing/improve2.cpp index 51819d37..bd62bdd0 100644 --- a/libsrc/meshing/improve2.cpp +++ b/libsrc/meshing/improve2.cpp @@ -533,8 +533,7 @@ namespace netgen Array,PointIndex::BASE> normals(np); - for (PointIndex pi = PointIndex::BASE; - pi < np + PointIndex::BASE; pi++) + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) { if (elementsonnode[pi].Size()) { diff --git a/libsrc/meshing/improve2gen.cpp b/libsrc/meshing/improve2gen.cpp index e5b65308..fab74c66 100644 --- a/libsrc/meshing/improve2gen.cpp +++ b/libsrc/meshing/improve2gen.cpp @@ -308,7 +308,7 @@ namespace netgen if (el0.GetNP() != rel0.GetNP()) continue; - pmap = -1; + pmap = PointIndex (-1); for (int k = 0; k < el0.GetNP(); k++) { diff --git a/libsrc/meshing/meshclass.hpp b/libsrc/meshing/meshclass.hpp index 50530cb1..d4bb0287 100644 --- a/libsrc/meshing/meshclass.hpp +++ b/libsrc/meshing/meshclass.hpp @@ -13,7 +13,6 @@ namespace netgen { - enum resthtype { RESTRICTH_FACE, RESTRICTH_EDGE, RESTRICTH_SURFACEELEMENT, RESTRICTH_POINT, RESTRICTH_SEGMENT }; @@ -25,16 +24,9 @@ namespace netgen { public: typedef ::netgen::T_POINTS T_POINTS; - - // typedef MoveableArray T_POINTS; - // typedef MoveableArray T_VOLELEMENTS; - // typedef MoveableArray T_SURFELEMENTS; - - // typedef Array T_POINTS; typedef Array T_VOLELEMENTS; typedef Array T_SURFELEMENTS; - private: /// point coordinates T_POINTS points; @@ -105,7 +97,7 @@ namespace netgen /// geometric search tree for interval intersection search Box3dTree * elementsearchtree; /// time stamp for tree - int elementsearchtreets; + mutable int elementsearchtreets; /// element -> face, element -> edge etc ... class MeshTopology * topology; @@ -216,12 +208,7 @@ namespace netgen DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer = 1); DLL_HEADER PointIndex AddPoint (const Point3d & p, int layer, POINTTYPE type); - /* -#ifdef PARALLEL - PointIndex AddPoint (const Point3d & p, bool aisghost, int layer = 1); - PointIndex AddPoint (const Point3d & p, bool aisghost, int layer, POINTTYPE type); -#endif - */ + int GetNP () const { return points.Size(); } MeshPoint & Point(int i) { return points.Elem(i); } @@ -544,22 +531,22 @@ namespace netgen void SetPointSearchStartElement(const int el) const {ps_startelement = el;} /// gives element of point, barycentric coordinates - int GetElementOfPoint (const Point3d & p, + int GetElementOfPoint (const netgen::Point<3> & p, double * lami, bool build_searchtree = 0, const int index = -1, const bool allowindex = true) const; - int GetElementOfPoint (const Point3d & p, + int GetElementOfPoint (const netgen::Point<3> & p, double * lami, const Array * const indices, bool build_searchtree = 0, const bool allowindex = true) const; - int GetSurfaceElementOfPoint (const Point3d & p, + int GetSurfaceElementOfPoint (const netgen::Point<3> & p, double * lami, bool build_searchtree = 0, const int index = -1, const bool allowindex = true) const; - int GetSurfaceElementOfPoint (const Point3d & p, + int GetSurfaceElementOfPoint (const netgen::Point<3> & p, double * lami, const Array * const indices, bool build_searchtree = 0, diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 9dbc8a8c..91002d1b 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -130,8 +130,7 @@ namespace netgen mpquad.check_impossible = qstep == 1; // for prisms only (air domain in trafo) - for (PointIndex pi = PointIndex::BASE; - pi < mesh3d.GetNP()+PointIndex::BASE; pi++) + for (PointIndex pi = mesh3d.Points().Begin(); pi < mesh3d.Points().End(); pi++) meshing.AddPoint (mesh3d[pi], pi); mesh3d.GetIdentifications().GetPairs (0, connectednodes); @@ -174,11 +173,9 @@ namespace netgen mesh3d.FindOpenElements(k); - for (PointIndex pi = PointIndex::BASE; - pi < mesh3d.GetNP()+PointIndex::BASE; pi++) + for (PointIndex pi = mesh3d.Points().Begin(); pi < mesh3d.Points().End(); pi++) meshing.AddPoint (mesh3d[pi], pi); - for (int i = 1; i <= mesh3d.GetNOpenElements(); i++) meshing.AddBoundaryElement (mesh3d.OpenElement(i)); @@ -217,10 +214,8 @@ namespace netgen Array glob2loc(mesh3d.GetNP()); glob2loc = -1; - for (PointIndex pi = PointIndex::BASE; - pi < mesh3d.GetNP()+PointIndex::BASE; pi++) - - if (domain_bbox.IsIn (mesh3d[pi])) + for (PointIndex pi = mesh3d.Points().Begin(); pi < mesh3d.Points().End(); pi++) + if (domain_bbox.IsIn (mesh3d[pi])) glob2loc[pi] = meshing.AddPoint (mesh3d[pi], pi); diff --git a/libsrc/meshing/meshing2.cpp b/libsrc/meshing/meshing2.cpp index 499546ad..8a3c9b0e 100644 --- a/libsrc/meshing/meshing2.cpp +++ b/libsrc/meshing/meshing2.cpp @@ -221,7 +221,6 @@ namespace netgen int z1, z2, oldnp(-1); bool found; int rulenr(-1); - int globind; Point<3> p1, p2; const PointGeomInfo * blgeominfo1; @@ -1243,7 +1242,7 @@ namespace netgen for (int i = oldnp+1; i <= locpoints.Size(); i++) { - globind = mesh.AddPoint (locpoints.Get(i)); + PointIndex globind = mesh.AddPoint (locpoints.Get(i)); pindex.Elem(i) = adfront -> AddPoint (locpoints.Get(i), globind); } diff --git a/libsrc/meshing/meshing3.cpp b/libsrc/meshing/meshing3.cpp index 3421c319..58562d2b 100644 --- a/libsrc/meshing/meshing3.cpp +++ b/libsrc/meshing/meshing3.cpp @@ -190,7 +190,6 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp) int found; referencetransform trans; int rotind; - INDEX globind; Point3d inp; float err; @@ -657,7 +656,7 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp) for (i = oldnp+1; i <= locpoints.Size(); i++) { - globind = mesh.AddPoint (locpoints.Get(i)); + PointIndex globind = mesh.AddPoint (locpoints.Get(i)); pindex.Elem(i) = adfront -> AddPoint (locpoints.Get(i), globind); } @@ -747,7 +746,7 @@ void Meshing3 :: BlockFill (Mesh & mesh, double gh) for (i = 1; i <= adfront->GetNP(); i++) { - const Point3d & p = adfront->GetPoint(i); + const Point3d & p = adfront->GetPoint(PointIndex(i)); if (i == 1) { xmin = xmax = p.X(); @@ -777,7 +776,8 @@ void Meshing3 :: BlockFill (Mesh & mesh, double gh) PrintMessage (5, "n1 = ", n1, " n2 = ", n2, " n3 = ", n3); Array inner(n); - Array pointnr(n), frontpointnr(n); + Array pointnr(n); + Array frontpointnr(n); // initialize inner to 1 @@ -1187,7 +1187,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh, { if (meshbox.IsIn (npoints.Get(i))) { - int gpnum = mesh.AddPoint (npoints.Get(i)); + PointIndex gpnum = mesh.AddPoint (npoints.Get(i)); adfront->AddPoint (npoints.Get(i), gpnum); if (debugparam.slowchecks) @@ -1255,7 +1255,7 @@ void Meshing3 :: BlockFillLocalH (Mesh & mesh, { if (meshbox.IsIn (npoints.Get(i))) { - int gpnum = mesh.AddPoint (npoints.Get(i)); + PointIndex gpnum = mesh.AddPoint (npoints.Get(i)); adfront->AddPoint (npoints.Get(i), gpnum); } } diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index e9cb8c80..ceaed59d 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -120,11 +120,16 @@ namespace netgen PointIndex () { ; } PointIndex (int ai) : i(ai) { ; } PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; } - PointIndex & operator= (int ai) { i = ai; return *this; } + // PointIndex & operator= (int ai) { i = ai; return *this; } operator int () const { return i; } - int GetInt () const { return i; } - PointIndex operator++ (int) { int hi = i; i++; return PointIndex(hi); } - PointIndex operator-- (int) { int hi = i; i--; return PointIndex(hi); } + // int GetInt () const { return i; } + // PointIndex operator+ (int i2) { return PointIndex (i+i2); } + // PointIndex operator++ (int) { int hi = i; i++; return PointIndex(hi); } + // PointIndex operator-- (int) { int hi = i; i--; return PointIndex(hi); } + PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; } + PointIndex operator-- (int) { PointIndex hi(*this); i--; return hi; } + PointIndex operator++ () { i++; return *this; } + PointIndex operator-- () { i--; return *this; } #ifdef BASE0 enum { BASE = 0 }; @@ -140,7 +145,7 @@ namespace netgen inline ostream & operator<< (ostream & ost, const PointIndex & pi) { - return (ost << pi.GetInt()); + return (ost << int(pi)); } @@ -275,7 +280,7 @@ namespace netgen - typedef Array T_POINTS; + typedef Array T_POINTS; @@ -371,6 +376,9 @@ namespace netgen /// const PointIndex & operator[] (int i) const { return pnum[i]; } + FlatArray PNums () const + { return FlatArray (np, &pnum[0]); } + /// PointIndex & PNum (int i) { return pnum[i-1]; } /// @@ -618,6 +626,9 @@ namespace netgen /// const PointIndex & operator[] (int i) const { return pnum[i]; } + FlatArray PNums () const + { return FlatArray (np, &pnum[0]); } + /// PointIndex & PNum (int i) { return pnum[i-1]; } /// diff --git a/libsrc/meshing/refine.cpp b/libsrc/meshing/refine.cpp index 403e4532..aeae9e41 100644 --- a/libsrc/meshing/refine.cpp +++ b/libsrc/meshing/refine.cpp @@ -18,7 +18,7 @@ namespace netgen mesh.SetNP(mesh.GetNV()); - INDEX_2_HASHTABLE between(mesh.GetNP() + 5); + INDEX_2_HASHTABLE between(mesh.GetNP() + 5); int oldne, oldns, oldnf; @@ -87,7 +87,7 @@ namespace netgen case TRIG: case TRIG6: { - ArrayMem pnums(6); + ArrayMem pnums(6); ArrayMem pgis(6); static int betw[3][3] = @@ -162,7 +162,7 @@ namespace netgen case QUAD6: case QUAD8: { - ArrayMem pnums(9); + ArrayMem pnums(9); ArrayMem pgis(9); static int betw[5][3] = @@ -253,7 +253,7 @@ namespace netgen case TET: case TET10: { - ArrayMem pnums(10); + ArrayMem pnums(10); static int betw[6][3] = { { 1, 2, 5 }, { 1, 3, 6 }, @@ -334,7 +334,7 @@ namespace netgen } case HEX: { - ArrayMem pnums(27); + ArrayMem pnums(27); static int betw[13][3] = { { 1, 2, 9 }, { 3, 4, 10 }, @@ -384,10 +384,10 @@ namespace netgen { 17, 20, 27 }, }; - pnums = -1; + pnums = PointIndex(-1); for (j = 1; j <= 8; j++) - pnums.Elem(j) = el.PNum(j); + pnums.Elem(j) = el.PNum(j); for (j = 0; j < 13; j++) @@ -460,7 +460,7 @@ namespace netgen } case PRISM: { - ArrayMem pnums(18); + ArrayMem pnums(18); static int betw[9][3] = { { 3, 1, 7 }, { 1, 2, 8 }, @@ -494,9 +494,9 @@ namespace netgen }; //int elrev = el.flags.reverse; - pnums = -1; - - for (j = 1; j <= 6; j++) + pnums = PointIndex(-1); + + for (j = 1; j <= 6; j++) pnums.Elem(j) = el.PNum(j); // if (elrev) // swap (pnums.Elem(3), pnums.Elem(4)); @@ -594,14 +594,14 @@ namespace netgen for (int k = 1; k <= between.GetBagSize(j); k++) { INDEX_2 i2; - int newpi; + PointIndex newpi; between.GetData (j, k, i2, newpi); INDEX_2 oi2(identmap.Get(i2.I1()), identmap.Get(i2.I2())); oi2.Sort(); if (between.Used (oi2)) { - int onewpi = between.Get(oi2); + PointIndex onewpi = between.Get(oi2); mesh.GetIdentifications().Add (newpi, onewpi, i); } } @@ -638,7 +638,7 @@ namespace netgen for (int j = 1; j <= between.GetBagSize(i); j++) { INDEX_2 parent; - int child; + PointIndex child; between.GetData (i, j, parent, child); can.Elem(child) = Center (can.Elem(parent.I1()), can.Elem(parent.I2())); diff --git a/libsrc/meshing/secondorder.cpp b/libsrc/meshing/secondorder.cpp index c5f21c6b..7cd2205a 100644 --- a/libsrc/meshing/secondorder.cpp +++ b/libsrc/meshing/secondorder.cpp @@ -18,7 +18,7 @@ namespace netgen mesh.ComputeNVertices(); mesh.SetNP(mesh.GetNV()); - INDEX_2_HASHTABLE between(mesh.GetNP() + 5); + INDEX_2_HASHTABLE between(mesh.GetNP() + 5); bool thinlayers = 0; @@ -235,18 +235,18 @@ namespace netgen Array identmap; mesh.GetIdentifications().GetMap (i, identmap); - for (INDEX_2_HASHTABLE::Iterator it = between.Begin(); + for (INDEX_2_HASHTABLE::Iterator it = between.Begin(); it != between.End(); it++) { INDEX_2 i2; - int newpi; + PointIndex newpi; between.GetData (it, i2, newpi); INDEX_2 oi2(identmap.Get(i2.I1()), identmap.Get(i2.I2())); oi2.Sort(); if (between.Used (oi2)) { - int onewpi = between.Get(oi2); + PointIndex onewpi = between.Get(oi2); mesh.GetIdentifications().Add (newpi, onewpi, i); } } @@ -288,7 +288,7 @@ namespace netgen } */ - for (INDEX_2_HASHTABLE::Iterator it = between.Begin(); + for (INDEX_2_HASHTABLE::Iterator it = between.Begin(); it != between.End(); it++) { mesh.mlbetweennodes[between.GetData (it)] = between.GetHash(it); diff --git a/libsrc/meshing/smoothing2.5.cpp b/libsrc/meshing/smoothing2.5.cpp index c9de8e21..2ab5c24c 100644 --- a/libsrc/meshing/smoothing2.5.cpp +++ b/libsrc/meshing/smoothing2.5.cpp @@ -141,8 +141,7 @@ namespace netgen Array locelements(0); Array locrots(0); - for (PointIndex pi = PointIndex::BASE; - pi < mesh.GetNP()+PointIndex::BASE; pi++) + for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++) { if (mesh[pi].Type() != SURFACEPOINT) continue; diff --git a/libsrc/meshing/smoothing3.cpp b/libsrc/meshing/smoothing3.cpp index bf295884..24f1ef71 100644 --- a/libsrc/meshing/smoothing3.cpp +++ b/libsrc/meshing/smoothing3.cpp @@ -106,9 +106,9 @@ namespace netgen { const INDEX_3 & el = faces[j]; - double bad = CalcTetBadness (points[el.I1()], - points[el.I3()], - points[el.I2()], + double bad = CalcTetBadness (points[PointIndex (el.I1())], + points[PointIndex (el.I3())], + points[PointIndex (el.I2())], pp, 0, mp); badness += bad; } @@ -202,9 +202,9 @@ namespace netgen for (int i = 1; i <= nf; i++) { - const Point3d & p1 = points[faces.Get(i).I1()]; - const Point3d & p2 = points[faces.Get(i).I2()]; - const Point3d & p3 = points[faces.Get(i).I3()]; + const Point3d & p1 = points[PointIndex(faces.Get(i).I1())]; + const Point3d & p2 = points[PointIndex(faces.Get(i).I2())]; + const Point3d & p3 = points[PointIndex(faces.Get(i).I3())]; Vec3d v1 (p1, p2); Vec3d v2 (p1, p3); Vec3d n; @@ -500,7 +500,7 @@ namespace netgen int ne = elementsonpoint[actpind].Size(); int i, j; - int pi1, pi2, pi3; + PointIndex pi1, pi2, pi3; m.SetSize (ne, 4); @@ -1383,7 +1383,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) bad1 += hbad; } - for (PointIndex i = PointIndex::BASE; i < np+PointIndex::BASE; i++) + for (int i = perrs.Begin(); i < perrs.End(); i++) if (perrs[i] > badmax) badmax = perrs[i]; badmax = 0; @@ -1456,14 +1456,13 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) const char * savetask = multithread.task; multithread.task = "Smooth Mesh"; - for (PointIndex i = PointIndex::BASE; - i < points.Size()+PointIndex::BASE; i++) - if ( (*this)[i].Type() == INNERPOINT && perrs[i] > 0.01 * badmax) + for (PointIndex pi = points.Begin(); pi < points.End(); pi++) + if ( (*this)[pi].Type() == INNERPOINT && perrs[pi] > 0.01 * badmax) { if (multithread.terminate) throw NgException ("Meshing stopped"); - multithread.percent = 100.0 * (i+1-PointIndex::BASE) / points.Size(); + multithread.percent = 100.0 * (pi+1-PointIndex::BASE) / points.Size(); /* if (points.Size() < 1000) PrintDot (); @@ -1471,14 +1470,14 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) if ( (i+1-PointIndex::BASE) % 10 == 0) PrintDot ('+'); */ - if ( (i+1-PointIndex::BASE) % printmod == 0) PrintDot (printdot); + if ( (pi+1-PointIndex::BASE) % printmod == 0) PrintDot (printdot); - double lh = pointh[i]; + double lh = pointh[pi]; pf->SetLocalH (lh); par.typx = lh; - freeminf.SetPoint (points[i]); - pf->SetPointIndex (i); + freeminf.SetPoint (points[pi]); + pf->SetPointIndex (pi); x = 0; int pok; @@ -1488,8 +1487,8 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) { pok = pf->MovePointToInner (); - freeminf.SetPoint (points[i]); - pf->SetPointIndex (i); + freeminf.SetPoint (points[pi]); + pf->SetPointIndex (pi); } if (pok) @@ -1497,9 +1496,9 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal) //*testout << "start BFGS, pok" << endl; BFGS (x, freeminf, par); //*testout << "BFGS complete, pok" << endl; - points[i](0) += x(0); - points[i](1) += x(1); - points[i](2) += x(2); + points[pi](0) += x(0); + points[pi](1) += x(1); + points[pi](2) += x(2); } } PrintDot ('\n'); @@ -1581,9 +1580,9 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp, const char * savetask = multithread.task; multithread.task = "Smooth Mesh Jacobian"; - for (i = 1; i <= points.Size(); i++) + for (PointIndex pi = points.Begin(); i < points.End(); pi++) { - if ((*this)[PointIndex(i)].Type() != INNERPOINT) + if ((*this)[pi].Type() != INNERPOINT) continue; if(usepoint && !usepoint->Test(i)) @@ -1613,7 +1612,7 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp, double lh = pointh[i]; par.typx = lh; - pf.SetPointIndex (i); + pf.SetPointIndex (pi); x = 0; int pok = (pf.Func (x) < 1e10); @@ -1735,7 +1734,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp, const char * savetask = multithread.task; multithread.task = "Smooth Mesh Jacobian"; - for (i = 1; i <= points.Size(); i++) + for (PointIndex pi = points.Begin(); pi <= points.End(); pi++) if ( usepoint.Test(i) ) { //(*testout) << "improvejac, p = " << i << endl; @@ -1762,9 +1761,9 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp, double lh = pointh[i];//GetH(points.Get(i)); par.typx = lh; - pf.SetPointIndex (i); + pf.SetPointIndex (pi); - int brother = -1; + PointIndex brother (-1); if(usesum) { for(j=0; brother == -1 && jSize(); j++) diff --git a/libsrc/meshing/specials.cpp b/libsrc/meshing/specials.cpp index 0a218e10..3d0dbbdd 100644 --- a/libsrc/meshing/specials.cpp +++ b/libsrc/meshing/specials.cpp @@ -126,7 +126,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh) for (j = 1; j <= 3; j++) locked.Clear (mesh.OpenElement(i).PNum(j)); - for (i = 1; i <= locked.Size(); i++) + for (PointIndex i (1); i <= locked.Size(); i++) if (locked.Test(i)) { mesh.AddLockedPoint (i); @@ -135,7 +135,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh) - Array pmat(onp); + Array pmat(onp); for (i = 1; i <= onp; i++) pmat.Elem(i) = mesh.AddPoint (othermesh.Point(i)); diff --git a/libsrc/meshing/topology.cpp b/libsrc/meshing/topology.cpp index 2c95b9f9..263fec94 100644 --- a/libsrc/meshing/topology.cpp +++ b/libsrc/meshing/topology.cpp @@ -48,16 +48,6 @@ namespace netgen vert2surfelement = 0; vert2segment = 0; timestamp = -1; - - edge2vert.SetName ("edge2vert"); - face2vert.SetName ("face2vert"); - edges.SetName ("el2edge"); - faces.SetName ("el2face"); - surfedges.SetName ("surfel2edge"); - segedges.SetName ("segment2edge"); - surffaces.SetName ("surfel2face"); - surf2volelement.SetName ("surfel2el"); - face2surfel.SetName ("face2surfel"); } MeshTopology :: ~MeshTopology () diff --git a/libsrc/meshing/topology.hpp b/libsrc/meshing/topology.hpp index 5f2bdb79..9339784d 100644 --- a/libsrc/meshing/topology.hpp +++ b/libsrc/meshing/topology.hpp @@ -19,15 +19,15 @@ class MeshTopology bool buildedges; bool buildfaces; - MoveableArray edge2vert; - MoveableArray face2vert; - MoveableArray edges; - MoveableArray faces; - MoveableArray surfedges; - MoveableArray segedges; - MoveableArray surffaces; - MoveableArray surf2volelement; - MoveableArray face2surfel; + Array edge2vert; + Array face2vert; + Array edges; + Array faces; + Array surfedges; + Array segedges; + Array surffaces; + Array surf2volelement; + Array face2surfel; TABLE *vert2element; TABLE *vert2surfelement; TABLE *vert2segment; diff --git a/libsrc/meshing/zrefine.cpp b/libsrc/meshing/zrefine.cpp index 0032528e..d9d754e1 100644 --- a/libsrc/meshing/zrefine.cpp +++ b/libsrc/meshing/zrefine.cpp @@ -147,11 +147,11 @@ namespace netgen for (j = 0; j <= 1; j++) { - int pi1 = el.PNum( (j+0) % 4 + 1); - int pi2 = el.PNum( (j+1) % 4 + 1); - int pi3 = el.PNum( (j+2) % 4 + 1); - int pi4 = el.PNum( (j+3) % 4 + 1); - int pi5 = el.PNum(5); + PointIndex pi1 = el.PNum( (j+0) % 4 + 1); + PointIndex pi2 = el.PNum( (j+1) % 4 + 1); + PointIndex pi3 = el.PNum( (j+2) % 4 + 1); + PointIndex pi4 = el.PNum( (j+3) % 4 + 1); + PointIndex pi5 = el.PNum(5); INDEX_2 edge1(pi1, pi4); INDEX_2 edge2(pi2, pi3);