general ClosedHashTable -> NgClosedHashtable to avoid conflict

This commit is contained in:
Christopher Lackner 2023-09-05 12:29:07 +02:00
parent db98dbe216
commit cacd9948f4
4 changed files with 19 additions and 16 deletions

View File

@ -7,6 +7,8 @@
/* Date: 01. Jun. 95 */
/**************************************************************************/
#include "table.hpp"
namespace netgen
{
@ -1410,7 +1412,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
The array should be allocated with the double size of the expected number of entries.
*/
template <class T_HASH, class T>
class ClosedHashTable
class NgClosedHashTable
{
protected:
///
@ -1423,16 +1425,16 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
NgArray<T> cont;
public:
///
ClosedHashTable (size_t asize = 128)
NgClosedHashTable (size_t asize = 128)
: size(asize), used(0), hash(asize), cont(asize)
{
for (auto & v : hash)
SetInvalid(v);
}
ClosedHashTable (ClosedHashTable && ht2) = default;
NgClosedHashTable (NgClosedHashTable && ht2) = default;
ClosedHashTable (NgFlatArray<T_HASH> _hash, NgFlatArray<T> _cont)
NgClosedHashTable (NgFlatArray<T_HASH> _hash, NgFlatArray<T> _cont)
: size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
{
for (auto & v : hash)
@ -1440,7 +1442,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
}
ClosedHashTable & operator= (ClosedHashTable && ht2) = default;
NgClosedHashTable & operator= (NgClosedHashTable && ht2) = default;
///
size_t Size() const
@ -1474,7 +1476,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
void DoubleSize()
{
ClosedHashTable tmp(2*Size());
NgClosedHashTable tmp(2*Size());
for (auto both : *this)
tmp[both.first] = both.second;
*this = std::move(tmp);
@ -1609,10 +1611,10 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
class Iterator
{
const ClosedHashTable & tab;
const NgClosedHashTable & tab;
size_t nr;
public:
Iterator (const ClosedHashTable & _tab, size_t _nr)
Iterator (const NgClosedHashTable & _tab, size_t _nr)
: tab(_tab), nr(_nr)
{
while (nr < tab.Size() && !tab.UsedPos(nr)) nr++;
@ -1639,7 +1641,7 @@ inline size_t HashValue (INDEX_3 i3, size_t size) { return (i3[0]+15*size_t(i3[1
template <class T_HASH, class T>
ostream & operator<< (ostream & ost,
const ClosedHashTable<T_HASH,T> & tab)
const NgClosedHashTable<T_HASH,T> & tab)
{
for (size_t i = 0; i < tab.Size(); i++)
if (tab.UsedPos(i))

View File

@ -10,6 +10,7 @@
#include <general/optmem.hpp>
#include <general/template.hpp>
#include <general/hashtabl.hpp>
#include "geomfuncs.hpp"
@ -434,7 +435,7 @@ public:
// float cmin[dim], cmax[dim];
Point<dim> cmin, cmax;
// NgArray<T_ADTreeNode<dim>*> ela;
ClosedHashTable<T, T_ADTreeNode<dim,T>*> ela;
NgClosedHashTable<T, T_ADTreeNode<dim,T>*> ela;
BlockAllocator ball{sizeof(T_ADTreeNode<dim,T>)};
public:
@ -763,7 +764,7 @@ public:
Leaf() : n_elements(0)
{ }
void Add( ClosedHashTable<T, Leaf*> &leaf_index, const Point<2*dim> &ap, T aindex )
void Add( NgClosedHashTable<T, Leaf*> &leaf_index, const Point<2*dim> &ap, T aindex )
{
p[n_elements] = ap;
index[n_elements] = aindex;
@ -798,7 +799,7 @@ public:
private:
Node root;
ClosedHashTable<T, Leaf*> leaf_index;
NgClosedHashTable<T, Leaf*> leaf_index;
Point<dim> global_min, global_max;
double tol;

View File

@ -1059,7 +1059,7 @@ namespace netgen
// auto begin = r.First();
// auto end = r.Next();
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
ClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
NgClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
// for (PointIndex v = begin+PointIndex::BASE;
// v < end+PointIndex::BASE; v++)
for (PointIndex v : r+PointIndex::BASE)
@ -1124,7 +1124,7 @@ namespace netgen
// auto begin = r.First();
// auto end = r.Next();
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
ClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
NgClosedHashTable<INDEX_3, int> vert2face(2*max_face_on_vertex+10);
/*
for (PointIndex v = begin+PointIndex::BASE;
v < end+PointIndex::BASE; v++)

View File

@ -190,13 +190,13 @@ private:
STLGeometry * geometry;
const STLChart * chart;
// NgArray<STLBoundarySeg> boundary;
ClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
NgClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
unique_ptr<BoxTree<2,INDEX_2>> searchtree;
public:
STLBoundary(STLGeometry * ageometry);
~STLBoundary() {}
void Clear() { /* boundary.SetSize(0); */ boundary_ht = ClosedHashTable<INDEX_2,STLBoundarySeg>(); }
void Clear() { /* boundary.SetSize(0); */ boundary_ht = NgClosedHashTable<INDEX_2,STLBoundarySeg>(); }
void SetChart (const STLChart * achart) { chart = achart; }
//don't check, if already exists!
// void AddNewSegment(const STLBoundarySeg & seg) {boundary.Append(seg);};