mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
fixing PointIndex::Valid
This commit is contained in:
parent
aa9110155c
commit
79c958cf83
@ -1348,7 +1348,7 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
if (lastpi == -1)
|
||||
if (!lastpi.IsValid())
|
||||
{
|
||||
lastpi = mesh.AddPoint (p, layer, FIXEDPOINT);
|
||||
meshpoint_tree -> Insert (p, lastpi);
|
||||
@ -1384,7 +1384,7 @@ namespace netgen
|
||||
thispi = locsearch[0];
|
||||
}
|
||||
|
||||
if (thispi == -1)
|
||||
if (!thispi.IsValid())
|
||||
{
|
||||
ProjectToEdge (surf1, surf2, np);
|
||||
thispi = mesh.AddPoint (np, layer, (i==ne) ? FIXEDPOINT : EDGEPOINT);
|
||||
@ -1496,7 +1496,7 @@ namespace netgen
|
||||
|
||||
// generate initial point
|
||||
Point<3> p = edgepoints[0];
|
||||
PointIndex pi1 = -1;
|
||||
PointIndex pi1 = PointIndex::INVALID;
|
||||
for (pi = PointIndex::BASE;
|
||||
pi < mesh.GetNP()+PointIndex::BASE; pi++)
|
||||
|
||||
@ -1506,7 +1506,7 @@ namespace netgen
|
||||
break;
|
||||
}
|
||||
|
||||
if (pi1 == -1)
|
||||
if (!pi1.IsValid())
|
||||
{
|
||||
pi1 = mesh.AddPoint (p, layer, FIXEDPOINT);
|
||||
meshpoint_tree -> Insert (p, pi1);
|
||||
@ -1514,7 +1514,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
p = edgepoints.Last();
|
||||
PointIndex pi2 = -1;
|
||||
PointIndex pi2 = PointIndex::INVALID;
|
||||
for (pi = PointIndex::BASE;
|
||||
pi < mesh.GetNP()+PointIndex::BASE; pi++)
|
||||
|
||||
@ -1523,7 +1523,7 @@ namespace netgen
|
||||
pi2 = pi;
|
||||
break;
|
||||
}
|
||||
if (pi2==-1)
|
||||
if (!pi2.IsValid())
|
||||
{
|
||||
pi2 = mesh.AddPoint (p, layer, FIXEDPOINT);
|
||||
meshpoint_tree -> Insert (p, pi2);
|
||||
@ -1616,8 +1616,8 @@ namespace netgen
|
||||
Point<3> top =
|
||||
(i == 1) ? tostart : toend;
|
||||
|
||||
PointIndex frompi = -1;
|
||||
PointIndex topi = -1;
|
||||
PointIndex frompi = PointIndex::INVALID;
|
||||
PointIndex topi = PointIndex::INVALID;
|
||||
for (pi = PointIndex::BASE;
|
||||
pi < mesh.GetNP()+PointIndex::BASE; pi++)
|
||||
{
|
||||
@ -1628,7 +1628,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
if (topi == -1)
|
||||
if (!topi.IsValid())
|
||||
{
|
||||
topi = mesh.AddPoint (top, layer, FIXEDPOINT);
|
||||
meshpoint_tree -> Insert (top, topi);
|
||||
|
@ -598,7 +598,7 @@ int AdFront3 :: GetLocals (int fstind,
|
||||
for (j = 1; j <= locfaces.Get(i).GetNP(); j++)
|
||||
{
|
||||
PointIndex pi = locfaces.Get(i).PNum(j);
|
||||
if (invpindex[pi] == -1)
|
||||
if (!invpindex[pi].IsValid())
|
||||
{
|
||||
pindex.Append (pi);
|
||||
locpoints.Append (points[pi].P());
|
||||
@ -669,7 +669,7 @@ void AdFront3 :: GetGroup (int fi,
|
||||
|
||||
pingroup = 0;
|
||||
for (int j = 1; j <= 3; j++)
|
||||
pingroup.Elem (faces.Get(fi).Face().PNum(j)) = 1;
|
||||
pingroup[faces.Get(fi).Face().PNum(j)] = 1;
|
||||
|
||||
do
|
||||
{
|
||||
@ -702,14 +702,14 @@ void AdFront3 :: GetGroup (int fi,
|
||||
|
||||
int fused = 0;
|
||||
for (int j = 1; j <= 3; j++)
|
||||
if (pingroup.Elem(face.PNum(j)))
|
||||
if (pingroup[face.PNum(j)])
|
||||
fused++;
|
||||
|
||||
if (fused >= 2)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
if (!pingroup.Elem(face.PNum(j)))
|
||||
if (!pingroup[face.PNum(j)])
|
||||
{
|
||||
pingroup.Elem(face.PNum(j)) = 1;
|
||||
pingroup[face.PNum(j)] = 1;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
@ -733,7 +733,7 @@ void AdFront3 :: GetGroup (int fi,
|
||||
{
|
||||
int fused = 0;
|
||||
for (int j = 1; j <= 3; j++)
|
||||
if (pingroup.Get(faces.Get(i).Face().PNum(j)))
|
||||
if (pingroup[faces.Get(i).Face().PNum(j)])
|
||||
fused++;
|
||||
|
||||
if (fused >= 2)
|
||||
@ -753,7 +753,7 @@ void AdFront3 :: GetGroup (int fi,
|
||||
*/
|
||||
for (auto & e : groupelements)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
e.PNum(j) = invpindex.Get(e.PNum(j));
|
||||
e.PNum(j) = invpindex[e.PNum(j)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ class AdFront3
|
||||
/// minimal selection-value of baseelements
|
||||
int minval;
|
||||
NgArray<PointIndex, PointIndex::BASE, PointIndex> invpindex;
|
||||
NgArray<char> pingroup;
|
||||
NgArray<char, PointIndex::BASE> pingroup;
|
||||
|
||||
///
|
||||
class BoxTree<3> * facetree;
|
||||
|
@ -1965,8 +1965,8 @@ namespace netgen
|
||||
SurfaceElementIndex sei;
|
||||
// Element2d hel;
|
||||
|
||||
|
||||
INDEX_3_CLOSED_HASHTABLE<INDEX_2> faceht(100);
|
||||
struct tval { int index; PointIndex p4; };
|
||||
INDEX_3_CLOSED_HASHTABLE<tval> faceht(100);
|
||||
openelements.SetSize(0);
|
||||
|
||||
for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
|
||||
@ -1988,10 +1988,17 @@ namespace netgen
|
||||
if (hel.PNum(1) == pi)
|
||||
{
|
||||
INDEX_3 i3(hel[0], hel[1], hel[2]);
|
||||
/*
|
||||
INDEX_2 i2 (GetFaceDescriptor(ind).DomainIn(),
|
||||
(hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::BASE-1)
|
||||
? PointIndex (PointIndex::INVALID)
|
||||
: hel.PNum(4));
|
||||
*/
|
||||
tval i2;
|
||||
i2.index = GetFaceDescriptor(ind).DomainIn();
|
||||
i2.p4 = (hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::INVALID)
|
||||
: hel.PNum(4);
|
||||
faceht.Set (i3, i2);
|
||||
}
|
||||
}
|
||||
@ -2003,10 +2010,17 @@ namespace netgen
|
||||
if (hel.PNum(1) == pi)
|
||||
{
|
||||
INDEX_3 i3(hel[0], hel[1], hel[2]);
|
||||
/*
|
||||
INDEX_2 i2 (GetFaceDescriptor(ind).DomainOut(),
|
||||
(hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::BASE-1)
|
||||
: hel.PNum(4));
|
||||
*/
|
||||
tval i2;
|
||||
i2.index = GetFaceDescriptor(ind).DomainOut();
|
||||
i2.p4 = (hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::INVALID)
|
||||
: hel.PNum(4);
|
||||
faceht.Set (i3, i2);
|
||||
}
|
||||
}
|
||||
@ -2033,15 +2047,15 @@ namespace netgen
|
||||
|
||||
if (faceht.Used (i3))
|
||||
{
|
||||
INDEX_2 i2 = faceht.Get(i3);
|
||||
if (i2.I1() == el.GetIndex())
|
||||
tval i2 = faceht.Get(i3);
|
||||
if (i2.index == el.GetIndex())
|
||||
{
|
||||
i2.I1() = PointIndex::BASE-1;
|
||||
i2.index = PointIndex::BASE-1;
|
||||
faceht.Set (i3, i2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i2.I1() == 0)
|
||||
if (i2.index == 0)
|
||||
{
|
||||
PrintSysError ("more elements on face");
|
||||
(*testout) << "more elements on face!!!" << endl;
|
||||
@ -2059,10 +2073,17 @@ namespace netgen
|
||||
hel.Invert();
|
||||
hel.NormalizeNumbering();
|
||||
INDEX_3 i3(hel[0], hel[1], hel[2]);
|
||||
/*
|
||||
INDEX_2 i2(el.GetIndex(),
|
||||
(hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::BASE-1)
|
||||
: hel[3]);
|
||||
*/
|
||||
tval i2;
|
||||
i2.index = el.GetIndex();
|
||||
i2.p4 = (hel.GetNP() == 3)
|
||||
? PointIndex (PointIndex::INVALID)
|
||||
: hel[3];
|
||||
faceht.Set (i3, i2);
|
||||
}
|
||||
}
|
||||
@ -2073,17 +2094,18 @@ namespace netgen
|
||||
if (faceht.UsedPos (i))
|
||||
{
|
||||
INDEX_3 i3;
|
||||
INDEX_2 i2;
|
||||
//INDEX_2 i2;
|
||||
tval i2;
|
||||
faceht.GetData (i, i3, i2);
|
||||
if (i2.I1() != PointIndex::BASE-1)
|
||||
if (i2.index != PointIndex::BASE-1)
|
||||
{
|
||||
// Element2d tri;
|
||||
// tri.SetType ( (i2.I2() == PointIndex::BASE-1) ? TRIG : QUAD);
|
||||
Element2d tri ( (i2.I2() == PointIndex::BASE-1) ? TRIG : QUAD);
|
||||
Element2d tri ( (i2.p4 == PointIndex::BASE-1) ? TRIG : QUAD);
|
||||
for (int l = 0; l < 3; l++)
|
||||
tri[l] = i3.I(l+1);
|
||||
tri.PNum(4) = i2.I2();
|
||||
tri.SetIndex (i2.I1());
|
||||
tri.PNum(4) = i2.p4;
|
||||
tri.SetIndex (i2.index);
|
||||
|
||||
// tri.Invert();
|
||||
|
||||
@ -2915,12 +2937,12 @@ namespace netgen
|
||||
pi4++;
|
||||
pi4 = elother.PNum(pi4);
|
||||
|
||||
double rad = ComputeCylinderRadius (Point (i2.I1()),
|
||||
Point (i2.I2()),
|
||||
Point (pi3),
|
||||
Point (pi4));
|
||||
double rad = ComputeCylinderRadius (Point (PointIndex(i2.I1())),
|
||||
Point (PointIndex(i2.I2())),
|
||||
Point (PointIndex(pi3)),
|
||||
Point (PointIndex(pi4)));
|
||||
|
||||
RestrictLocalHLine (Point(i2.I1()), Point(i2.I2()), rad/elperr);
|
||||
RestrictLocalHLine (Point(PointIndex(i2.I1())), Point(PointIndex(i2.I2())), rad/elperr);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1030,12 +1030,12 @@ namespace netgen
|
||||
|
||||
int GetNP() const
|
||||
{
|
||||
return (pnums[2] < 0) ? 2 : 3;
|
||||
return pnums[2].IsValid() ? 3 : 2;
|
||||
}
|
||||
|
||||
ELEMENT_TYPE GetType() const
|
||||
{
|
||||
return (pnums[2] < 0) ? SEGMENT : SEGMENT3;
|
||||
return pnums[2].IsValid() ? SEGMENT3 : SEGMENT;
|
||||
}
|
||||
|
||||
PointIndex & operator[] (int i) { return pnums[i]; }
|
||||
|
Loading…
Reference in New Issue
Block a user