improved usage of PointIndex

This commit is contained in:
Joachim Schoeberl 2013-04-02 20:29:53 +00:00
parent 15a1e07092
commit c46329ebf7
23 changed files with 334 additions and 394 deletions

View File

@ -86,8 +86,7 @@ AdFront3 :: ~AdFront3 ()
void AdFront3 :: GetPoints (Array<Point<3> > & 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<int, PointIndex::BASE> 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++)

View File

@ -176,7 +176,7 @@ public:
class AdFront3
{
///
Array<FrontPoint3, PointIndex::BASE> points;
Array<FrontPoint3, PointIndex::BASE, PointIndex> points;
///
Array<FrontFace> faces;
///
@ -208,7 +208,7 @@ int rebuildcounter;
int lasti;
/// minimal selection-value of baseelements
int minval;
Array<int, PointIndex::BASE> invpindex;
Array<int, PointIndex::BASE, PointIndex> invpindex;
Array<char> pingroup;
///

File diff suppressed because it is too large Load Diff

View File

@ -535,9 +535,9 @@ namespace netgen
// Lock all the prism points so that the rest of the mesh can be
// optimised without invalidating the entire mesh
for (i = 1; i <= np; i++)
for (PointIndex pi = mesh.Points().Begin(); pi < mesh.Points().End(); pi++)
{
if(bndnodes.Test(i)) mesh.AddLockedPoint(i);
if(bndnodes.Test(i)) mesh.AddLockedPoint(pi);
}
// Now, actually pull back the old surface points to create

View File

@ -266,7 +266,6 @@ namespace netgen
Point3d tpmin, tpmax;
tettree.GetIntersecting (newp, newp, treesearch);
double quot,minquot(1e20);
for (int j = 0; j < treesearch.Size(); j++)
@ -343,7 +342,6 @@ namespace netgen
int changed = 1;
int nstarti = 1, starti;
while (changed)
{
changed = 0;
@ -417,9 +415,9 @@ namespace netgen
INDEX_3 i3 = tempels.Get(helind).GetFace (k-1);
const Point3d & p1 = mesh.Point ( PointIndex (i3.I1()));
const Point3d & p2 = mesh.Point ( PointIndex (i3.I2()));
const Point3d & p3 = mesh.Point ( PointIndex (i3.I3()));
const Point3d & p1 = mesh.Point ( i3.I1());
const Point3d & p2 = mesh.Point ( i3.I2());
const Point3d & p3 = mesh.Point ( i3.I3());
Vec3d v1(p1, p2);
@ -444,7 +442,6 @@ namespace netgen
}
}
} // while (changed)
// (*testout) << "newels: " << endl;
Array<Element> 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<DelaunayTet> & tempels,
int oldnp, DelaunayTet & startel, Point3d & pmin, Point3d & pmax)
{
int i, j, k;
const Point<3> * pp[4];
Array<Point<3> > centers;
Array<double> 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<PointIndex::BASE> 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<int> mixed(np);
Array<PointIndex, PointIndex::BASE, PointIndex> 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<INDEX_2> 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++)

View File

@ -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);
}
}

View File

@ -19,7 +19,7 @@ namespace netgen
}
}
void GeomSearch3d :: Init (Array <FrontPoint3,PointIndex::BASE> *pointsi, Array <FrontFace> *facesi)
void GeomSearch3d :: Init (Array <FrontPoint3,PointIndex::BASE, PointIndex> *pointsi, Array <FrontFace> *facesi)
{
points = pointsi;
faces = facesi;

View File

@ -22,7 +22,7 @@ public:
virtual ~GeomSearch3d();
///
void Init (Array <FrontPoint3,PointIndex::BASE> *pointsi, Array <FrontFace> *facesi);
void Init (Array <FrontPoint3,PointIndex::BASE, PointIndex> *pointsi, Array <FrontFace> *facesi);
///get elements max extension
void ElemMaxExt(Point3d& minp, Point3d& maxp, const MiniElement2d& elem);
@ -47,7 +47,7 @@ public:
private:
Array <FrontFace> *faces; // Pointers to Arrays in Adfront
Array <FrontPoint3,PointIndex::BASE> *points;
Array <FrontPoint3,PointIndex::BASE, PointIndex> *points;
Array <Array <int>*> hashtable;

View File

@ -533,8 +533,7 @@ namespace netgen
Array<Vec<3>,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())
{

View File

@ -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++)
{

View File

@ -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<MeshPoint,PointIndex::BASE> T_POINTS;
// typedef MoveableArray<Element> T_VOLELEMENTS;
// typedef MoveableArray<Element2d> T_SURFELEMENTS;
// typedef Array<MeshPoint,PointIndex::BASE> T_POINTS;
typedef Array<Element> T_VOLELEMENTS;
typedef Array<Element2d> 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<int> * 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<int> * const indices,
bool build_searchtree = 0,

View File

@ -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<int, PointIndex::BASE> 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);

