fixes for PointIndex::BASE=0

This commit is contained in:
Joachim Schoeberl 2024-12-28 00:11:26 +01:00
parent ceddf31f87
commit 2291221719
5 changed files with 15 additions and 13 deletions

View File

@ -278,7 +278,7 @@ namespace netgen
mesh2d.AddLockedPoint(npi);
Element0d el(npi, npi);
el.name = point.name;
mesh2d.SetCD2Name(npi, point.name);
mesh2d.SetCD2Name(npi-IndexBASE<PointIndex>()+1, point.name);
mesh2d.pointelements.Append (el);
searchtree.Insert (newp, npi);
}
@ -303,9 +303,9 @@ namespace netgen
npi = mesh2d.AddPoint (newp, layer);
searchtree.Insert (newp, npi);
mesh2d.AddLockedPoint(npi);
Element0d el(npi, npi);
Element0d el(npi, npi-IndexBASE<PointIndex>()+1);
el.name = "";
mesh2d.SetCD2Name(npi, "");
mesh2d.SetCD2Name(npi-IndexBASE<PointIndex>()+1, "");
mesh2d.pointelements.Append (el);
}
}

View File

@ -3495,8 +3495,8 @@ namespace netgen
}
else
{
Point<3> npt = Center (mesh.Point (edge.I1()),
mesh.Point (edge.I2()));
Point<3> npt = Center (mesh.Point (edge[0]),
mesh.Point (edge[1]));
newp = mesh.AddPoint (npt);
cutedges.Set (edge, newp);
geo.PointBetween (mesh.Point (oldpi1), mesh.Point (oldpi2),

View File

@ -4075,7 +4075,7 @@ namespace netgen
*/
for (int i = 0; i < volelements.Size(); i++)
if (volelements[i][0] <= PointIndex::BASE-1 ||
if (!volelements[i][0].IsValid() ||
volelements[i].IsDeleted())
{
volelements.DeleteElement(i);
@ -4091,7 +4091,7 @@ namespace netgen
}
for (int i = 0; i < segments.Size(); i++)
if (segments[i][0] <= PointIndex::BASE-1)
if (!segments[i][0].IsValid())
{
segments.DeleteElement(i);
i--;
@ -7010,8 +7010,8 @@ namespace netgen
for (int i = mlold+PointIndex::BASE;
i < np+PointIndex::BASE; i++)
{
mlbetweennodes[i].I1() = PointIndex::BASE-1;
mlbetweennodes[i].I2() = PointIndex::BASE-1;
mlbetweennodes[i][0].Invalidate();
mlbetweennodes[i][1].Invalidate();
}
GetIdentifications().SetMaxPointNr (np + PointIndex::BASE-1);

View File

@ -194,6 +194,8 @@ namespace netgen
}
*/
// #define BASE0
class PointIndex
{

View File

@ -480,15 +480,15 @@ namespace netgen
// for (int i = mesh->mlbetweennodes.Begin(); i < mesh->mlbetweennodes.End(); i++)
for (int i : mesh->mlbetweennodes.Range())
{
INDEX_2 parents = Sort (mesh->mlbetweennodes[i]);
if (parents[0] >= PointIndex::BASE) cnt[parents[0]]++;
PointIndices<2> parents = Sort (mesh->mlbetweennodes[i]);
if (parents[0].IsValid()) cnt[parents[0]]++;
}
TABLE<int,PointIndex::BASE> vert2vertcoarse (cnt);
// for (int i = mesh->mlbetweennodes.Begin(); i < mesh->mlbetweennodes.End(); i++)
for (int i : mesh->mlbetweennodes.Range())
{
INDEX_2 parents = Sort (mesh->mlbetweennodes[i]);
if (parents[0] >= PointIndex::BASE) vert2vertcoarse.AddSave (parents[0], parents[1]);
PointIndices<2> parents = Sort (mesh->mlbetweennodes[i]);
if (parents[0].IsValid()) vert2vertcoarse.AddSave (parents[0], parents[1]);
}