more ElementIndex

This commit is contained in:
Joachim Schoeberl 2024-12-30 10:24:05 +01:00
parent 16962aea69
commit e57cc13047
5 changed files with 26 additions and 19 deletions

View File

@ -3087,13 +3087,14 @@ namespace netgen
{ {
ElementIndex cnttet = IndexBASE<ElementIndex>(); ElementIndex cnttet = IndexBASE<ElementIndex>();
int cntprism = 0; int cntprism = 0;
for (int i = 1; i <= mesh.GetNE(); i++) // for (int i = 1; i <= mesh.GetNE(); i++)
for (auto ei : mesh.VolumeElements().Range())
{ {
if (mesh.VolumeElement(i).GetType() == TET || if (mesh.VolumeElement(ei).GetType() == TET ||
mesh.VolumeElement(i).GetType() == TET10) mesh.VolumeElement(ei).GetType() == TET10)
{ {
mtets[cnttet].marked = mtets[cnttet].marked =
(opt.onlyonce ? 3 : 1) * mesh.VolumeElement(i).TestRefinementFlag(); (opt.onlyonce ? 3 : 1) * mesh.VolumeElement(ei).TestRefinementFlag();
if (mtets[cnttet].marked) if (mtets[cnttet].marked)
cntm++; cntm++;
cnttet++; cnttet++;
@ -3102,7 +3103,7 @@ namespace netgen
{ {
cntprism++; cntprism++;
mprisms.Elem(cntprism).marked = mprisms.Elem(cntprism).marked =
2 * mesh.VolumeElement(i).TestRefinementFlag(); 2 * mesh.VolumeElement(ei).TestRefinementFlag();
if (mprisms.Elem(cntprism).marked) if (mprisms.Elem(cntprism).marked)
cntm++; cntm++;
} }

View File

@ -994,7 +994,7 @@ namespace netgen
NgArray<int> & segment_weights){ } NgArray<int> & segment_weights){ }
#endif #endif
NgArray<int> vol_partition; Array<int, ElementIndex> vol_partition;
NgArray<int> surf_partition; NgArray<int> surf_partition;
NgArray<int> seg_partition; NgArray<int> seg_partition;

View File

@ -362,7 +362,8 @@ namespace netgen
meshing.GenerateMesh (mesh, mpquad); meshing.GenerateMesh (mesh, mpquad);
for (int i = oldne + 1; i <= mesh.GetNE(); i++) // for (int i = oldne + 1; i <= mesh.GetNE(); i++)
for (ElementIndex i : mesh.VolumeElements().Range().Modify(oldne, 0))
mesh.VolumeElement(i).SetIndex (domain); mesh.VolumeElement(i).SetIndex (domain);
(*testout) (*testout)
@ -409,7 +410,8 @@ namespace netgen
md.meshing->Delaunay (mesh, domain, mp); md.meshing->Delaunay (mesh, domain, mp);
for (int i = oldne + 1; i <= mesh.GetNE(); i++) // for (int i = oldne + 1; i <= mesh.GetNE(); i++)
for (ElementIndex i : mesh.VolumeElements().Range().Modify(oldne, 0))
mesh.VolumeElement(i).SetIndex (domain); mesh.VolumeElement(i).SetIndex (domain);
PrintMessage (3, mesh.GetNP(), " points, ", PrintMessage (3, mesh.GetNP(), " points, ",

View File

@ -854,9 +854,10 @@ namespace netgen
TBitArray<PointIndex> free (mesh.GetNP()), fhelp(mesh.GetNP()); TBitArray<PointIndex> free (mesh.GetNP()), fhelp(mesh.GetNP());
free.Clear(); free.Clear();
for (int i = 1; i <= mesh.GetNE(); i++) // for (int i = 1; i <= mesh.GetNE(); i++)
for (ElementIndex ei : mesh.VolumeElements().Range())
{ {
const Element & el = mesh.VolumeElement(i); const Element & el = mesh.VolumeElement(ei);
if (el.Volume(mesh.Points()) < 0) if (el.Volume(mesh.Points()) < 0)
for (int j = 1; j <= el.GetNP(); j++) for (int j = 1; j <= el.GetNP(); j++)
free.SetBit (el.PNum(j)); free.SetBit (el.PNum(j));

View File

@ -207,9 +207,10 @@ namespace netgen
// refine volume elements // refine volume elements
for (int i = 1; i <= mesh.GetNE(); i++) // for (int i = 1; i <= mesh.GetNE(); i++)
for (ElementIndex ei : mesh.VolumeElements().Range())
{ {
const Element & el = mesh.VolumeElement(i); const Element & el = mesh.VolumeElement(ei);
int onp = 0; int onp = 0;
Element newel(TET); Element newel(TET);
@ -342,7 +343,7 @@ namespace netgen
} }
} }
mesh.VolumeElement (i) = newel; mesh.VolumeElement (ei) = newel;
} }
@ -430,9 +431,10 @@ namespace netgen
for (int i = 1; i <= np; i++) for (int i = 1; i <= np; i++)
parents.Elem(i) = INDEX_2(0,0); parents.Elem(i) = INDEX_2(0,0);
for (int i = 1; i <= ne; i++) // for (int i = 1; i <= ne; i++)
for (ElementIndex ei : mesh.VolumeElements().Range())
{ {
const Element & el = mesh.VolumeElement(i); const Element & el = mesh[ei];
if (el.GetType() == TET10) if (el.GetType() == TET10)
{ {
static int betweentab[6][3] = static int betweentab[6][3] =
@ -469,14 +471,15 @@ namespace netgen
int cnttrials = 100; int cnttrials = 100;
int wrongels = 0; int wrongels = 0;
for (int i = 1; i <= ne; i++) // for (int i = 1; i <= ne; i++)
if (mesh.VolumeElement(i).CalcJacobianBadness (mesh.Points()) > 1e10) for (ElementIndex ei : mesh.VolumeElements().Range())
if (mesh.VolumeElement(ei).CalcJacobianBadness (mesh.Points()) > 1e10)
{ {
wrongels++; wrongels++;
mesh.VolumeElement(i).Flags().badel = 1; mesh.VolumeElement(ei).Flags().badel = 1;
} }
else else
mesh.VolumeElement(i).Flags().badel = 0; mesh.VolumeElement(ei).Flags().badel = 0;
double facok = 0; double facok = 0;
double factry; double factry;