Remove BitArrayChar

This commit is contained in:
Matthias Hochsteger 2019-08-20 17:59:36 +02:00
parent 38d8d0cd71
commit 579e5d3874
6 changed files with 22 additions and 149 deletions

View File

@ -82,51 +82,4 @@ namespace netgen
}
template <int BASE>
void BitArrayChar<BASE> :: Set ()
{
data = 1;
}
template <int BASE>
void BitArrayChar<BASE> :: Clear ()
{
data = 0;
}
template <int BASE>
void BitArrayChar<BASE> :: Invert ()
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] = 1 - data[i];
}
template <int BASE>
void BitArrayChar<BASE> :: And (const BitArrayChar & ba2)
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] &= ba2.data[i];
}
template <int BASE>
void BitArrayChar<BASE> :: Or (const BitArrayChar & ba2)
{
for (int i = BASE; i < data.Size()+BASE; i++)
data[i] |= ba2.data[i];
}
template class BitArrayChar<0>;
template class BitArrayChar<1>;
}

View File

@ -142,86 +142,6 @@ int BitArray :: Test (INDEX i) const
*/
/**
data type BitArrayChar
BitArray is an array of Boolean information. By Set and Clear
the whole array or one bit can be set or reset, respectively.
Test returns the state of the occurring bit.
No range checking is done.
*/
template <int BASE = 1>
class BitArrayChar
{
///
NgArray<char,BASE> data;
public:
///
BitArrayChar ()
{ ; }
///
BitArrayChar (int asize)
: data(asize)
{ ; }
///
~BitArrayChar ()
{ ; }
///
void SetSize (int asize)
{ data.SetSize(asize); }
///
inline int Size () const
{ return data.Size(); }
///
void Set ();
///
inline void Set (int i)
{ data[i] = 1; }
///
void Clear ();
///
inline void Clear (int i)
{ data[i] = 0; }
///
inline int Test (int i) const
{ return data[i]; }
///
void Invert ();
///
void And (const BitArrayChar & ba2);
///
void Or (const BitArrayChar & ba2);
private:
/// copy bitarray is not supported
BitArrayChar & operator= (BitArrayChar &) { return *this; }
/// copy bitarray is not supported
BitArrayChar (const BitArrayChar &) { ; }
};
template <int BASE>
inline ostream & operator<< (ostream & s, const BitArrayChar<BASE> & a)
{
for (int i = BASE; i < a.Size()+BASE; i++)
{
s << a.Test(i);
if ( (i-BASE) % 40 == 39) s << "\n";
}
if (a.Size() % 40 != 0) s << "\n";
return s;
}
}
#endif

View File

@ -349,18 +349,18 @@ void AdFront3 :: RebuildInternalTables ()
BitArrayChar<PointIndex::BASE> usecl(np);
usecl.Clear();
Array<bool, PointIndex> usecl(np);
usecl = false;
for (int i = 1; i <= faces.Size(); i++)
{
usecl.Set (points[faces.Get(i).Face().PNum(1)].cluster);
usecl[points[faces.Get(i).Face().PNum(1)].cluster] = true;
faces.Elem(i).cluster =
points[faces.Get(i).Face().PNum(1)].cluster;
}
int cntcl = 0;
for (int i = PointIndex::BASE;
i < np+PointIndex::BASE; i++)
if (usecl.Test(i))
if (usecl[i])
cntcl++;
NgArray<double, PointIndex::BASE> clvol (np);

View File

@ -561,19 +561,19 @@ namespace netgen
startel[3] = mesh.AddPoint (cp4);
// flag points to use for Delaunay:
BitArrayChar<PointIndex::BASE> usep(np);
usep.Clear();
Array<bool, PointIndex> usep(np);
usep = false;
for (auto & face : adfront->Faces())
for (PointIndex pi : face.Face().PNums())
usep.Set (pi);
usep[pi] = true;
for (size_t i = oldnp + PointIndex::BASE;
i < np + PointIndex::BASE; i++)
usep.Set (i);
usep[i] = true;
for (PointIndex pi : mesh.LockedPoints())
usep.Set (pi);
usep[pi] = true;
NgArray<int> freelist;
@ -649,7 +649,7 @@ namespace netgen
PointIndex newpi = mixed[pi];
if (!usep.Test(newpi))
if (!usep[newpi])
continue;
cntp++;

View File

@ -3260,7 +3260,7 @@ namespace netgen
NgArray<PointIndex,PointIndex::BASE,PointIndex> op2np(GetNP());
NgArray<MeshPoint> hpoints;
BitArrayChar<PointIndex::BASE> pused(GetNP());
Array<bool, PointIndex> pused(GetNP());
/*
(*testout) << "volels: " << endl;
@ -3300,37 +3300,37 @@ namespace netgen
if(segments[i].edgenr < 0)
segments.DeleteElement(i--);
pused.Clear();
pused = false;
for (int i = 0; i < volelements.Size(); i++)
{
const Element & el = volelements[i];
for (int j = 0; j < el.GetNP(); j++)
pused.Set (el[j]);
pused[el[j]] = true;
}
for (int i = 0; i < surfelements.Size(); i++)
{
const Element2d & el = surfelements[i];
for (int j = 0; j < el.GetNP(); j++)
pused.Set (el[j]);
pused[el[j]] = true;
}
for (int i = 0; i < segments.Size(); i++)
{
const Segment & seg = segments[i];
for (int j = 0; j < seg.GetNP(); j++)
pused.Set (seg[j]);
pused[seg[j]] = true;
}
for (int i = 0; i < openelements.Size(); i++)
{
const Element2d & el = openelements[i];
for (int j = 0; j < el.GetNP(); j++)
pused.Set(el[j]);
pused[el[j]] = true;
}
for (int i = 0; i < lockedpoints.Size(); i++)
pused.Set (lockedpoints[i]);
pused[lockedpoints[i]] = true;
/*
@ -3352,7 +3352,7 @@ namespace netgen
// for (PointIndex pi = points.Begin(); pi < points.End(); pi++)
for (PointIndex pi : points.Range())
if (pused.Test(pi))
if (pused[pi])
{
npi++;
op2np[pi] = npi;

View File

@ -964,7 +964,7 @@ namespace netgen
mesh.FindOpenElements(domainnr);
int np = mesh.GetNP();
BitArrayChar<PointIndex::BASE> ppoints(np);
Array<bool, PointIndex> ppoints(np);
// int ndom = mesh.GetNDomains();
@ -972,7 +972,7 @@ namespace netgen
// for (k = 1; k <= ndom; k++)
k = domainnr;
{
ppoints.Clear();
ppoints = false;
for (i = 1; i <= mesh.GetNOpenElements(); i++)
{
@ -980,7 +980,7 @@ namespace netgen
if (sel.GetIndex() == k)
{
for (j = 1; j <= sel.GetNP(); j++)
ppoints.Set (sel.PNum(j));
ppoints[sel.PNum(j)] = true;
}
}
@ -991,7 +991,7 @@ namespace netgen
{
int todel = 0;
for (j = 0; j < el.GetNP(); j++)
if (ppoints.Test (el[j]))
if (ppoints[el[j]])
todel = 1;
if (el.GetNP() != 4)