mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
more use of PointIndex
This commit is contained in:
parent
e4a6d127fd
commit
4c32c2ac25
@ -617,7 +617,9 @@ namespace netgen
|
|||||||
(*testout) << "Point on edge" << endl
|
(*testout) << "Point on edge" << endl
|
||||||
<< "seg = " << i2 << ", p = " << pi << endl
|
<< "seg = " << i2 << ", p = " << pi << endl
|
||||||
<< "pos = " << p << ", projected = " << hp << endl
|
<< "pos = " << p << ", projected = " << hp << endl
|
||||||
<< "seg is = " << mesh.Point(i2.I1()) << " - " << mesh.Point(i2.I2()) << endl;
|
<< "seg is = "
|
||||||
|
<< mesh.Point(PointIndex(i2.I1())) << " - "
|
||||||
|
<< mesh.Point(PointIndex(i2.I2())) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -759,8 +759,9 @@ namespace netgen
|
|||||||
<< "time = " << GetTime() << " sec" << endl
|
<< "time = " << GetTime() << " sec" << endl
|
||||||
<< "points: " << mesh->GetNP() << endl;
|
<< "points: " << mesh->GetNP() << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mparam.uselocalh && 0)
|
/*
|
||||||
|
if (mparam.uselocalh)
|
||||||
{
|
{
|
||||||
mesh->CalcLocalH(mparam.grading);
|
mesh->CalcLocalH(mparam.grading);
|
||||||
mesh->DeleteMesh();
|
mesh->DeleteMesh();
|
||||||
@ -773,6 +774,7 @@ namespace netgen
|
|||||||
MeshSurface (geom, *mesh, mparam);
|
MeshSurface (geom, *mesh, mparam);
|
||||||
if (multithread.terminate) return TCL_OK;
|
if (multithread.terminate) return TCL_OK;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef LOG_STREAM
|
#ifdef LOG_STREAM
|
||||||
(*logout) << "Surfaces remeshed" << endl
|
(*logout) << "Surfaces remeshed" << endl
|
||||||
|
@ -130,18 +130,18 @@ namespace netgen
|
|||||||
int hasp = 0;
|
int hasp = 0;
|
||||||
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
|
for (int i = 0; i < geometry->GetNTopLevelObjects(); i++)
|
||||||
{
|
{
|
||||||
const TriangleApproximation & ta =
|
const TriangleApproximation * ta =
|
||||||
*geometry->GetTriApprox(i);
|
geometry->GetTriApprox(i);
|
||||||
if (!&ta) continue;
|
if (!ta) continue;
|
||||||
|
|
||||||
for (int j = 0; j < ta.GetNP(); j++)
|
for (int j = 0; j < ta->GetNP(); j++)
|
||||||
{
|
{
|
||||||
if (hasp)
|
if (hasp)
|
||||||
box.Add (ta.GetPoint(j));
|
box.Add (ta->GetPoint(j));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hasp = 1;
|
hasp = 1;
|
||||||
box.Set (ta.GetPoint(j));
|
box.Set (ta->GetPoint(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,18 +167,18 @@ namespace netgen
|
|||||||
trilists.Append (glGenLists (1));
|
trilists.Append (glGenLists (1));
|
||||||
glNewList (trilists.Last(), GL_COMPILE);
|
glNewList (trilists.Last(), GL_COMPILE);
|
||||||
glEnable (GL_NORMALIZE);
|
glEnable (GL_NORMALIZE);
|
||||||
const TriangleApproximation & ta =
|
const TriangleApproximation * ta =
|
||||||
*geometry->GetTriApprox(i);
|
geometry->GetTriApprox(i);
|
||||||
if (&ta)
|
if (ta)
|
||||||
{
|
{
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
glVertexPointer(3, GL_DOUBLE, 0, &ta.GetPoint(0)(0));
|
glVertexPointer(3, GL_DOUBLE, 0, &ta->GetPoint(0)(0));
|
||||||
|
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
glNormalPointer(GL_DOUBLE, 0, &ta.GetNormal(0)(0));
|
glNormalPointer(GL_DOUBLE, 0, &ta->GetNormal(0)(0));
|
||||||
|
|
||||||
for (int j = 0; j < ta.GetNT(); j++)
|
for (int j = 0; j < ta->GetNT(); j++)
|
||||||
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, & (ta.GetTriangle(j)[0]));
|
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, & (ta->GetTriangle(j)[0]));
|
||||||
|
|
||||||
glDisableClientState(GL_VERTEX_ARRAY);
|
glDisableClientState(GL_VERTEX_ARRAY);
|
||||||
glDisableClientState(GL_NORMAL_ARRAY);
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
@ -382,13 +382,20 @@ namespace netgen
|
|||||||
glDisable (GL_COLOR_MATERIAL);
|
glDisable (GL_COLOR_MATERIAL);
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
glDisable (GL_CLIP_PLANE0);
|
glDisable (GL_CLIP_PLANE0);
|
||||||
|
|
||||||
|
/*
|
||||||
for (int i = 1; i <= mesh -> GetNP(); i++)
|
for (int i = 1; i <= mesh -> GetNP(); i++)
|
||||||
{
|
{
|
||||||
const Point3d & p = mesh -> Point(i);
|
const Point3d & p = mesh -> Point(i);
|
||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
glBitmap (7, 7, 3, 3, 0, 0, &knoedel[0]);
|
glBitmap (7, 7, 3, 3, 0, 0, &knoedel[0]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
for (const Point3d & p : mesh->Points())
|
||||||
|
{
|
||||||
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
|
glBitmap (7, 7, 3, 3, 0, 0, &knoedel[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vispar.drawedpointnrs)
|
if (vispar.drawedpointnrs)
|
||||||
@ -403,7 +410,8 @@ namespace netgen
|
|||||||
// glListBase (fontbase);
|
// glListBase (fontbase);
|
||||||
|
|
||||||
char buf[20];
|
char buf[20];
|
||||||
for (int i = 1; i <= mesh->GetNP(); i++)
|
// for (int i = 1; i <= mesh->GetNP(); i++)
|
||||||
|
for (auto i : mesh->Points().Range())
|
||||||
{
|
{
|
||||||
const Point3d & p = mesh->Point(i);
|
const Point3d & p = mesh->Point(i);
|
||||||
glRasterPos3d (p.X(), p.Y(), p.Z());
|
glRasterPos3d (p.X(), p.Y(), p.Z());
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// #define BASE0
|
||||||
|
// #define DEBUG
|
||||||
|
|
||||||
|
|
||||||
#define noDEMOVERSION
|
#define noDEMOVERSION
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
|
||||||
|
static constexpr int POINTINDEX_BASE = 1;
|
||||||
|
|
||||||
struct T_EDGE2
|
struct T_EDGE2
|
||||||
{
|
{
|
||||||
// int orient:1;
|
// int orient:1;
|
||||||
@ -37,7 +40,7 @@ namespace netgen
|
|||||||
const int * ptr;
|
const int * ptr;
|
||||||
|
|
||||||
int Size() const { return num; }
|
int Size() const { return num; }
|
||||||
int operator[] (int i) const { return ptr[i]-1; }
|
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +51,7 @@ namespace netgen
|
|||||||
const int * ptr;
|
const int * ptr;
|
||||||
|
|
||||||
int Size() const { return num; }
|
int Size() const { return num; }
|
||||||
int operator[] (int i) const { return ptr[i]-1; }
|
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ng_Edges
|
class Ng_Edges
|
||||||
@ -145,7 +148,7 @@ namespace netgen
|
|||||||
const int * ptr;
|
const int * ptr;
|
||||||
|
|
||||||
int Size() const { return 2; }
|
int Size() const { return 2; }
|
||||||
int operator[] (int i) const { return ptr[i]-1; }
|
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -165,7 +168,7 @@ namespace netgen
|
|||||||
const int * ptr;
|
const int * ptr;
|
||||||
|
|
||||||
int Size() const { return nv; }
|
int Size() const { return nv; }
|
||||||
int operator[] (int i) const { return ptr[i]-1; }
|
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ng_Edges
|
class Ng_Edges
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
NGX_INLINE DLL_HEADER Ng_Point Ngx_Mesh :: GetPoint (int nr) const
|
NGX_INLINE DLL_HEADER Ng_Point Ngx_Mesh :: GetPoint (int nr) const
|
||||||
{
|
{
|
||||||
return Ng_Point (&mesh->Point(nr + PointIndex::BASE)(0));
|
return Ng_Point (&mesh->Point(PointIndex(nr+PointIndex::BASE))(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ void WriteJCMFormat (const Mesh & mesh,
|
|||||||
int np = mesh.GetNP();
|
int np = mesh.GetNP();
|
||||||
|
|
||||||
// Identic points
|
// Identic points
|
||||||
Array<int,1> identmap1, identmap2, identmap3;
|
Array<int,PointIndex::BASE> identmap1, identmap2, identmap3;
|
||||||
mesh.GetIdentifications().GetMap(1, identmap1);
|
mesh.GetIdentifications().GetMap(1, identmap1);
|
||||||
mesh.GetIdentifications().GetMap(2, identmap2);
|
mesh.GetIdentifications().GetMap(2, identmap2);
|
||||||
mesh.GetIdentifications().GetMap(3, identmap3);
|
mesh.GetIdentifications().GetMap(3, identmap3);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
///
|
///
|
||||||
FrontPoint2 ()
|
FrontPoint2 ()
|
||||||
{
|
{
|
||||||
globalindex = -1;
|
globalindex.Invalidate(); // = -1;
|
||||||
nlinetopoint = 0;
|
nlinetopoint = 0;
|
||||||
frontnr = INT_MAX-10; // attention: overflow on calculating INT_MAX + 1
|
frontnr = INT_MAX-10; // attention: overflow on calculating INT_MAX + 1
|
||||||
mgi = NULL;
|
mgi = NULL;
|
||||||
|
@ -9,7 +9,7 @@ namespace netgen
|
|||||||
|
|
||||||
FrontPoint3 :: FrontPoint3 ()
|
FrontPoint3 :: FrontPoint3 ()
|
||||||
{
|
{
|
||||||
globalindex = -1;
|
globalindex.Invalidate(); // = -1;
|
||||||
nfacetopoint = 0;
|
nfacetopoint = 0;
|
||||||
frontnr = 1000;
|
frontnr = 1000;
|
||||||
cluster = 0;
|
cluster = 0;
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
class FrontPoint3
|
class FrontPoint3
|
||||||
{
|
{
|
||||||
/// coordinates
|
/// coordinates
|
||||||
Point<3> p;
|
Point<3> p;
|
||||||
/// global node index
|
/// global node index
|
||||||
PointIndex globalindex;
|
PointIndex globalindex;
|
||||||
/// number of faces connected to point
|
/// number of faces connected to point
|
||||||
int nfacetopoint;
|
int nfacetopoint;
|
||||||
/// distance to original boundary
|
/// distance to original boundary
|
||||||
int frontnr;
|
int frontnr;
|
||||||
///
|
///
|
||||||
int cluster;
|
int cluster;
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
FrontPoint3 ();
|
FrontPoint3 ();
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
void AddFace ()
|
void AddFace ()
|
||||||
{ nfacetopoint++; }
|
{ nfacetopoint++; }
|
||||||
|
|
||||||
///
|
/// if last face is removed, then point is invalidated
|
||||||
void RemoveFace()
|
void RemoveFace()
|
||||||
{
|
{
|
||||||
nfacetopoint--;
|
nfacetopoint--;
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
int Valid () const
|
bool Valid () const
|
||||||
{ return nfacetopoint >= 0; }
|
{ return nfacetopoint >= 0; }
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -74,7 +74,7 @@ class MiniElement2d
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int np;
|
int np;
|
||||||
PointIndex pnum[4];
|
PointIndex pnum[4]; // can be global or local nums
|
||||||
bool deleted;
|
bool deleted;
|
||||||
public:
|
public:
|
||||||
MiniElement2d ()
|
MiniElement2d ()
|
||||||
@ -89,8 +89,8 @@ public:
|
|||||||
const PointIndex PNum (int i) const { return pnum[i-1]; }
|
const PointIndex PNum (int i) const { return pnum[i-1]; }
|
||||||
PointIndex & PNum (int i) { return pnum[i-1]; }
|
PointIndex & PNum (int i) { return pnum[i-1]; }
|
||||||
const PointIndex PNumMod (int i) const { return pnum[(i-1)%np]; }
|
const PointIndex PNumMod (int i) const { return pnum[(i-1)%np]; }
|
||||||
|
auto PNums() const { return FlatArray<const PointIndex> (np, &pnum[0]); }
|
||||||
void Delete () { deleted = 1; pnum[0] = pnum[1] = pnum[2] = pnum[3] = PointIndex::BASE-1; }
|
void Delete () { deleted = true; for (PointIndex & p : pnum) p.Invalidate(); }
|
||||||
bool IsDeleted () const { return deleted; }
|
bool IsDeleted () const { return deleted; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ private:
|
|||||||
int hashvalue;
|
int hashvalue;
|
||||||
///
|
///
|
||||||
int cluster;
|
int cluster;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
FrontFace ();
|
FrontFace ();
|
||||||
@ -178,43 +178,43 @@ class AdFront3
|
|||||||
///
|
///
|
||||||
Array<FrontPoint3, PointIndex::BASE, PointIndex> points;
|
Array<FrontPoint3, PointIndex::BASE, PointIndex> points;
|
||||||
///
|
///
|
||||||
Array<FrontFace> faces;
|
Array<FrontFace> faces;
|
||||||
///
|
///
|
||||||
Array<PointIndex> delpointl;
|
Array<PointIndex> delpointl;
|
||||||
|
|
||||||
/// which points are connected to pi ?
|
/// which points are connected to pi ?
|
||||||
TABLE<int, PointIndex::BASE> * connectedpairs;
|
TABLE<int, PointIndex::BASE> * connectedpairs;
|
||||||
|
|
||||||
/// number of total front faces;
|
/// number of total front faces;
|
||||||
int nff;
|
int nff;
|
||||||
/// number of quads in front
|
/// number of quads in front
|
||||||
int nff4;
|
int nff4;
|
||||||
|
|
||||||
///
|
///
|
||||||
double vol;
|
double vol;
|
||||||
|
|
||||||
///
|
///
|
||||||
GeomSearch3d hashtable;
|
GeomSearch3d hashtable;
|
||||||
|
|
||||||
///
|
///
|
||||||
int hashon;
|
int hashon;
|
||||||
|
|
||||||
///
|
///
|
||||||
int hashcreated;
|
int hashcreated;
|
||||||
|
|
||||||
/// counter for rebuilding internal tables
|
/// counter for rebuilding internal tables
|
||||||
int rebuildcounter;
|
int rebuildcounter;
|
||||||
/// last base element
|
/// last base element
|
||||||
int lasti;
|
int lasti;
|
||||||
/// minimal selection-value of baseelements
|
/// minimal selection-value of baseelements
|
||||||
int minval;
|
int minval;
|
||||||
Array<int, PointIndex::BASE, PointIndex> invpindex;
|
Array<PointIndex, PointIndex::BASE, PointIndex> invpindex;
|
||||||
Array<char> pingroup;
|
Array<char> pingroup;
|
||||||
|
|
||||||
///
|
///
|
||||||
class Box3dTree * facetree;
|
class Box3dTree * facetree;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///
|
///
|
||||||
AdFront3 ();
|
AdFront3 ();
|
||||||
///
|
///
|
||||||
|
@ -3873,7 +3873,7 @@ namespace netgen
|
|||||||
Mat<DIM_SPACE,2,T> _dxdxi;
|
Mat<DIM_SPACE,2,T> _dxdxi;
|
||||||
if (!EvaluateMapping (info, _xi, _x, _dxdxi))
|
if (!EvaluateMapping (info, _xi, _x, _dxdxi))
|
||||||
{ ok = false; break; }
|
{ ok = false; break; }
|
||||||
// cout << "x = " << _x << ", dxdxi = " << _dxdxi << endl;
|
// *testout << "x = " << _x << ", dxdxi = " << _dxdxi << endl;
|
||||||
if (x)
|
if (x)
|
||||||
for (int j = 0; j < DIM_SPACE; j++)
|
for (int j = 0; j < DIM_SPACE; j++)
|
||||||
x[i*sx+j] = _x[j];
|
x[i*sx+j] = _x[j];
|
||||||
|
@ -415,9 +415,9 @@ namespace netgen
|
|||||||
|
|
||||||
INDEX_3 i3 = tempels.Get(helind).GetFace (k-1);
|
INDEX_3 i3 = tempels.Get(helind).GetFace (k-1);
|
||||||
|
|
||||||
const Point3d & p1 = mesh.Point ( i3.I1());
|
const Point3d & p1 = mesh.Point ( PointIndex (i3.I1()) );
|
||||||
const Point3d & p2 = mesh.Point ( i3.I2());
|
const Point3d & p2 = mesh.Point ( PointIndex (i3.I2()) );
|
||||||
const Point3d & p3 = mesh.Point ( i3.I3());
|
const Point3d & p3 = mesh.Point ( PointIndex (i3.I3()) );
|
||||||
|
|
||||||
|
|
||||||
Vec3d v1(p1, p2);
|
Vec3d v1(p1, p2);
|
||||||
@ -612,20 +612,20 @@ namespace netgen
|
|||||||
for (int i = 1; i <= adfront->GetNF(); i++)
|
for (int i = 1; i <= adfront->GetNF(); i++)
|
||||||
{
|
{
|
||||||
const MiniElement2d & face = adfront->GetFace(i);
|
const MiniElement2d & face = adfront->GetFace(i);
|
||||||
for (int j = 0; j < face.GetNP(); j++)
|
for (PointIndex pi : face.PNums())
|
||||||
{
|
{
|
||||||
pmin.SetToMin (mesh.Point (face[j]));
|
pmin.SetToMin (mesh.Point (pi));
|
||||||
pmax.SetToMax (mesh.Point (face[j]));
|
pmax.SetToMax (mesh.Point (pi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mesh.LockedPoints().Size(); i++)
|
for (PointIndex pi : mesh.LockedPoints())
|
||||||
{
|
{
|
||||||
pmin.SetToMin (mesh.Point (mesh.LockedPoints()[i]));
|
pmin.SetToMin (mesh.Point (pi));
|
||||||
pmax.SetToMax (mesh.Point (mesh.LockedPoints()[i]));
|
pmax.SetToMax (mesh.Point (pi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Vec3d vdiag(pmin, pmax);
|
Vec3d vdiag(pmin, pmax);
|
||||||
// double r1 = vdiag.Length();
|
// double r1 = vdiag.Length();
|
||||||
|
@ -216,8 +216,10 @@ namespace netgen
|
|||||||
|
|
||||||
int GetNP () const { return points.Size(); }
|
int GetNP () const { return points.Size(); }
|
||||||
|
|
||||||
|
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
||||||
MeshPoint & Point(int i) { return points.Elem(i); }
|
MeshPoint & Point(int i) { return points.Elem(i); }
|
||||||
MeshPoint & Point(PointIndex pi) { return points[pi]; }
|
MeshPoint & Point(PointIndex pi) { return points[pi]; }
|
||||||
|
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
||||||
const MeshPoint & Point(int i) const { return points.Get(i); }
|
const MeshPoint & Point(int i) const { return points.Get(i); }
|
||||||
const MeshPoint & Point(PointIndex pi) const { return points[pi]; }
|
const MeshPoint & Point(PointIndex pi) const { return points[pi]; }
|
||||||
|
|
||||||
@ -231,8 +233,8 @@ namespace netgen
|
|||||||
DLL_HEADER SegmentIndex AddSegment (const Segment & s);
|
DLL_HEADER SegmentIndex AddSegment (const Segment & s);
|
||||||
void DeleteSegment (int segnr)
|
void DeleteSegment (int segnr)
|
||||||
{
|
{
|
||||||
segments.Elem(segnr)[0] = PointIndex::BASE-1;
|
segments.Elem(segnr)[0].Invalidate();
|
||||||
segments.Elem(segnr)[1] = PointIndex::BASE-1;
|
segments.Elem(segnr)[1].Invalidate();
|
||||||
}
|
}
|
||||||
void FullDeleteSegment (int segnr) // von wem ist das ???
|
void FullDeleteSegment (int segnr) // von wem ist das ???
|
||||||
{
|
{
|
||||||
@ -257,9 +259,9 @@ namespace netgen
|
|||||||
void DeleteSurfaceElement (int eli)
|
void DeleteSurfaceElement (int eli)
|
||||||
{
|
{
|
||||||
surfelements.Elem(eli).Delete();
|
surfelements.Elem(eli).Delete();
|
||||||
surfelements.Elem(eli).PNum(1) = -1;
|
surfelements.Elem(eli).PNum(1).Invalidate();
|
||||||
surfelements.Elem(eli).PNum(2) = -1;
|
surfelements.Elem(eli).PNum(2).Invalidate();
|
||||||
surfelements.Elem(eli).PNum(3) = -1;
|
surfelements.Elem(eli).PNum(3).Invalidate();
|
||||||
timestamp = NextTimeStamp();
|
timestamp = NextTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +292,9 @@ namespace netgen
|
|||||||
|
|
||||||
int GetNE () const { return volelements.Size(); }
|
int GetNE () const { return volelements.Size(); }
|
||||||
|
|
||||||
|
// [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]]
|
||||||
Element & VolumeElement(int i) { return volelements.Elem(i); }
|
Element & VolumeElement(int i) { return volelements.Elem(i); }
|
||||||
|
// [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]]
|
||||||
const Element & VolumeElement(int i) const { return volelements.Get(i); }
|
const Element & VolumeElement(int i) const { return volelements.Get(i); }
|
||||||
Element & VolumeElement(ElementIndex i) { return volelements[i]; }
|
Element & VolumeElement(ElementIndex i) { return volelements[i]; }
|
||||||
const Element & VolumeElement(ElementIndex i) const { return volelements[i]; }
|
const Element & VolumeElement(ElementIndex i) const { return volelements[i]; }
|
||||||
|
@ -538,6 +538,9 @@ namespace netgen
|
|||||||
shape(3) = (1-p(0))* p(1) ;
|
shape(3) = (1-p(0))* p(1) ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw NgException ("illegal element type in GetShapeNew");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,6 +565,8 @@ namespace netgen
|
|||||||
shape(3) = (1-p(0))* p(1) ;
|
shape(3) = (1-p(0))* p(1) ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
throw NgException ("illegal element type in GetShapeNew");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +125,8 @@ namespace netgen
|
|||||||
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; }
|
||||||
PointIndex operator-- () { i--; return *this; }
|
PointIndex operator-- () { i--; return *this; }
|
||||||
|
void Invalidate() { i = PointIndex::BASE-1; }
|
||||||
|
bool IsValid() const { return i != PointIndex::BASE-1; }
|
||||||
#ifdef BASE0
|
#ifdef BASE0
|
||||||
enum { BASE = 0 };
|
enum { BASE = 0 };
|
||||||
#else
|
#else
|
||||||
@ -134,7 +136,7 @@ namespace netgen
|
|||||||
|
|
||||||
inline istream & operator>> (istream & ist, PointIndex & pi)
|
inline istream & operator>> (istream & ist, PointIndex & pi)
|
||||||
{
|
{
|
||||||
int i; ist >> i; pi = i; return ist;
|
int i; ist >> i; pi = PointIndex(i); return ist;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ostream & operator<< (ostream & ost, const PointIndex & pi)
|
inline ostream & operator<< (ostream & ost, const PointIndex & pi)
|
||||||
@ -471,8 +473,14 @@ namespace netgen
|
|||||||
int pi, Vec2d & dir, double & dd) const;
|
int pi, Vec2d & dir, double & dd) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Delete () { deleted = 1; pnum[0] = pnum[1] = pnum[2] = pnum[3] = PointIndex::BASE-1; }
|
void Delete ()
|
||||||
|
{
|
||||||
|
deleted = 1;
|
||||||
|
for (PointIndex & p : pnum)
|
||||||
|
p.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
bool IsDeleted () const
|
bool IsDeleted () const
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -1422,19 +1422,18 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
if(lochfunc)
|
if(lochfunc)
|
||||||
{
|
{
|
||||||
for(int i=1; i<=points.Size(); i++)
|
for (PointIndex pi : points.Range())
|
||||||
pointh[i] = GetH(points.Get(i));
|
pointh[pi] = GetH(points[pi]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pointh = 0;
|
pointh = 0;
|
||||||
for(int i=0; i<GetNE(); i++)
|
for (Element & el : VolumeElements())
|
||||||
{
|
{
|
||||||
const Element & el = VolumeElement(i+1);
|
|
||||||
double h = pow(el.Volume(points),1./3.);
|
double h = pow(el.Volume(points),1./3.);
|
||||||
for(int j=1; j<=el.GetNV(); j++)
|
for (PointIndex pi : el.PNums())
|
||||||
if(h > pointh[el.PNum(j)])
|
if (h > pointh[pi])
|
||||||
pointh[el.PNum(j)] = h;
|
pointh[pi] = h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,21 +1454,15 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
|
|
||||||
const char * savetask = multithread.task;
|
const char * savetask = multithread.task;
|
||||||
multithread.task = "Smooth Mesh";
|
multithread.task = "Smooth Mesh";
|
||||||
|
|
||||||
for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
|
for (PointIndex pi : points.Range())
|
||||||
if ( (*this)[pi].Type() == INNERPOINT && perrs[pi] > 0.01 * badmax)
|
if ( (*this)[pi].Type() == INNERPOINT && perrs[pi] > 0.01 * badmax)
|
||||||
{
|
{
|
||||||
if (multithread.terminate)
|
if (multithread.terminate)
|
||||||
throw NgException ("Meshing stopped");
|
throw NgException ("Meshing stopped");
|
||||||
|
|
||||||
multithread.percent = 100.0 * (pi+1-PointIndex::BASE) / points.Size();
|
multithread.percent = 100.0 * (pi+1-PointIndex::BASE) / points.Size();
|
||||||
/*
|
|
||||||
if (points.Size() < 1000)
|
|
||||||
PrintDot ();
|
|
||||||
else
|
|
||||||
if ( (i+1-PointIndex::BASE) % 10 == 0)
|
|
||||||
PrintDot ('+');
|
|
||||||
*/
|
|
||||||
if ( (pi+1-PointIndex::BASE) % printmod == 0) PrintDot (printdot);
|
if ( (pi+1-PointIndex::BASE) % printmod == 0) PrintDot (printdot);
|
||||||
|
|
||||||
double lh = pointh[pi];
|
double lh = pointh[pi];
|
||||||
@ -1503,7 +1496,6 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
|||||||
}
|
}
|
||||||
PrintDot ('\n');
|
PrintDot ('\n');
|
||||||
|
|
||||||
|
|
||||||
delete pf;
|
delete pf;
|
||||||
|
|
||||||
multithread.task = savetask;
|
multithread.task = savetask;
|
||||||
|
@ -63,8 +63,8 @@ namespace netgen
|
|||||||
|
|
||||||
int VisualScene :: selface;
|
int VisualScene :: selface;
|
||||||
int VisualScene :: selelement;
|
int VisualScene :: selelement;
|
||||||
int VisualScene :: selpoint;
|
PointIndex VisualScene :: selpoint;
|
||||||
int VisualScene :: selpoint2;
|
PointIndex VisualScene :: selpoint2;
|
||||||
int VisualScene :: locpi;
|
int VisualScene :: locpi;
|
||||||
int VisualScene :: seledge;
|
int VisualScene :: seledge;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ namespace netgen
|
|||||||
|
|
||||||
static int DLL_HEADER selface;
|
static int DLL_HEADER selface;
|
||||||
static int selelement;
|
static int selelement;
|
||||||
static int DLL_HEADER selpoint;
|
static PointIndex DLL_HEADER selpoint;
|
||||||
static int selpoint2;
|
static PointIndex selpoint2;
|
||||||
static int locpi;
|
static int locpi;
|
||||||
static int DLL_HEADER seledge;
|
static int DLL_HEADER seledge;
|
||||||
|
|
||||||
@ -235,8 +235,8 @@ namespace netgen
|
|||||||
const Point3d & center,
|
const Point3d & center,
|
||||||
const double rad,
|
const double rad,
|
||||||
const int displaylist,
|
const int displaylist,
|
||||||
int & selelement, int & selface, int & seledge, int & selpoint,
|
int & selelement, int & selface, int & seledge, PointIndex & selpoint,
|
||||||
int & selpoint2, int & locpi);
|
PointIndex & selpoint2, int & locpi);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3343,8 +3343,8 @@ namespace netgen
|
|||||||
const Point3d & center,
|
const Point3d & center,
|
||||||
const double rad,
|
const double rad,
|
||||||
const int displaylist,
|
const int displaylist,
|
||||||
int & selelement, int & selface, int & seledge, int & selpoint,
|
int & selelement, int & selface, int & seledge, PointIndex & selpoint,
|
||||||
int & selpoint2, int & locpi)
|
PointIndex & selpoint2, int & locpi)
|
||||||
{
|
{
|
||||||
auto mesh = vsmesh.GetMesh();
|
auto mesh = vsmesh.GetMesh();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user