mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-27 06:10:34 +05:00
more PointIndex, fix range-check
This commit is contained in:
parent
b08a1a5db5
commit
07191d6e1b
@ -635,9 +635,11 @@ int AdFront3 :: GetLocals (int fstind,
|
|||||||
// if (pind.IsValid() && pind <= connectedpairs->Size ())
|
// if (pind.IsValid() && pind <= connectedpairs->Size ())
|
||||||
if (connectedpairs->Range().Contains(pind))
|
if (connectedpairs->Range().Contains(pind))
|
||||||
{
|
{
|
||||||
for (j = 1; j <= connectedpairs->EntrySize(pind); j++)
|
// for (int j = 1; j <= connectedpairs->EntrySize(pind); j++)
|
||||||
|
for (auto j : (*connectedpairs)[pind].Range())
|
||||||
{
|
{
|
||||||
PointIndex oi = connectedpairs->Get(pind, j);
|
//PointIndex oi = connectedpairs->Get(pind, j);
|
||||||
|
PointIndex oi = (*connectedpairs)[pind][j];
|
||||||
PointIndex other = invpindex[oi];
|
PointIndex other = invpindex[oi];
|
||||||
// if (other >= 1 && other <= pindex.Size() &&
|
// if (other >= 1 && other <= pindex.Size() &&
|
||||||
if (pindex.Range().Contains(other) &&
|
if (pindex.Range().Contains(other) &&
|
||||||
|
@ -373,7 +373,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (j = 0; j < ned; j++)
|
for (j = 0; j < ned; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
PointIndices<2> i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
//(*testout) << "edge " << i2 << endl;
|
//(*testout) << "edge " << i2 << endl;
|
||||||
if (!edgenumber.Used(i2))
|
if (!edgenumber.Used(i2))
|
||||||
@ -428,7 +428,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (j = 0; j < ned; j++)
|
for (j = 0; j < ned; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
PointIndices<2> i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
if (!edgenumber.Used(i2))
|
if (!edgenumber.Used(i2))
|
||||||
{
|
{
|
||||||
@ -490,9 +490,9 @@ namespace netgen
|
|||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 e1 (el.PNum(pairs[j][0]),
|
PointIndices<2> e1 (el.PNum(pairs[j][0]),
|
||||||
el.PNum(pairs[j][1]));
|
el.PNum(pairs[j][1]));
|
||||||
INDEX_2 e2 (el.PNum(pairs[j][2]),
|
PointIndices<2> e2 (el.PNum(pairs[j][2]),
|
||||||
el.PNum(pairs[j][3]));
|
el.PNum(pairs[j][3]));
|
||||||
e1.Sort();
|
e1.Sort();
|
||||||
e2.Sort();
|
e2.Sort();
|
||||||
@ -525,7 +525,7 @@ namespace netgen
|
|||||||
|
|
||||||
for(i = 0; i < el2d.GetNP(); i++)
|
for(i = 0; i < el2d.GetNP(); i++)
|
||||||
{
|
{
|
||||||
INDEX_2 e1(el2d[i], el2d[(i+1) % el2d.GetNP()]);
|
PointIndices<2> e1(el2d[i], el2d[(i+1) % el2d.GetNP()]);
|
||||||
e1.Sort();
|
e1.Sort();
|
||||||
INDEX_2 e2;
|
INDEX_2 e2;
|
||||||
|
|
||||||
@ -759,7 +759,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (j = 0; j < ned; j++)
|
for (j = 0; j < ned; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
PointIndices<2> i2(el.PNum(tip[j][0]), el.PNum(tip[j][1]));
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
if (!edgenumber.Used(i2))
|
if (!edgenumber.Used(i2))
|
||||||
{
|
{
|
||||||
@ -819,9 +819,9 @@ namespace netgen
|
|||||||
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 e1 (el.PNum(pairs[j][0]),
|
PointIndices<2> e1 (el.PNum(pairs[j][0]),
|
||||||
el.PNum(pairs[j][1]));
|
el.PNum(pairs[j][1]));
|
||||||
INDEX_2 e2 (el.PNum(pairs[j][2]),
|
PointIndices<2> e2 (el.PNum(pairs[j][2]),
|
||||||
el.PNum(pairs[j][3]));
|
el.PNum(pairs[j][3]));
|
||||||
e1.Sort();
|
e1.Sort();
|
||||||
e2.Sort();
|
e2.Sort();
|
||||||
@ -874,7 +874,7 @@ namespace netgen
|
|||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
for (int j = i+1; j < 4; j++)
|
for (int j = i+1; j < 4; j++)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(mt.pnums[i], mt.pnums[j]);
|
PointIndices<2> i2(mt.pnums[i], mt.pnums[j]);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
int hval = edgenumber.Get(i2);
|
int hval = edgenumber.Get(i2);
|
||||||
if (hval > val)
|
if (hval > val)
|
||||||
@ -894,7 +894,7 @@ namespace netgen
|
|||||||
for (int j = i+1; j < 4; j++)
|
for (int j = i+1; j < 4; j++)
|
||||||
if (i != k && j != k)
|
if (i != k && j != k)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(mt.pnums[i], mt.pnums[j]);
|
PointIndices<2> i2(mt.pnums[i], mt.pnums[j]);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
int hval = edgenumber.Get(i2);
|
int hval = edgenumber.Get(i2);
|
||||||
if (hval > val)
|
if (hval > val)
|
||||||
@ -973,7 +973,8 @@ namespace netgen
|
|||||||
|
|
||||||
bool identified = true;
|
bool identified = true;
|
||||||
mi.np = el.GetNP();
|
mi.np = el.GetNP();
|
||||||
int min1(0),min2(0);
|
// int min1(0),min2(0);
|
||||||
|
PointIndex min1(PointIndex::INVALID), min2(PointIndex::INVALID);
|
||||||
for(int j = 0; identified && j < mi.np; j++)
|
for(int j = 0; identified && j < mi.np; j++)
|
||||||
{
|
{
|
||||||
mi.pnums[j] = el[j];
|
mi.pnums[j] = el[j];
|
||||||
@ -999,7 +1000,7 @@ namespace netgen
|
|||||||
int val = 0;
|
int val = 0;
|
||||||
for (int i = 0; i < mi.np; i++)
|
for (int i = 0; i < mi.np; i++)
|
||||||
{
|
{
|
||||||
INDEX_2 i2(mi.pnums[i], mi.pnums[(i+1)%mi.np]);
|
PointIndices<2> i2(mi.pnums[i], mi.pnums[(i+1)%mi.np]);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
int hval = edgenumber.Get(i2);
|
int hval = edgenumber.Get(i2);
|
||||||
if (hval > val)
|
if (hval > val)
|
||||||
|
@ -269,17 +269,19 @@ namespace netgen
|
|||||||
auto GetNP () const { return points.Size(); }
|
auto GetNP () const { return points.Size(); }
|
||||||
|
|
||||||
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
||||||
MeshPoint & Point(int i)
|
MeshPoint & Point(int i) // 1-based
|
||||||
{
|
{
|
||||||
// return points.Elem(i);
|
// return points.Elem(i);
|
||||||
return Point (PointIndex(i+PointIndex::BASE-1));
|
// return Point (PointIndex(i+PointIndex::BASE-1));
|
||||||
|
return Point (PointIndex(IndexBASE<PointIndex>()+i-1));
|
||||||
}
|
}
|
||||||
MeshPoint & Point(PointIndex pi) { return points[pi]; }
|
MeshPoint & Point(PointIndex pi) { return points[pi]; }
|
||||||
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
// [[deprecated("Use Point(PointIndex) instead of int !")]]
|
||||||
const MeshPoint & Point(int i) const
|
const MeshPoint & Point(int i) const
|
||||||
{
|
{
|
||||||
// return points.Get(i);
|
// return points.Get(i);
|
||||||
return Point (PointIndex(i+PointIndex::BASE-1));
|
// return Point (PointIndex(i+PointIndex::BASE-1));
|
||||||
|
return Point (PointIndex(IndexBASE<PointIndex>()+i-1));
|
||||||
}
|
}
|
||||||
const MeshPoint & Point(PointIndex pi) const { return points[pi]; }
|
const MeshPoint & Point(PointIndex pi) const { return points[pi]; }
|
||||||
|
|
||||||
@ -552,7 +554,7 @@ namespace netgen
|
|||||||
if(!boundaryedges)
|
if(!boundaryedges)
|
||||||
const_cast<Mesh *>(this)->BuildBoundaryEdges();
|
const_cast<Mesh *>(this)->BuildBoundaryEdges();
|
||||||
|
|
||||||
INDEX_2 i2 (pi1, pi2);
|
PointIndices<2> i2(pi1, pi2);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
return boundaryedges->Used (i2);
|
return boundaryedges->Used (i2);
|
||||||
}
|
}
|
||||||
@ -571,7 +573,7 @@ namespace netgen
|
|||||||
|
|
||||||
SegmentIndex SegmentNr (PointIndex pi1, PointIndex pi2) const
|
SegmentIndex SegmentNr (PointIndex pi1, PointIndex pi2) const
|
||||||
{
|
{
|
||||||
INDEX_2 i2 (pi1, pi2);
|
PointIndices<2> i2(pi1, pi2);
|
||||||
i2.Sort();
|
i2.Sort();
|
||||||
return segmentht->Get (i2);
|
return segmentht->Get (i2);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public:
|
|||||||
int GetNP (int fn) const
|
int GetNP (int fn) const
|
||||||
{ return faces.Get(fn).GetNP(); }
|
{ return faces.Get(fn).GetNP(); }
|
||||||
///
|
///
|
||||||
int GetPointNr (int fn, int endp) const
|
PointIndex GetPointNr (int fn, int endp) const
|
||||||
{ return faces.Get(fn).PNum(endp); }
|
{ return faces.Get(fn).PNum(endp); }
|
||||||
///
|
///
|
||||||
int GetPointNrMod (int fn, int endp) const
|
int GetPointNrMod (int fn, int endp) const
|
||||||
|
@ -148,7 +148,7 @@ public:
|
|||||||
|
|
||||||
ELEMENT_TYPE GetFaceType (int fnr) const
|
ELEMENT_TYPE GetFaceType (int fnr) const
|
||||||
// { return (face2vert.Get(fnr)[3] == 0) ? TRIG : QUAD; }
|
// { return (face2vert.Get(fnr)[3] == 0) ? TRIG : QUAD; }
|
||||||
{ return (face2vert[fnr-1][3] == 0) ? TRIG : QUAD; }
|
{ return (!face2vert[fnr-1][3].IsValid()) ? TRIG : QUAD; }
|
||||||
|
|
||||||
void GetSurfaceElementEdges (int elnr, NgArray<int> & edges) const;
|
void GetSurfaceElementEdges (int elnr, NgArray<int> & edges) const;
|
||||||
int GetSurfaceElementFace (int elnr) const;
|
int GetSurfaceElementFace (int elnr) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user