mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
replace (most) NgBitArrays
This commit is contained in:
parent
b5fe5a4fb2
commit
209863d79e
@ -12,7 +12,6 @@
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
data type NgBitArray
|
||||
|
||||
@ -29,8 +28,12 @@ class NgBitArray
|
||||
unsigned char * data;
|
||||
|
||||
public:
|
||||
|
||||
[[ deprecated ("use BitArray instead")]]
|
||||
DLL_HEADER NgBitArray ();
|
||||
///
|
||||
[[ deprecated ("use BitArray instead")]]
|
||||
|
||||
DLL_HEADER NgBitArray (INDEX asize);
|
||||
///
|
||||
DLL_HEADER ~NgBitArray ();
|
||||
|
@ -1,5 +1,5 @@
|
||||
HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
int ep1(0), ep2(0), ep3(0), ep4(0), cp1(0), cp2(0), cp3(0), cp4(0), fp1, fp2, fp3, fp4;
|
||||
@ -587,7 +587,7 @@ HPREF_ELEMENT_TYPE ClassifyTet(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
|
||||
|
||||
|
||||
HPREF_ELEMENT_TYPE ClassifyPrism(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
|
||||
@ -824,7 +824,7 @@ HPREF_ELEMENT_TYPE ClassifyPrism(HPRefElement & el, INDEX_2_HASHTABLE<int> & edg
|
||||
|
||||
// #ifdef SABINE
|
||||
HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint, int dim, const FaceDescriptor & fd)
|
||||
|
||||
{
|
||||
@ -1301,7 +1301,7 @@ HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE<int> & edge
|
||||
}
|
||||
#endif
|
||||
HPREF_ELEMENT_TYPE ClassifyQuad(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint, int dim, const FaceDescriptor & fd)
|
||||
{
|
||||
HPREF_ELEMENT_TYPE type = HP_NONE;
|
||||
@ -1651,7 +1651,7 @@ HPREF_ELEMENT_TYPE ClassifyQuad(HPRefElement & el, INDEX_2_HASHTABLE<int> & edge
|
||||
|
||||
|
||||
HPREF_ELEMENT_TYPE ClassifyHex(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
HPREF_ELEMENT_TYPE type = HP_NONE;
|
||||
@ -1756,7 +1756,8 @@ HPREF_ELEMENT_TYPE ClassifyHex(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
|
||||
|
||||
|
||||
HPREF_ELEMENT_TYPE ClassifyHex7 (HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint,
|
||||
INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
// HPREF_ELEMENT_TYPE type = HP_NONE;
|
||||
@ -1795,7 +1796,8 @@ HPREF_ELEMENT_TYPE ClassifyHex7 (HPRefElement & el, INDEX_2_HASHTABLE<int> & edg
|
||||
|
||||
|
||||
HPREF_ELEMENT_TYPE ClassifySegm(HPRefElement & hpel, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint,
|
||||
INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
|
||||
@ -1838,7 +1840,8 @@ HPREF_ELEMENT_TYPE ClassifySegm(HPRefElement & hpel, INDEX_2_HASHTABLE<int> & ed
|
||||
|
||||
|
||||
HPREF_ELEMENT_TYPE ClassifyPyramid(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint,
|
||||
INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint)
|
||||
{
|
||||
// *testout << "classify pyramid, pnums = ";
|
||||
|
@ -1281,7 +1281,7 @@ namespace netgen
|
||||
|
||||
|
||||
auto ne = tempels.Size();
|
||||
NgBitArray inner(ne), outer(ne);
|
||||
BitArray inner(ne+1), outer(ne+1);
|
||||
inner.Clear();
|
||||
outer.Clear();
|
||||
NgArray<int> elstack;
|
||||
@ -1346,9 +1346,9 @@ namespace netgen
|
||||
if (!inner.Test(ei) && !outer.Test(ei))
|
||||
{
|
||||
if (inside)
|
||||
inner.Set(ei);
|
||||
inner.SetBit(ei);
|
||||
else
|
||||
outer.Set(ei);
|
||||
outer.SetBit(ei);
|
||||
|
||||
|
||||
for (int j = 1; j <= 4; j++)
|
||||
@ -1439,7 +1439,7 @@ namespace netgen
|
||||
if (adfront->Inside(ci))
|
||||
outer.Clear(i);
|
||||
else
|
||||
outer.Set(i);
|
||||
outer.SetBit(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1632,8 +1632,8 @@ namespace netgen
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
NgBitArray & cornerpoint, NgBitArray & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HASHTABLE<int> & edgepoint_dom,
|
||||
TBitArray<PointIndex> & cornerpoint, TBitArray<PointIndex> & edgepoint, INDEX_3_HASHTABLE<int> & faces, INDEX_2_HASHTABLE<int> & face_edges,
|
||||
INDEX_2_HASHTABLE<int> & surf_edges, NgArray<int, PointIndex::BASE> & facepoint, int & levels, int & act_ref)
|
||||
{
|
||||
bool sing = 0;
|
||||
@ -1670,7 +1670,7 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
{
|
||||
if (mesh.Point(i).Singularity() * levels >= act_ref)
|
||||
{
|
||||
cornerpoint.Set(i);
|
||||
cornerpoint.SetBit(i);
|
||||
sing = 1;
|
||||
}
|
||||
}
|
||||
@ -1695,8 +1695,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
edges.Set (i2s, 1);
|
||||
|
||||
|
||||
edgepoint.Set (i2.I1());
|
||||
edgepoint.Set (i2.I2());
|
||||
edgepoint.SetBit (i2.I1());
|
||||
edgepoint.SetBit (i2.I2());
|
||||
sing = 1;
|
||||
}
|
||||
|
||||
@ -1718,10 +1718,10 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
ek.Sort();
|
||||
if (edges.Used(ej) && edges.Used(ek))
|
||||
{
|
||||
if (ej.I1() == ek.I1()) cornerpoint.Set (ek.I1());
|
||||
if (ej.I1() == ek.I2()) cornerpoint.Set (ek.I2());
|
||||
if (ej.I2() == ek.I1()) cornerpoint.Set (ek.I1());
|
||||
if (ej.I2() == ek.I2()) cornerpoint.Set (ek.I2());
|
||||
if (ej.I1() == ek.I1()) cornerpoint.SetBit (ek.I1());
|
||||
if (ej.I1() == ek.I2()) cornerpoint.SetBit (ek.I2());
|
||||
if (ej.I2() == ek.I1()) cornerpoint.SetBit (ek.I1());
|
||||
if (ej.I2() == ek.I2()) cornerpoint.SetBit (ek.I2());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1801,10 +1801,10 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
if (seg.singedge_left * levels >= act_ref)
|
||||
{
|
||||
INDEX_2 i2 = INDEX_2::Sort(mesh.LineSegment(i)[0],
|
||||
mesh.LineSegment(i)[1]);
|
||||
mesh.LineSegment(i)[1]);
|
||||
edges.Set(i2,1);
|
||||
edgepoint.Set(i2.I1());
|
||||
edgepoint.Set(i2.I2());
|
||||
edgepoint.SetBit(i2.I1());
|
||||
edgepoint.SetBit(i2.I2());
|
||||
*testout << " singleft " << endl;
|
||||
*testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl;
|
||||
*testout << " mesh.LineSegment(i).domin " << mesh.LineSegment(i).domin << endl;
|
||||
@ -1819,8 +1819,8 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
INDEX_2 i2 = INDEX_2::Sort(mesh.LineSegment(i)[1],
|
||||
mesh.LineSegment(i)[0]);
|
||||
edges.Set (i2, 1);
|
||||
edgepoint.Set(i2.I1());
|
||||
edgepoint.Set(i2.I2());
|
||||
edgepoint.SetBit(i2.I1());
|
||||
edgepoint.SetBit(i2.I2());
|
||||
|
||||
*testout << " singright " << endl;
|
||||
*testout << " mesh.LineSegment(i).domout " << mesh.LineSegment(i).domout << endl;
|
||||
@ -1858,14 +1858,14 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
if (surfonpoint.Get(i).I1())
|
||||
{
|
||||
// cornerpoint.Set(i); // disabled by JS, Aug 2009
|
||||
edgepoint.Set(i);
|
||||
edgepoint.SetBit(i);
|
||||
}
|
||||
|
||||
// mark points for refinement that are explicitly specified in input file
|
||||
if (mesh.Point(i).Singularity()*levels >= act_ref)
|
||||
{
|
||||
cornerpoint.Set(i);
|
||||
edgepoint.Set(i);
|
||||
cornerpoint.SetBit(i);
|
||||
edgepoint.SetBit(i);
|
||||
sing = 1;
|
||||
}
|
||||
}
|
||||
@ -1890,11 +1890,11 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
|
||||
bool ClassifyHPElements (Mesh & mesh, NgArray<HPRefElement> & elements, SplittingType split, int & act_ref, int & levels)
|
||||
{
|
||||
INDEX_2_HASHTABLE<int> edges(mesh.GetNSeg()+1);
|
||||
NgBitArray edgepoint(mesh.GetNP());
|
||||
TBitArray<PointIndex> edgepoint(mesh.GetNP());
|
||||
INDEX_2_HASHTABLE<int> edgepoint_dom(mesh.GetNSeg()+1);
|
||||
|
||||
edgepoint.Clear();
|
||||
NgBitArray cornerpoint(mesh.GetNP());
|
||||
TBitArray<PointIndex> cornerpoint(mesh.GetNP());
|
||||
cornerpoint.Clear();
|
||||
|
||||
// value = nr > 0 ... refine elements in domain nr
|
||||
|
@ -704,7 +704,7 @@ void MeshOptimize3d :: SplitImprove ()
|
||||
|
||||
|
||||
double MeshOptimize3d :: SwapImproveEdge (
|
||||
const NgBitArray * working_elements,
|
||||
const BitArray * working_elements,
|
||||
Table<ElementIndex, PointIndex> & elementsonnode,
|
||||
INDEX_3_HASHTABLE<int> & faces,
|
||||
PointIndex pi1, PointIndex pi2, bool check_only)
|
||||
@ -1328,7 +1328,7 @@ double MeshOptimize3d :: SwapImproveEdge (
|
||||
return d_badness;
|
||||
}
|
||||
|
||||
void MeshOptimize3d :: SwapImprove (const NgBitArray * working_elements)
|
||||
void MeshOptimize3d :: SwapImprove (const BitArray * working_elements)
|
||||
{
|
||||
static Timer t("MeshOptimize3d::SwapImprove"); RegionTimer reg(t);
|
||||
static Timer tloop("MeshOptimize3d::SwapImprove loop");
|
||||
@ -1466,7 +1466,7 @@ void MeshOptimize3d :: SwapImprove (const NgBitArray * working_elements)
|
||||
|
||||
|
||||
void MeshOptimize3d :: SwapImproveSurface (
|
||||
const NgBitArray * working_elements,
|
||||
const BitArray * working_elements,
|
||||
const NgArray< idmap_type* > * idmaps)
|
||||
{
|
||||
NgArray< idmap_type* > locidmaps;
|
||||
|
@ -41,9 +41,9 @@ public:
|
||||
double SplitImprove2Element (ElementIndex ei, const Table<ElementIndex, PointIndex> & elements_of_point, bool check_only);
|
||||
|
||||
|
||||
double SwapImproveEdge (const NgBitArray * working_elements, Table<ElementIndex,PointIndex> & elementsonnode, INDEX_3_HASHTABLE<int> & faces, PointIndex pi1, PointIndex pi2, bool check_only=false);
|
||||
void SwapImprove (const NgBitArray * working_elements = NULL);
|
||||
void SwapImproveSurface (const NgBitArray * working_elements = NULL,
|
||||
double SwapImproveEdge (const BitArray * working_elements, Table<ElementIndex,PointIndex> & elementsonnode, INDEX_3_HASHTABLE<int> & faces, PointIndex pi1, PointIndex pi2, bool check_only=false);
|
||||
void SwapImprove (const BitArray * working_elements = NULL);
|
||||
void SwapImproveSurface (const BitArray * working_elements = NULL,
|
||||
const NgArray< idmap_type* > * idmaps = NULL);
|
||||
void SwapImprove2 ();
|
||||
double SwapImprove2 (ElementIndex eli1, int face, Table<ElementIndex, PointIndex> & elementsonnode, TABLE<SurfaceElementIndex, PointIndex::BASE> & belementsonnode, bool check_only=false );
|
||||
|
@ -2457,7 +2457,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
// NgBitArray base is PointIndex::BASE ...
|
||||
void Mesh :: FixPoints (const NgBitArray & fixpoints)
|
||||
void Mesh :: FixPoints (const TBitArray<PointIndex> & fixpoints)
|
||||
{
|
||||
if (fixpoints.Size() != GetNP())
|
||||
{
|
||||
@ -3219,14 +3219,14 @@ namespace netgen
|
||||
int np = GetNP();
|
||||
|
||||
FindOpenSegments();
|
||||
NgBitArray frontpoints(np+1); // for 0- and 1-based
|
||||
TBitArray<PointIndex> frontpoints(np); // for 0- and 1-based
|
||||
frontpoints.Clear();
|
||||
|
||||
for (int i = 1; i <= GetNOpenSegments(); i++)
|
||||
{
|
||||
const Segment & seg = GetOpenSegment(i);
|
||||
frontpoints.Set (seg[0]);
|
||||
frontpoints.Set (seg[1]);
|
||||
frontpoints.SetBit (seg[0]);
|
||||
frontpoints.SetBit (seg[1]);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= GetNSE(); i++)
|
||||
@ -4799,10 +4799,10 @@ namespace netgen
|
||||
|
||||
void Mesh :: SurfaceMeshOrientation ()
|
||||
{
|
||||
int i, j;
|
||||
// int i, j;
|
||||
int nse = GetNSE();
|
||||
|
||||
NgBitArray used(nse);
|
||||
BitArray used(nse+1);
|
||||
used.Clear();
|
||||
INDEX_2_HASHTABLE<int> edges(nse+1);
|
||||
|
||||
@ -4810,12 +4810,12 @@ namespace netgen
|
||||
|
||||
|
||||
const Element2d & tri = SurfaceElement(1);
|
||||
for (j = 1; j <= 3; j++)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
INDEX_2 i2(tri.PNumMod(j), tri.PNumMod(j+1));
|
||||
edges.Set (i2, 1);
|
||||
}
|
||||
used.Set(1);
|
||||
used.SetBit(1);
|
||||
|
||||
bool unused;
|
||||
do
|
||||
@ -4824,12 +4824,12 @@ namespace netgen
|
||||
do
|
||||
{
|
||||
changed = 0;
|
||||
for (i = 1; i <= nse; i++)
|
||||
for (int i = 1; i <= nse; i++)
|
||||
if (!used.Test(i))
|
||||
{
|
||||
Element2d & el = surfelements[i-1];
|
||||
int found = 0, foundrev = 0;
|
||||
for (j = 1; j <= 3; j++)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
INDEX_2 i2(el.PNumMod(j), el.PNumMod(j+1));
|
||||
if (edges.Used(i2))
|
||||
@ -4845,12 +4845,12 @@ namespace netgen
|
||||
swap (el.PNum(2), el.PNum(3));
|
||||
|
||||
changed = 1;
|
||||
for (j = 1; j <= 3; j++)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
INDEX_2 i2(el.PNumMod(j), el.PNumMod(j+1));
|
||||
edges.Set (i2, 1);
|
||||
}
|
||||
used.Set (i);
|
||||
used.SetBit (i);
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
@ -4860,17 +4860,17 @@ namespace netgen
|
||||
|
||||
|
||||
unused = 0;
|
||||
for (i = 1; i <= nse; i++)
|
||||
for (int i = 1; i <= nse; i++)
|
||||
if (!used.Test(i))
|
||||
{
|
||||
unused = 1;
|
||||
const Element2d & tri = SurfaceElement(i);
|
||||
for (j = 1; j <= 3; j++)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
{
|
||||
INDEX_2 i2(tri.PNumMod(j), tri.PNumMod(j+1));
|
||||
edges.Set (i2, 1);
|
||||
}
|
||||
used.Set(i);
|
||||
used.SetBit(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -6105,17 +6105,17 @@ namespace netgen
|
||||
|
||||
void Mesh :: SplitIntoParts()
|
||||
{
|
||||
int i, j, dom;
|
||||
// int i, j, dom;
|
||||
int ne = GetNE();
|
||||
int np = GetNP();
|
||||
int nse = GetNSE();
|
||||
|
||||
NgBitArray surfused(nse);
|
||||
NgBitArray pused (np);
|
||||
BitArray surfused(nse+1);
|
||||
TBitArray<PointIndex> pused (np);
|
||||
|
||||
surfused.Clear();
|
||||
|
||||
dom = 0;
|
||||
int dom = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -6126,15 +6126,15 @@ namespace netgen
|
||||
pused.Clear();
|
||||
|
||||
int found = 0;
|
||||
for (i = 1; i <= nse; i++)
|
||||
for (int i = 1; i <= nse; i++)
|
||||
if (!surfused.Test(i))
|
||||
{
|
||||
SurfaceElement(i).SetIndex (dom);
|
||||
for (j = 1; j <= 3; j++)
|
||||
pused.Set (SurfaceElement(i).PNum(j));
|
||||
for (int j = 1; j <= 3; j++)
|
||||
pused.SetBit (SurfaceElement(i).PNum(j));
|
||||
found = 1;
|
||||
cntd = 1;
|
||||
surfused.Set(i);
|
||||
surfused.SetBit(i);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6145,10 +6145,10 @@ namespace netgen
|
||||
do
|
||||
{
|
||||
change = 0;
|
||||
for (i = 1; i <= nse; i++)
|
||||
for (int i = 1; i <= nse; i++)
|
||||
{
|
||||
int is = 0, isnot = 0;
|
||||
for (j = 1; j <= 3; j++)
|
||||
for (int j = 1; j <= 3; j++)
|
||||
if (pused.Test(SurfaceElement(i).PNum(j)))
|
||||
is = 1;
|
||||
else
|
||||
@ -6157,15 +6157,15 @@ namespace netgen
|
||||
if (is && isnot)
|
||||
{
|
||||
change = 1;
|
||||
for (j = 1; j <= 3; j++)
|
||||
pused.Set (SurfaceElement(i).PNum(j));
|
||||
for (int j = 1; j <= 3; j++)
|
||||
pused.SetBit (SurfaceElement(i).PNum(j));
|
||||
}
|
||||
|
||||
if (is)
|
||||
{
|
||||
if (!surfused.Test(i))
|
||||
{
|
||||
surfused.Set(i);
|
||||
surfused.SetBit(i);
|
||||
SurfaceElement(i).SetIndex (dom);
|
||||
cntd++;
|
||||
}
|
||||
@ -6173,10 +6173,10 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
for (i = 1; i <= ne; i++)
|
||||
for (int i = 1; i <= ne; i++)
|
||||
{
|
||||
int is = 0, isnot = 0;
|
||||
for (j = 1; j <= 4; j++)
|
||||
for (int j = 1; j <= 4; j++)
|
||||
if (pused.Test(VolumeElement(i).PNum(j)))
|
||||
is = 1;
|
||||
else
|
||||
@ -6185,8 +6185,8 @@ namespace netgen
|
||||
if (is && isnot)
|
||||
{
|
||||
change = 1;
|
||||
for (j = 1; j <= 4; j++)
|
||||
pused.Set (VolumeElement(i).PNum(j));
|
||||
for (int j = 1; j <= 4; j++)
|
||||
pused.SetBit (VolumeElement(i).PNum(j));
|
||||
}
|
||||
|
||||
if (is)
|
||||
@ -6210,7 +6210,7 @@ namespace netgen
|
||||
}
|
||||
*/
|
||||
ClearFaceDescriptors();
|
||||
for (i = 1; i <= dom; i++)
|
||||
for (int i = 1; i <= dom; i++)
|
||||
AddFaceDescriptor (FaceDescriptor (0, i, 0, 0));
|
||||
CalcSurfacesOfNode();
|
||||
timestamp = NextTimeStamp();
|
||||
@ -6222,7 +6222,7 @@ namespace netgen
|
||||
int fdi;
|
||||
int np = GetNP();
|
||||
|
||||
NgBitArray usedp(np);
|
||||
TBitArray<PointIndex> usedp(np);
|
||||
Array<SurfaceElementIndex> els_of_face;
|
||||
|
||||
fdi = 1;
|
||||
@ -6240,7 +6240,7 @@ namespace netgen
|
||||
|
||||
usedp.Clear();
|
||||
for (int j = 1; j <= SurfaceElement(firstel).GetNP(); j++)
|
||||
usedp.Set (SurfaceElement(firstel).PNum(j));
|
||||
usedp.SetBit (SurfaceElement(firstel).PNum(j));
|
||||
|
||||
bool changed;
|
||||
do
|
||||
@ -6266,7 +6266,7 @@ namespace netgen
|
||||
|
||||
if (has)
|
||||
for (int j = 0; j < el.GetNP(); j++)
|
||||
usedp.Set (el[j]);
|
||||
usedp.SetBit (el[j]);
|
||||
}
|
||||
}
|
||||
while (changed);
|
||||
|
@ -425,7 +425,7 @@ namespace netgen
|
||||
DLL_HEADER void CalcSurfacesOfNode ();
|
||||
|
||||
/// additional (temporarily) fix points
|
||||
void FixPoints (const NgBitArray & fixpoints);
|
||||
void FixPoints (const TBitArray<PointIndex> & fixpoints);
|
||||
|
||||
/**
|
||||
finds elements without neighbour and
|
||||
@ -606,10 +606,11 @@ namespace netgen
|
||||
DLL_HEADER void ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY);
|
||||
|
||||
///
|
||||
void ImproveMeshJacobian (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY, const NgBitArray * usepoint = NULL);
|
||||
void ImproveMeshJacobian (const MeshingParameters & mp, OPTIMIZEGOAL goal = OPT_QUALITY,
|
||||
const TBitArray<PointIndex> * usepoint = NULL);
|
||||
///
|
||||
void ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
|
||||
const NgBitArray & usepoint,
|
||||
const TBitArray<PointIndex> & usepoint,
|
||||
const NgArray< Vec<3>* > & nv,
|
||||
OPTIMIZEGOAL goal = OPT_QUALITY,
|
||||
const NgArray< idmap_type* > * idmaps = NULL);
|
||||
|
@ -820,11 +820,11 @@ namespace netgen
|
||||
can.Elem(parent.I2()));
|
||||
}
|
||||
|
||||
NgBitArray boundp(np);
|
||||
TBitArray<PointIndex> boundp(np);
|
||||
boundp.Clear();
|
||||
for (auto & sel : mesh.SurfaceElements())
|
||||
for (auto pi : sel.PNums())
|
||||
boundp.Set(pi);
|
||||
boundp.SetBit(pi);
|
||||
|
||||
|
||||
double lam = 0.5;
|
||||
@ -851,14 +851,14 @@ namespace netgen
|
||||
mesh.Point(i) = can.Get(i);
|
||||
|
||||
|
||||
NgBitArray free (mesh.GetNP()), fhelp(mesh.GetNP());
|
||||
TBitArray<PointIndex> free (mesh.GetNP()), fhelp(mesh.GetNP());
|
||||
free.Clear();
|
||||
for (int i = 1; i <= mesh.GetNE(); i++)
|
||||
{
|
||||
const Element & el = mesh.VolumeElement(i);
|
||||
if (el.Volume(mesh.Points()) < 0)
|
||||
for (int j = 1; j <= el.GetNP(); j++)
|
||||
free.Set (el.PNum(j));
|
||||
free.SetBit (el.PNum(j));
|
||||
}
|
||||
for (int k = 1; k <= 3; k++)
|
||||
{
|
||||
@ -872,7 +872,7 @@ namespace netgen
|
||||
freeel = 1;
|
||||
if (freeel)
|
||||
for (int j = 1; j <= el.GetNP(); j++)
|
||||
fhelp.Set (el.PNum(j));
|
||||
fhelp.SetBit (el.PNum(j));
|
||||
}
|
||||
free.Or (fhelp);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ namespace netgen
|
||||
double facok = 0;
|
||||
double factry;
|
||||
|
||||
NgBitArray illegalels(ne);
|
||||
BitArray illegalels(ne+1);
|
||||
illegalels.Clear();
|
||||
|
||||
|
||||
@ -505,13 +505,13 @@ namespace netgen
|
||||
can.Elem(parents.Get(i).I2()));
|
||||
}
|
||||
|
||||
NgBitArray boundp(np);
|
||||
TBitArray<PointIndex> boundp(np);
|
||||
boundp.Clear();
|
||||
for (int i = 1; i <= mesh.GetNSE(); i++)
|
||||
{
|
||||
const Element2d & sel = mesh.SurfaceElement(i);
|
||||
for (int j = 1; j <= sel.GetNP(); j++)
|
||||
boundp.Set(sel.PNum(j));
|
||||
boundp.SetBit(sel.PNum(j));
|
||||
}
|
||||
|
||||
|
||||
@ -563,7 +563,7 @@ namespace netgen
|
||||
|
||||
|
||||
if (lam < 1e-4)
|
||||
illegalels.Set(i);
|
||||
illegalels.SetBit(i);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -110,7 +110,7 @@ namespace netgen
|
||||
int np = mesh.GetNP();
|
||||
int ne = mesh.GetNE();
|
||||
|
||||
NgBitArray badnodes(np);
|
||||
TBitArray<PointIndex> badnodes(np);
|
||||
badnodes.Clear();
|
||||
|
||||
for (i = 1; i <= ne; i++)
|
||||
@ -119,7 +119,7 @@ namespace netgen
|
||||
double bad = el.CalcJacobianBadness (mesh.Points());
|
||||
if (bad > 1)
|
||||
for (j = 1; j <= el.GetNP(); j++)
|
||||
badnodes.Set (el.PNum(j));
|
||||
badnodes.SetBit (el.PNum(j));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1485,7 +1485,7 @@ void Mesh :: ImproveMesh (const MeshingParameters & mp, OPTIMIZEGOAL goal)
|
||||
|
||||
// Improve Condition number of Jacobian, any elements
|
||||
void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp,
|
||||
OPTIMIZEGOAL goal, const NgBitArray * usepoint)
|
||||
OPTIMIZEGOAL goal, const TBitArray<PointIndex> * usepoint)
|
||||
{
|
||||
// int i, j;
|
||||
|
||||
@ -1507,7 +1507,7 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp,
|
||||
par.maxit_linsearch = 20;
|
||||
par.maxit_bfgs = 20;
|
||||
|
||||
NgBitArray badnodes(np);
|
||||
TBitArray<PointIndex> badnodes(np);
|
||||
badnodes.Clear();
|
||||
|
||||
for (int i = 1; i <= ne; i++)
|
||||
@ -1516,7 +1516,7 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp,
|
||||
double bad = el.CalcJacobianBadness (Points());
|
||||
if (bad > 1)
|
||||
for (int j = 1; j <= el.GetNP(); j++)
|
||||
badnodes.Set (el.PNum(j));
|
||||
badnodes.SetBit (el.PNum(j));
|
||||
}
|
||||
|
||||
NgArray<double, PointIndex::BASE, PointIndex> pointh (points.Size());
|
||||
@ -1608,7 +1608,7 @@ void Mesh :: ImproveMeshJacobian (const MeshingParameters & mp,
|
||||
|
||||
// Improve Condition number of Jacobian, any elements
|
||||
void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
|
||||
const NgBitArray & usepoint,
|
||||
const TBitArray<PointIndex> & usepoint,
|
||||
const NgArray< Vec<3>* > & nv,
|
||||
OPTIMIZEGOAL goal,
|
||||
const NgArray< idmap_type* > * idmaps)
|
||||
@ -1664,7 +1664,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
|
||||
par.maxit_linsearch = 20;
|
||||
par.maxit_bfgs = 20;
|
||||
|
||||
NgBitArray badnodes(np);
|
||||
TBitArray<PointIndex> badnodes(np);
|
||||
badnodes.Clear();
|
||||
|
||||
for (int i = 1; i <= ne; i++)
|
||||
@ -1673,7 +1673,7 @@ void Mesh :: ImproveMeshJacobianOnSurface (const MeshingParameters & mp,
|
||||
double bad = el.CalcJacobianBadness (Points());
|
||||
if (bad > 1)
|
||||
for (int j = 1; j <= el.GetNP(); j++)
|
||||
badnodes.Set (el.PNum(j));
|
||||
badnodes.SetBit (el.PNum(j));
|
||||
}
|
||||
|
||||
NgArray<double, PointIndex::BASE> pointh (points.Size());
|
||||
|
@ -62,13 +62,13 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh)
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
NgBitArray connected(mesh.GetNP());
|
||||
TBitArray<PointIndex> connected(mesh.GetNP());
|
||||
connected.Clear();
|
||||
for (i = 1; i <= mesh.GetNSE(); i++)
|
||||
{
|
||||
const Element2d & el = mesh.SurfaceElement(i);
|
||||
for (j = 1; j <= 3; j++)
|
||||
connected.Set(el.PNum(j));
|
||||
connected.SetBit(el.PNum(j));
|
||||
}
|
||||
|
||||
bool changed;
|
||||
@ -92,7 +92,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh)
|
||||
{
|
||||
changed = 1;
|
||||
for (j = 0; j < 4; j++)
|
||||
connected.Set (el[j]);
|
||||
connected.SetBit (el[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh)
|
||||
mesh.Compress();
|
||||
|
||||
mesh.FindOpenElements();
|
||||
NgBitArray locked(mesh.GetNP());
|
||||
TBitArray<PointIndex> locked(mesh.GetNP());
|
||||
locked.Set();
|
||||
for (i = 1; i <= mesh.GetNOpenElements(); i++)
|
||||
for (j = 1; j <= 3; j++)
|
||||
|
@ -104,7 +104,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
void GetWorkingArea(NgBitArray & working_elements, NgBitArray & working_points,
|
||||
void GetWorkingArea(BitArray & working_elements, TBitArray<PointIndex> & working_points,
|
||||
const Mesh & mesh, const NgArray<ElementIndex> & bad_elements,
|
||||
const int width)
|
||||
{
|
||||
@ -113,10 +113,10 @@ namespace netgen
|
||||
|
||||
for(int i=0; i<bad_elements.Size(); i++)
|
||||
{
|
||||
working_elements.Set(bad_elements[i]);
|
||||
working_elements.SetBit(bad_elements[i]);
|
||||
const Element & el = mesh[bad_elements[i]];
|
||||
for(int j=1; j<=el.GetNP(); j++)
|
||||
working_points.Set(el.PNum(j));
|
||||
working_points.SetBit(el.PNum(j));
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ namespace netgen
|
||||
set_active = working_points.Test(el.PNum(k));
|
||||
|
||||
if(set_active)
|
||||
working_elements.Set(j);
|
||||
working_elements.SetBit(j);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ namespace netgen
|
||||
{
|
||||
const Element & el = mesh[j];
|
||||
for(int k=1; k<=el.GetNP(); k++)
|
||||
working_points.Set(el.PNum(k));
|
||||
working_points.SetBit(el.PNum(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -185,15 +185,15 @@ namespace netgen
|
||||
can[i] = new Point<3>;
|
||||
}
|
||||
|
||||
NgBitArray isboundarypoint(np),isedgepoint(np);
|
||||
TBitArray<PointIndex> isboundarypoint(np),isedgepoint(np);
|
||||
isboundarypoint.Clear();
|
||||
isedgepoint.Clear();
|
||||
|
||||
for(int i = 1; i <= mesh.GetNSeg(); i++)
|
||||
{
|
||||
const Segment & seg = mesh.LineSegment(i);
|
||||
isedgepoint.Set(seg[0]);
|
||||
isedgepoint.Set(seg[1]);
|
||||
isedgepoint.SetBit(seg[0]);
|
||||
isedgepoint.SetBit(seg[1]);
|
||||
}
|
||||
|
||||
NgArray<int> surfaceindex(np);
|
||||
@ -205,7 +205,7 @@ namespace netgen
|
||||
for (int j = 1; j <= sel.GetNP(); j++)
|
||||
if(!isedgepoint.Test(sel.PNum(j)))
|
||||
{
|
||||
isboundarypoint.Set(sel.PNum(j));
|
||||
isboundarypoint.SetBit(sel.PNum(j));
|
||||
surfaceindex[sel.PNum(j) - PointIndex::BASE] =
|
||||
mesh.GetFaceDescriptor(sel.GetIndex()).SurfNr();
|
||||
}
|
||||
@ -216,8 +216,8 @@ namespace netgen
|
||||
Validate(mesh,bad_elements,pure_badness,
|
||||
((uselocalworsening) ? (0.8*(max_worsening-1.) + 1.) : (0.1*(max_worsening-1.) + 1.)),
|
||||
uselocalworsening); // -> larger working area
|
||||
NgBitArray working_elements(ne);
|
||||
NgBitArray working_points(np);
|
||||
BitArray working_elements(ne+1);
|
||||
TBitArray<PointIndex> working_points(np);
|
||||
|
||||
GetWorkingArea(working_elements,working_points,mesh,bad_elements,numbadneighbours);
|
||||
//working_elements.Set();
|
||||
@ -240,10 +240,10 @@ namespace netgen
|
||||
PrintMessage(5,ostrstr.str());
|
||||
|
||||
|
||||
NgBitArray isworkingboundary(np);
|
||||
TBitArray<PointIndex> isworkingboundary(np);
|
||||
for(int i=1; i<=np; i++)
|
||||
if(working_points.Test(i) && isboundarypoint.Test(i))
|
||||
isworkingboundary.Set(i);
|
||||
isworkingboundary.SetBit(i);
|
||||
else
|
||||
isworkingboundary.Clear(i);
|
||||
|
||||
@ -497,7 +497,7 @@ namespace netgen
|
||||
GetWorkingArea(working_elements,working_points,mesh,bad_elements,numbadneighbours);
|
||||
for(int i=1; i<=np; i++)
|
||||
if(working_points.Test(i) && isboundarypoint.Test(i))
|
||||
isworkingboundary.Set(i);
|
||||
isworkingboundary.SetBit(i);
|
||||
else
|
||||
isworkingboundary.Clear(i);
|
||||
auxnum=0;
|
||||
|
Loading…
Reference in New Issue
Block a user