View File

@ -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);
}

View File

@ -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<blocktyp> inner(n);
Array<int> pointnr(n), frontpointnr(n);
Array<PointIndex> pointnr(n);
Array<int> 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);
}
}

View File

@ -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<MeshPoint, PointIndex::BASE> T_POINTS;
typedef Array<MeshPoint, PointIndex::BASE, PointIndex> T_POINTS;
@ -371,6 +376,9 @@ namespace netgen
///
const PointIndex & operator[] (int i) const { return pnum[i]; }
FlatArray<const PointIndex> PNums () const
{ return FlatArray<const PointIndex> (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<const PointIndex> PNums () const
{ return FlatArray<const PointIndex> (np, &pnum[0]); }
///
PointIndex & PNum (int i) { return pnum[i-1]; }
///

View File

@ -18,7 +18,7 @@ namespace netgen
mesh.SetNP(mesh.GetNV());
INDEX_2_HASHTABLE<int> between(mesh.GetNP() + 5);
INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5);
int oldne, oldns, oldnf;
@ -87,7 +87,7 @@ namespace netgen
case TRIG:
case TRIG6:
{
ArrayMem<int,6> pnums(6);
ArrayMem<PointIndex,6> pnums(6);
ArrayMem<PointGeomInfo,6> pgis(6);
static int betw[3][3] =
@ -162,7 +162,7 @@ namespace netgen
case QUAD6:
case QUAD8:
{
ArrayMem<int,9> pnums(9);
ArrayMem<PointIndex,9> pnums(9);
ArrayMem<PointGeomInfo,9> pgis(9);
static int betw[5][3] =
@ -253,7 +253,7 @@ namespace netgen
case TET:
case TET10:
{
ArrayMem<int,10> pnums(10);
ArrayMem<PointIndex,10> pnums(10);
static int betw[6][3] =
{ { 1, 2, 5 },
{ 1, 3, 6 },
@ -334,7 +334,7 @@ namespace netgen
}
case HEX:
{
ArrayMem<int,27> pnums(27);
ArrayMem<PointIndex,27> 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<int,18> pnums(18);
ArrayMem<PointIndex,18> 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()));

View File

@ -18,7 +18,7 @@ namespace netgen
mesh.ComputeNVertices();
mesh.SetNP(mesh.GetNV());
INDEX_2_HASHTABLE<int> between(mesh.GetNP() + 5);
INDEX_2_HASHTABLE<PointIndex> between(mesh.GetNP() + 5);
bool thinlayers = 0;
@ -235,18 +235,18 @@ namespace netgen
Array<int,PointIndex::BASE> identmap;
mesh.GetIdentifications().GetMap (i, identmap);
for (INDEX_2_HASHTABLE<int>::Iterator it = between.Begin();
for (INDEX_2_HASHTABLE<PointIndex>::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<int>::Iterator it = between.Begin();
for (INDEX_2_HASHTABLE<PointIndex>::Iterator it = between.Begin();
it != between.End(); it++)
{
mesh.mlbetweennodes[between.GetData (it)] = between.GetHash(it);

View File

@ -141,8 +141,7 @@ namespace netgen
Array<SurfaceElementIndex> locelements(0);
Array<int> 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;

View File

@ -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 && j<used_idmaps->Size(); j++)

View File

@ -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<int> pmat(onp);
Array<PointIndex> pmat(onp);
for (i = 1; i <= onp; i++)
pmat.Elem(i) = mesh.AddPoint (othermesh.Point(i));

View File

@ -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 ()

View File

@ -19,15 +19,15 @@ class MeshTopology
bool buildedges;
bool buildfaces;
MoveableArray<INDEX_2> edge2vert;
MoveableArray<INDEX_4> face2vert;
MoveableArray<int[12]> edges;
MoveableArray<int[6]> faces;
MoveableArray<int[4]> surfedges;
MoveableArray<int> segedges;
MoveableArray<int> surffaces;
MoveableArray<INDEX_2> surf2volelement;
MoveableArray<int> face2surfel;
Array<INDEX_2> edge2vert;
Array<INDEX_4> face2vert;
Array<int[12]> edges;
Array<int[6]> faces;
Array<int[4]> surfedges;
Array<int> segedges;
Array<int> surffaces;
Array<INDEX_2> surf2volelement;
Array<int> face2surfel;
TABLE<ElementIndex,PointIndex::BASE> *vert2element;
TABLE<int,PointIndex::BASE> *vert2surfelement;
TABLE<int,PointIndex::BASE> *vert2segment;

View File

@ -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);