mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
general ClosedHashTable -> NgClosedHashtable to avoid conflict
This commit is contained in:
parent
db98dbe216
commit
cacd9948f4
@ -7,6 +7,8 @@
|
|||||||
/* Date: 01. Jun. 95 */
|
/* Date: 01. Jun. 95 */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
#include "table.hpp"
|
||||||
|
|
||||||
namespace netgen
|
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.
|
The array should be allocated with the double size of the expected number of entries.
|
||||||
*/
|
*/
|
||||||
template <class T_HASH, class T>
|
template <class T_HASH, class T>
|
||||||
class ClosedHashTable
|
class NgClosedHashTable
|
||||||
{
|
{
|
||||||
protected:
|
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;
|
NgArray<T> cont;
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
ClosedHashTable (size_t asize = 128)
|
NgClosedHashTable (size_t asize = 128)
|
||||||
: size(asize), used(0), hash(asize), cont(asize)
|
: size(asize), used(0), hash(asize), cont(asize)
|
||||||
{
|
{
|
||||||
for (auto & v : hash)
|
for (auto & v : hash)
|
||||||
SetInvalid(v);
|
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))
|
: size(_hash.Size()), used(0), hash(_hash.Size(), _hash.Addr(0)), cont(_cont.Size(), _cont.Addr(0))
|
||||||
{
|
{
|
||||||
for (auto & v : hash)
|
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
|
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()
|
void DoubleSize()
|
||||||
{
|
{
|
||||||
ClosedHashTable tmp(2*Size());
|
NgClosedHashTable tmp(2*Size());
|
||||||
for (auto both : *this)
|
for (auto both : *this)
|
||||||
tmp[both.first] = both.second;
|
tmp[both.first] = both.second;
|
||||||
*this = std::move(tmp);
|
*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
|
class Iterator
|
||||||
{
|
{
|
||||||
const ClosedHashTable & tab;
|
const NgClosedHashTable & tab;
|
||||||
size_t nr;
|
size_t nr;
|
||||||
public:
|
public:
|
||||||
Iterator (const ClosedHashTable & _tab, size_t _nr)
|
Iterator (const NgClosedHashTable & _tab, size_t _nr)
|
||||||
: tab(_tab), nr(_nr)
|
: tab(_tab), nr(_nr)
|
||||||
{
|
{
|
||||||
while (nr < tab.Size() && !tab.UsedPos(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>
|
template <class T_HASH, class T>
|
||||||
ostream & operator<< (ostream & ost,
|
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++)
|
for (size_t i = 0; i < tab.Size(); i++)
|
||||||
if (tab.UsedPos(i))
|
if (tab.UsedPos(i))
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <general/optmem.hpp>
|
#include <general/optmem.hpp>
|
||||||
#include <general/template.hpp>
|
#include <general/template.hpp>
|
||||||
|
#include <general/hashtabl.hpp>
|
||||||
|
|
||||||
#include "geomfuncs.hpp"
|
#include "geomfuncs.hpp"
|
||||||
|
|
||||||
@ -434,7 +435,7 @@ public:
|
|||||||
// float cmin[dim], cmax[dim];
|
// float cmin[dim], cmax[dim];
|
||||||
Point<dim> cmin, cmax;
|
Point<dim> cmin, cmax;
|
||||||
// NgArray<T_ADTreeNode<dim>*> ela;
|
// 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>)};
|
BlockAllocator ball{sizeof(T_ADTreeNode<dim,T>)};
|
||||||
public:
|
public:
|
||||||
@ -763,7 +764,7 @@ public:
|
|||||||
Leaf() : n_elements(0)
|
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;
|
p[n_elements] = ap;
|
||||||
index[n_elements] = aindex;
|
index[n_elements] = aindex;
|
||||||
@ -798,7 +799,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Node root;
|
Node root;
|
||||||
|
|
||||||
ClosedHashTable<T, Leaf*> leaf_index;
|
NgClosedHashTable<T, Leaf*> leaf_index;
|
||||||
|
|
||||||
Point<dim> global_min, global_max;
|
Point<dim> global_min, global_max;
|
||||||
double tol;
|
double tol;
|
||||||
|
@ -1059,7 +1059,7 @@ namespace netgen
|
|||||||
// auto begin = r.First();
|
// auto begin = r.First();
|
||||||
// auto end = r.Next();
|
// auto end = r.Next();
|
||||||
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
|
// 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;
|
// for (PointIndex v = begin+PointIndex::BASE;
|
||||||
// v < end+PointIndex::BASE; v++)
|
// v < end+PointIndex::BASE; v++)
|
||||||
for (PointIndex v : r+PointIndex::BASE)
|
for (PointIndex v : r+PointIndex::BASE)
|
||||||
@ -1124,7 +1124,7 @@ namespace netgen
|
|||||||
// auto begin = r.First();
|
// auto begin = r.First();
|
||||||
// auto end = r.Next();
|
// auto end = r.Next();
|
||||||
// INDEX_3_CLOSED_HASHTABLE<int> vert2face(2*max_face_on_vertex+10);
|
// 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;
|
for (PointIndex v = begin+PointIndex::BASE;
|
||||||
v < end+PointIndex::BASE; v++)
|
v < end+PointIndex::BASE; v++)
|
||||||
|
@ -190,13 +190,13 @@ private:
|
|||||||
STLGeometry * geometry;
|
STLGeometry * geometry;
|
||||||
const STLChart * chart;
|
const STLChart * chart;
|
||||||
// NgArray<STLBoundarySeg> boundary;
|
// NgArray<STLBoundarySeg> boundary;
|
||||||
ClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
|
NgClosedHashTable<INDEX_2, STLBoundarySeg> boundary_ht;
|
||||||
unique_ptr<BoxTree<2,INDEX_2>> searchtree;
|
unique_ptr<BoxTree<2,INDEX_2>> searchtree;
|
||||||
public:
|
public:
|
||||||
STLBoundary(STLGeometry * ageometry);
|
STLBoundary(STLGeometry * ageometry);
|
||||||
~STLBoundary() {}
|
~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; }
|
void SetChart (const STLChart * achart) { chart = achart; }
|
||||||
//don't check, if already exists!
|
//don't check, if already exists!
|
||||||
// void AddNewSegment(const STLBoundarySeg & seg) {boundary.Append(seg);};
|
// void AddNewSegment(const STLBoundarySeg & seg) {boundary.Append(seg);};
|
||||||
|
Loading…
Reference in New Issue
Block a user