more PointIndex

This commit is contained in:
Joachim Schoeberl 2024-12-14 21:59:49 +01:00
parent 07191d6e1b
commit b560719a47
3 changed files with 39 additions and 39 deletions

View File

@ -952,7 +952,7 @@ namespace netgen
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
for (int j = i+1; j < 3; j++) for (int j = i+1; j < 3; j++)
{ {
INDEX_2 i2(mp.pnums[i], mp.pnums[j]); PointIndices<2> i2(mp.pnums[i], mp.pnums[j]);
i2.Sort(); i2.Sort();
int hval = edgenumber.Get(i2); int hval = edgenumber.Get(i2);
if (hval > val) if (hval > val)
@ -1035,7 +1035,7 @@ namespace netgen
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
for (int j = i+1; j < 3; j++) for (int j = i+1; j < 3; j++)
{ {
INDEX_2 i2(mt.pnums[i], mt.pnums[j]); PointIndices<2> i2(mt.pnums[i], mt.pnums[j]);
i2.Sort(); i2.Sort();
int hval = edgenumber.Get(i2); int hval = edgenumber.Get(i2);
if (hval > val) if (hval > val)
@ -1124,7 +1124,7 @@ namespace netgen
double hshould = 1e10; double hshould = 1e10;
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
{ {
double hi = hv (mtets[i-1].pnums[j]-1); double hi = hv (mtets[i-1].pnums[j]-IndexBASE<PointIndex>());
if (hi < hshould) if (hi < hshould)
hshould = hi; hshould = hi;
} }
@ -1164,7 +1164,7 @@ namespace netgen
double hshould = 1e10; double hshould = 1e10;
for (int j = 0; j < 6; j++) for (int j = 0; j < 6; j++)
{ {
double hi = hv (mprisms.Get(i).pnums[j]-1); double hi = hv (mprisms.Get(i).pnums[j]-IndexBASE<PointIndex>());
if (hi < hshould) if (hi < hshould)
hshould = hi; hshould = hi;
} }
@ -1215,7 +1215,7 @@ namespace netgen
void BTBisectTet (const MarkedTet & oldtet, int newp, void BTBisectTet (const MarkedTet & oldtet, PointIndex newp,
MarkedTet & newtet1, MarkedTet & newtet2) MarkedTet & newtet1, MarkedTet & newtet2)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -1356,7 +1356,7 @@ namespace netgen
void BTBisectPrism (const MarkedPrism & oldprism, int newp1, int newp2, void BTBisectPrism (const MarkedPrism & oldprism, PointIndex newp1, PointIndex newp2,
MarkedPrism & newprism1, MarkedPrism & newprism2) MarkedPrism & newprism1, MarkedPrism & newprism2)
{ {
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
@ -1450,7 +1450,7 @@ namespace netgen
void BTBisectTri (const MarkedTri & oldtri, int newp, const PointGeomInfo & newpgi, void BTBisectTri (const MarkedTri & oldtri, PointIndex newp, const PointGeomInfo & newpgi,
MarkedTri & newtri1, MarkedTri & newtri2) MarkedTri & newtri1, MarkedTri & newtri2)
{ {
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
@ -1492,8 +1492,8 @@ namespace netgen
void BTBisectQuad (const MarkedQuad & oldquad, void BTBisectQuad (const MarkedQuad & oldquad,
int newp1, const PointGeomInfo & npgi1, PointIndex newp1, const PointGeomInfo & npgi1,
int newp2, const PointGeomInfo & npgi2, PointIndex newp2, const PointGeomInfo & npgi2,
MarkedQuad & newquad1, MarkedQuad & newquad2) MarkedQuad & newquad1, MarkedQuad & newquad2)
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
@ -1602,10 +1602,10 @@ namespace netgen
const int np = mids.Get(i).np; const int np = mids.Get(i).np;
for(int j = 0; j < np; j++) for(int j = 0; j < np; j++)
{ {
INDEX_2 edge1(mids.Get(i).pnums[j], PointIndices<2> edge1(mids.Get(i).pnums[j],
mids.Get(i).pnums[(j+1) % np]); mids.Get(i).pnums[(j+1) % np]);
INDEX_2 edge2(mids.Get(i).pnums[j+np], PointIndices<2> edge2(mids.Get(i).pnums[j+np],
mids.Get(i).pnums[((j+1) % np) + np]); mids.Get(i).pnums[((j+1) % np) + np]);
edge1.Sort(); edge1.Sort();
edge2.Sort(); edge2.Sort();
@ -1707,8 +1707,8 @@ namespace netgen
for (int j = 0; j < 3; j++) for (int j = 0; j < 3; j++)
for (int k = j+1; k < 4; k++) for (int k = j+1; k < 4; k++)
{ {
INDEX_2 edge(teti.pnums[j], PointIndices<2> edge(teti.pnums[j],
teti.pnums[k]); teti.pnums[k]);
edge.Sort(); edge.Sort();
if (cutedges.Used (edge)) if (cutedges.Used (edge))
{ {
@ -1740,10 +1740,10 @@ namespace netgen
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
for (int k = j+1; k < 3; k++) for (int k = j+1; k < 3; k++)
{ {
INDEX_2 edge1(mprisms.Get(i).pnums[j], PointIndices<2> edge1(mprisms.Get(i).pnums[j],
mprisms.Get(i).pnums[k]); mprisms.Get(i).pnums[k]);
INDEX_2 edge2(mprisms.Get(i).pnums[j+3], PointIndices<2> edge2(mprisms.Get(i).pnums[j+3],
mprisms.Get(i).pnums[k+3]); mprisms.Get(i).pnums[k+3]);
edge1.Sort(); edge1.Sort();
edge2.Sort(); edge2.Sort();
if (cutedges.Used (edge1) || if (cutedges.Used (edge1) ||
@ -1781,8 +1781,8 @@ namespace netgen
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
for (int k = j+1; k < 3; k++) for (int k = j+1; k < 3; k++)
{ {
INDEX_2 edge(tri.pnums[j], PointIndices<2> edge(tri.pnums[j],
tri.pnums[k]); tri.pnums[k]);
edge.Sort(); edge.Sort();
if (cutedges.Used (edge)) if (cutedges.Used (edge))
{ {
@ -1810,10 +1810,10 @@ namespace netgen
continue; continue;
} }
INDEX_2 edge1(mquads.Get(i).pnums[0], PointIndices<2> edge1(mquads.Get(i).pnums[0],
mquads.Get(i).pnums[1]); mquads.Get(i).pnums[1]);
INDEX_2 edge2(mquads.Get(i).pnums[2], PointIndices<2> edge2(mquads.Get(i).pnums[2],
mquads.Get(i).pnums[3]); mquads.Get(i).pnums[3]);
edge1.Sort(); edge1.Sort();
edge2.Sort(); edge2.Sort();
if (cutedges.Used (edge1) || if (cutedges.Used (edge1) ||
@ -1826,10 +1826,10 @@ namespace netgen
} }
// he/sz: second case: split horizontally // he/sz: second case: split horizontally
INDEX_2 edge3(mquads.Get(i).pnums[1], PointIndices<2> edge3(mquads.Get(i).pnums[1],
mquads.Get(i).pnums[3]); mquads.Get(i).pnums[3]);
INDEX_2 edge4(mquads.Get(i).pnums[2], PointIndices<2> edge4(mquads.Get(i).pnums[2],
mquads.Get(i).pnums[0]); mquads.Get(i).pnums[0]);
edge3.Sort(); edge3.Sort();
edge4.Sort(); edge4.Sort();
@ -2024,7 +2024,7 @@ namespace netgen
{ {
for (int j = 1; j <= 3; j++) for (int j = 1; j <= 3; j++)
{ {
INDEX_2 se(el.PNum(j), el.PNum(j+3)); PointIndices<2> se(el.PNum(j), el.PNum(j+3));
se.Sort(); se.Sort();
shortedges.Set (se, 1); shortedges.Set (se, 1);
} }
@ -2054,7 +2054,7 @@ namespace netgen
for (int j = 1; j <= 3; j++) for (int j = 1; j <= 3; j++)
for (int k = j+1; k <= 4; k++) for (int k = j+1; k <= 4; k++)
{ {
INDEX_2 se(el.PNum(j), el.PNum(k)); PointIndices<2> se(el.PNum(j), el.PNum(k));
se.Sort(); se.Sort();
if (shortedges.Used (se)) if (shortedges.Used (se))
{ {
@ -2109,7 +2109,7 @@ namespace netgen
// eventually rotate // eventually rotate
MarkedPrism mp; MarkedPrism mp;
INDEX_2 se(el.PNum(1), el.PNum(2)); PointIndices<2> se(el.PNum(1), el.PNum(2));
se.Sort(); se.Sort();
if (shortedges.Used (se)) if (shortedges.Used (se))
{ {
@ -2521,7 +2521,7 @@ namespace netgen
//(*testout) << "old mt " << mt; //(*testout) << "old mt " << mt;
INDEX_2 edge (mt.pnums[mt.tetedge1],mt.pnums[mt.tetedge2]); PointIndices<2> edge (mt.pnums[mt.tetedge1],mt.pnums[mt.tetedge2]);
edge.Sort(); edge.Sort();
if(edgenumber.Used(edge)) if(edgenumber.Used(edge))
{ {

View File

@ -41,18 +41,18 @@ namespace netgen
void IdentifyVerticesAfterRefinement(); void IdentifyVerticesAfterRefinement();
void EnumeratePointsGlobally (); void EnumeratePointsGlobally ();
void AddDistantProc (PointIndex pi, int proc) { loc2distvert.AddUnique (pi-PointIndex::BASE, proc); } void AddDistantProc (PointIndex pi, int proc) { loc2distvert.AddUnique (pi-IndexBASE<PointIndex>(), proc); }
void AddDistantFaceProc (int edge, int proc) { loc2distface.AddUnique (edge, proc); } void AddDistantFaceProc (int edge, int proc) { loc2distface.AddUnique (edge, proc); }
void AddDistantEdgeProc (int face, int proc) { loc2distedge.AddUnique (face, proc); } void AddDistantEdgeProc (int face, int proc) { loc2distedge.AddUnique (face, proc); }
FlatArray<int> GetDistantProcs (PointIndex pi) const { return loc2distvert[pi-PointIndex::BASE]; } FlatArray<int> GetDistantProcs (PointIndex pi) const { return loc2distvert[pi-IndexBASE<PointIndex>()]; }
FlatArray<int> GetDistantFaceProcs (int locnum) const { return loc2distface[locnum]; } FlatArray<int> GetDistantFaceProcs (int locnum) const { return loc2distface[locnum]; }
FlatArray<int> GetDistantEdgeProcs (int locnum) const { return loc2distedge[locnum]; } FlatArray<int> GetDistantEdgeProcs (int locnum) const { return loc2distedge[locnum]; }
auto & L2G (PointIndex pi) { return glob_vert[pi-PointIndex::BASE]; } auto & L2G (PointIndex pi) { return glob_vert[pi-IndexBASE<PointIndex>()]; }
auto L2G (PointIndex pi) const { return glob_vert[pi-PointIndex::BASE]; } auto L2G (PointIndex pi) const { return glob_vert[pi-IndexBASE<PointIndex>()]; }
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert... /// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
@ -90,7 +90,7 @@ namespace netgen
void SetLoc2Glob_Segm (int locnum, int globnum) { glob_segm[locnum-1] = globnum; } void SetLoc2Glob_Segm (int locnum, int globnum) { glob_segm[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]] // [[deprecated("Try to avoid global enumration!")]]
int GetGlobalPNum (PointIndex locnum) const { return glob_vert[locnum-PointIndex::BASE]; } int GetGlobalPNum (PointIndex locnum) const { return glob_vert[locnum-IndexBASE<PointIndex>()]; }
[[deprecated("Try to avoid global enumration!")]] [[deprecated("Try to avoid global enumration!")]]
int GetGlobalEdgeNum (int locnum) const { return glob_edge[locnum-1]; } int GetGlobalEdgeNum (int locnum) const { return glob_edge[locnum-1]; }
[[deprecated("Try to avoid global enumration!")]] [[deprecated("Try to avoid global enumration!")]]

View File

@ -175,7 +175,7 @@ public:
PointIndex GetPointNr (int fn, int endp) const PointIndex GetPointNr (int fn, int endp) const
{ return faces.Get(fn).PNum(endp); } { return faces.Get(fn).PNum(endp); }
/// ///
int GetPointNrMod (int fn, int endp) const PointIndex GetPointNrMod (int fn, int endp) const
{ return faces.Get(fn).PNumMod(endp); } { return faces.Get(fn).PNumMod(endp); }
/// ///
const fourint & GetOrientation (int i) { return orientations.Get(i); } const fourint & GetOrientation (int i) { return orientations.Get(i); }