Loading...
Searching...
No Matches
hashGrid.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_DATATYPE_HASHGRID_H
#define BALL_DATATYPE_HASHGRID_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_CONCEPT_FORWARDITERATOR_H
# include <BALL/CONCEPT/forwardIterator.h>
#endif
#ifndef BALL_CONCEPT_VISITOR_H
# include <BALL/CONCEPT/visitor.h>
#endif
#ifndef BALL_CONCEPT_PROCESSOR_H
# include <BALL/CONCEPT/processor.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#include <algorithm>
#include <forward_list>
namespace BALL
{
namespace __private
{
extern const signed char BALL_EXPORT neighbour_table_[27][3];
}
template <typename Item> class HashGrid3;
template <typename Item>
class HashGridBox3
{
public:
HashGridBox3(HashGrid3<Item>* parent);
void clear();
void destroy();
void setParent(HashGrid3<Item>* p);
void getIndices(Position& x, Position& y, Position& z);
Item* find(const Item &item);
const Item* find(const Item& item) const;
Size getSize() const;
void insert(const Item& item);
bool remove(const Item& item);
bool removeAll(const Item& item);
void host(Visitor<HashGridBox3> &visitor);
bool operator == (const HashGridBox3& box) const;
bool operator != (const HashGridBox3& box) const;
bool has(const Item& item) const;
bool isEmpty() const;
bool isValid() const;
void dump(std::ostream& s = std::cout, Size depth = 0) const;
bool apply(UnaryProcessor<Item>& processor);
bool apply(UnaryProcessor< HashGridBox3<Item> >& processor);
typedef Position BoxIteratorPosition;
class BoxIteratorTraits
{
public:
BALL_CREATE_DEEP(BoxIteratorTraits)
virtual ~BoxIteratorTraits() {}
BoxIteratorTraits()
: bound_(nullptr),
cur_box_(nullptr),
position_(0),
x_(0),
y_(0),
z_(0)
{
}
BoxIteratorTraits(const HashGridBox3& box)
: bound_((HashGridBox3 *)&box),
cur_box_(bound_),
position_(0),
x_(0),
y_(0),
z_(0)
{
bound_->getIndices(x_, y_, z_);
}
BoxIteratorTraits(const BoxIteratorTraits& traits, bool /* deep */ = true)
: bound_(traits.bound_),
cur_box_(traits.cur_box_),
position_(traits.position_),
x_(traits.x_),
y_(traits.y_),
z_(traits.z_)
{
}
HashGridBox3* getContainer()
{
return bound_;
}
const HashGridBox3* getContainer() const
{
return bound_;
}
bool isSingular() const
{
return !bound_;
}
BoxIteratorPosition& getPosition()
{
return position_;
}
const BoxIteratorPosition& getPosition() const
{
return position_;
}
bool operator == (const BoxIteratorTraits& traits) const
{
return (position_ == traits.position_);
}
bool operator != (const BoxIteratorTraits& traits) const
{
return (position_ != traits.position_);
}
bool isValid() const
{
return (bound_ && position_ < 27);
}
void invalidate()
{
bound_ = nullptr;
position_ = 100;
}
void toBegin()
{
position_ = 0;
cur_box_ = bound_;
}
bool isBegin() const
{
return (position_ == 0);
}
void toEnd()
{
position_ = 27;
cur_box_ = 0;
}
bool isEnd() const
{
return (position_ == 27);
}
HashGridBox3<Item>& getData()
{
return *cur_box_;
}
const HashGridBox3<Item>& getData() const
{
return *cur_box_;
}
void forward()
{
++position_;
// iterate to the next existing box
while ( position_ < 27
&& !(cur_box_ = bound_->parent->getBox(x_ + __private::neighbour_table_[position_][0],
y_ + __private::neighbour_table_[position_][1],
z_ + __private::neighbour_table_[position_][2])))
{
++position_;
}
}
private:
HashGridBox3<Item> *bound_;
HashGridBox3<Item> *cur_box_;
BoxIteratorPosition position_;
Position x_, y_, z_;
};
friend class BoxIteratorTraits;
typedef ForwardIterator
<HashGridBox3<Item>, HashGridBox3<Item>,
BoxIteratorPosition, BoxIteratorTraits>
BoxIterator;
BoxIterator beginBox()
{
return BoxIterator::begin(*this);
}
BoxIterator endBox()
{
return BoxIterator::end(*this);
}
typedef ConstForwardIterator
<HashGridBox3<Item>, HashGridBox3<Item>,
BoxIteratorPosition, BoxIteratorTraits>
ConstBoxIterator;
ConstBoxIterator beginBox() const
{
return ConstBoxIterator::begin(*this);
}
ConstBoxIterator endBox() const
{
return ConstBoxIterator::end(*this);
}
typedef typename std::forward_list<Item> DataContainer;
typedef typename DataContainer::iterator DataIteratorPosition;
class DataIteratorTraits
{
public:
BALL_CREATE_DEEP(DataIteratorTraits)
virtual ~DataIteratorTraits() {}
DataIteratorTraits()
: bound_(nullptr),
position_()
{
}
DataIteratorTraits(const HashGridBox3& box)
: bound_((HashGridBox3 *)&box),
position_(bound_->data.begin())
{
}
DataIteratorTraits(const DataIteratorTraits& traits, bool /* deep */ = true)
: bound_(traits.bound_),
position_(traits.position_)
{
}
const DataIteratorTraits& operator = (const DataIteratorTraits &traits)
{
bound_ = traits.bound_;
position_ = traits.position_;
return *this;
}
HashGridBox3* getContainer()
{
return bound_;
}
const HashGridBox3* getContainer() const
{
return bound_;
}
bool isSingular() const
{
return !bound_;
}
DataIteratorPosition& getPosition()
{
return position_;
}
const DataIteratorPosition& getPosition() const
{
return position_;
}
bool operator == (const DataIteratorTraits &traits) const
{
return (position_ == traits.position_);
}
bool operator != (const DataIteratorTraits &traits) const
{
return (position_ != traits.position_);
}
bool isValid() const
{
return (bound_ && position_ != bound_->data.end());
}
void invalidate()
{
bound_ = nullptr;
position_ = bound_->data.end();
}
void toBegin()
{
position_ = bound_->data.begin();
}
bool isBegin() const
{
return (position_ == bound_->data.begin());
}
void toEnd()
{
position_ = bound_->data.end();
}
bool isEnd() const
{
return (position_ == bound_->data.end());
}
Item& getData()
{
return *position_;
}
const Item& getData() const
{
return *position_;
}
void forward()
{
++position_;
}
private:
HashGridBox3<Item>* bound_;
DataIteratorPosition position_;
};
friend class DataIteratorTraits;
typedef ForwardIterator
<HashGridBox3<Item>, Item,
DataIteratorPosition, DataIteratorTraits>
DataIterator;
DataIterator beginData()
{
return DataIterator::begin(*this);
}
DataIterator endData()
{
return DataIterator::end(*this);
}
typedef ConstForwardIterator
<HashGridBox3<Item>, Item,
DataIteratorPosition, DataIteratorTraits>
ConstDataIterator;
ConstDataIterator beginData() const
{
return ConstDataIterator::begin(*this);
}
ConstDataIterator endData() const
{
return ConstDataIterator::end(*this);
}
HashGrid3<Item>* parent;
DataContainer data;
};
template<typename Item>
HashGridBox3<Item>::HashGridBox3(HashGrid3<Item>* p)
: parent(p)
{
}
template<typename Item>
void HashGridBox3<Item>::clear()
{
data.clear();
}
template<typename Item>
BALL_INLINE
void HashGridBox3<Item>::destroy()
{
clear();
}
template<typename Item>
BALL_INLINE void HashGridBox3<Item>::setParent(HashGrid3<Item>* p)
{
parent = p;
}
template<typename Item>
BALL_INLINE
void HashGridBox3<Item>::getIndices(Position& x, Position& y, Position& z)
{
parent->getIndices(*this, x, y, z);
}
template<typename Item>
Item* HashGridBox3<Item>::find(const Item& item)
{
DataIteratorPosition found = std::find(data.begin(), data.end(), item);
if (found != data.end())
{
return &(*found);
}
return nullptr;
}
template<typename Item>
BALL_INLINE
const Item* HashGridBox3<Item>::find(const Item& item) const
{
return const_cast<HashGridBox3*>(this)->find(item);
}
template<typename Item>
Size HashGridBox3<Item>::getSize() const
{
return std::distance(data.begin(), data.end());
}
template<typename Item>
BALL_INLINE
void HashGridBox3<Item>::insert(const Item& item)
{
data.push_front(item);
}
template<typename Item>
bool HashGridBox3<Item>::remove(const Item& item)
{
DataIteratorPosition pos = std::adjacent_find(data.before_begin(), data.end(),
[&](const Item&, const Item& next){ return next == item; });
if (pos != data.end())
{
data.erase_after(pos);
return true;
}
return false;
}
template<typename Item>
bool HashGridBox3<Item>::removeAll(const Item& item)
{
data.remove(item);
return true;
}
template <typename Item>
BALL_INLINE
void HashGridBox3<Item>::host(Visitor< HashGridBox3<Item> >& visitor)
{
visitor.visit(*this);
}
template<typename Item>
bool HashGridBox3<Item>::operator == (const HashGridBox3<Item>& box) const
{
return (data == box.data);
}
template<typename Item>
BALL_INLINE
bool HashGridBox3<Item>::operator != (const HashGridBox3<Item>& box) const
{
return !(*this == box);
}
template<typename Item>
BALL_INLINE
bool HashGridBox3<Item>::has(const Item& item) const
{
return (std::find(data.begin(), data.end(), item) != data.end());
}
template<typename Item>
BALL_INLINE
bool HashGridBox3<Item>::isEmpty() const
{
return data.empty();
}
template<typename Item>
bool HashGridBox3<Item>::isValid() const
{
// this is no longer required...
return true;
}
template<typename Item>
void HashGridBox3<Item>::dump(std::ostream& s, Size depth) const
{
BALL_DUMP_STREAM_PREFIX(s);
BALL_DUMP_DEPTH(s, depth);
BALL_DUMP_DEPTH(s, depth);
s << " size: " << getSize() << std::endl;
BALL_DUMP_DEPTH(s, depth);
s << " data:" << std::endl;
for(const Item& e: data)
{
BALL_DUMP_DEPTH(s, depth);
s << " " << e << std::endl;
}
BALL_DUMP_STREAM_SUFFIX(s);
}
template <typename Item>
bool HashGridBox3<Item>::apply(UnaryProcessor<Item>& processor)
{
if (!processor.start())
{
return false;
}
Processor::Result result;
for(Item& e: data)
{
result = processor(e);
if (result <= Processor::BREAK)
{
return result == Processor::BREAK;
}
}
return processor.finish();
}
template <typename Item>
bool HashGridBox3<Item>::apply(UnaryProcessor< HashGridBox3<Item> >& processor)
{
if (!processor.start())
{
return false;
}
Processor::Result result;
for (BoxIterator it = beginBox(); +it; ++it)
{
result = processor(*it);
if (result <= Processor::BREAK)
{
return result == Processor::BREAK;
}
}
return processor.finish();
}
template <typename Item>
class HashGrid3
{
public:
BALL_CREATE(HashGrid3)
HashGrid3();
HashGrid3(const Vector3& origin, Size dimension_x, Size dimension_y,
Size dimension_z, float spacing_x, float spacing_y, float spacing_z);
HashGrid3(const Vector3& origin, Size dimension_x, Size dimension_y,
Size dimension_z, float spacing);
HashGrid3(const Vector3& origin, const Vector3& size, float spacing);
HashGrid3(const HashGrid3& grid, bool deep = true);
virtual ~HashGrid3();
virtual void clear();
void clear(Position x, Position y, Position z);
void clear(const Vector3 &vector);
void destroy();
void destroy(Position x, Position y, Position z);
void destroy(const Vector3& vector);
void set(const Vector3& origin, const Vector3& unit,
Size dimension_x, Size dimension_y, Size dimension_z);
void set(const Vector3& origin, float unit, Size size);
void set(const HashGrid3& grid, bool deep = true);
const HashGrid3& operator = (const HashGrid3& grid);
void get(Vector3& origin, Vector3& unit, Size& dimension_x, Size& dimension_y, Size& dimension_z) const;
void get(HashGrid3& grid, bool deep = true) const;
Size countNonEmptyBoxes() const;
Size getSize() const;
Vector3& getOrigin();
const Vector3& getOrigin() const;
Vector3& getUnit();
const Vector3& getUnit() const;
Size getSizeX() const;
Size getSizeY() const;
Size getSizeZ() const;
HashGridBox3<Item>* getBox(Position x, Position y, Position z);
const HashGridBox3<Item>* getBox(Position x, Position y, Position z) const;
HashGridBox3<Item>* getBox(const Vector3& vector);
const HashGridBox3<Item>* getBox(const Vector3 &vector) const;
bool getIndices(const HashGridBox3<Item>& box,
Position& x, Position& y, Position& z) const;
void insert(Position x, Position y, Position z, const Item& item);
void insert(const Vector3& vector, const Item& item);
bool remove(Position x, Position y, Position z, const Item& item);
bool remove(const Vector3& vector, const Item& item);
void host(Visitor<HashGrid3>& visitor);
bool operator == (const HashGrid3& grid) const;
bool operator != (const HashGrid3& grid) const;
bool isEmpty() const;
virtual bool isValid() const;
virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
bool apply(UnaryProcessor<Item> &processor);
bool apply(UnaryProcessor< HashGridBox3<Item> > &processor);
const Item* getClosestItem(const Vector3& point, Size distance) const;
static float calculateMinSpacing(LongIndex memory, const Vector3& size);
typedef Position BoxIteratorPosition;
class BoxIteratorTraits
{
public:
BALL_CREATE_DEEP(BoxIteratorTraits)
virtual ~BoxIteratorTraits() {}
BoxIteratorTraits()
: bound_(nullptr),
position_(0)
{
}
BoxIteratorTraits(const HashGrid3 &grid)
: bound_((HashGrid3 *)&grid),
position_(0)
{
}
BoxIteratorTraits(const BoxIteratorTraits& traits, bool /* deep */ = true)
: bound_(traits.bound_),
position_(traits.position_)
{
}
const BoxIteratorTraits& operator = (const BoxIteratorTraits& traits)
{
bound_ = traits.bound_;
position_ = traits.position_;
return *this;
}
HashGrid3* getContainer()
{
return bound_;
}
const HashGrid3* getContainer() const
{
return bound_;
}
bool isSingular() const
{
return !bound_;
}
BoxIteratorPosition& getPosition()
{
return position_;
}
const BoxIteratorPosition& getPosition() const
{
return position_;
}
bool operator == (const BoxIteratorTraits& traits) const
{
return (position_ == traits.position_);
}
bool operator != (const BoxIteratorTraits& traits) const
{
return (position_ != traits.position_);
}
bool isValid() const
{
return (bound_ && position_ < bound_->getSize());
}
void invalidate()
{
bound_ = nullptr;
position_ = bound_->getSize()+1;
}
void toBegin()
{
position_ = 0;
}
bool isBegin() const
{
return (position_ == 0);
}
void toEnd()
{
position_ = bound_->getSize();
}
bool isEnd() const
{
return (position_ == bound_->getSize());
}
HashGridBox3<Item>& getData()
{
return bound_->box_[position_];
}
const HashGridBox3<Item>& getData() const
{
return bound_->box_[position_];
}
void forward()
{
++position_;
}
private:
HashGrid3<Item>* bound_;
BoxIteratorPosition position_;
};
friend class BoxIteratorTraits;
typedef ForwardIterator
<HashGrid3<Item>, HashGridBox3<Item>,
BoxIteratorPosition, BoxIteratorTraits>
BoxIterator;
BoxIterator beginBox()
{
return BoxIterator::begin(*this);
}
BoxIterator endBox()
{
return BoxIterator::end(*this);
}
typedef ConstForwardIterator
<HashGrid3<Item>, HashGridBox3<Item>,
BoxIteratorPosition, BoxIteratorTraits>
ConstBoxIterator;
ConstBoxIterator beginBox() const
{
return ConstBoxIterator::begin(*this);
}
ConstBoxIterator endBox() const
{
return ConstBoxIterator::end(*this);
}
private:
//_
Index getIndex_(const HashGridBox3<Item>& box) const;
//_
Vector3 origin_;
//_
Vector3 unit_;
//_
Size dimension_x_;
//_
Size dimension_y_;
//_
Size dimension_z_;
//_
vector<HashGridBox3<Item> > box_;
};
template <typename Item>
HashGrid3<Item>::HashGrid3()
: origin_(0,0,0),
unit_(0,0,0),
dimension_x_(0),
dimension_y_(0),
dimension_z_(0)
{
}
template <typename Item>
HashGrid3<Item>::HashGrid3
(const Vector3 &originvector,
Size dimension_x, Size dimension_y, Size dimension_z,
float spacing_x, float spacing_y, float spacing_z)
: origin_(originvector),
unit_(spacing_x, spacing_y, spacing_z),
dimension_x_(dimension_x),
dimension_y_(dimension_y),
dimension_z_(dimension_z),
box_(dimension_x * dimension_y * dimension_z, HashGridBox3<Item>(this))
{
}
template <typename Item>
HashGrid3<Item>::HashGrid3
(const Vector3& origin,
Size dimension_x, Size dimension_y, Size dimension_z, float spacing)
: origin_(origin),
unit_(spacing, spacing, spacing),
dimension_x_(dimension_x),
dimension_y_(dimension_y),
dimension_z_(dimension_z),
box_(dimension_x * dimension_y * dimension_z, HashGridBox3<Item>(this))
{
}
// this constructor creates a linear array of HashGridBox3 objects.
template <typename Item>
HashGrid3<Item>::HashGrid3(const Vector3& origin, const Vector3& size,
float spacing)
: origin_(origin),
unit_(spacing, spacing, spacing),
dimension_x_((Size)(size.x / spacing + 1.0)),
dimension_y_((Size)(size.y / spacing + 1.0)),
dimension_z_((Size)(size.z / spacing + 1.0)),
box_(dimension_x_ * dimension_y_ * dimension_z_, HashGridBox3<Item>(this))
{
}
template <typename Item>
HashGrid3<Item>::HashGrid3(const HashGrid3<Item>& grid, bool deep)
{
set(grid, deep);
}
template <typename Item>
HashGrid3<Item>::~HashGrid3()
{
}
template <typename Item>
void HashGrid3<Item>::clear()
{
for(HashGridBox3<Item>& e: box_)
{
e.clear();
}
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::clear(Position x, Position y, Position z)
{
HashGridBox3<Item>* box = getBox(x, y, z);
if (box)
{
box->clear();
}
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::clear(const Vector3& vector)
{
HashGridBox3<Item>* box = getBox(vector);
if (box)
{
box->clear();
}
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::destroy()
{
clear();
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::destroy(Position x, Position y, Position z)
{
clear(x, y, z);
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::destroy(const Vector3 &vector)
{
clear(vector);
}
template <typename Item>
void HashGrid3<Item>::set
(const Vector3& origin, const Vector3& unit,
Size dimension_x, Size dimension_y, Size dimension_z)
{
origin_.set(origin);
unit_.set(unit);
dimension_x_ = dimension_x;
dimension_y_ = dimension_y;
dimension_z_ = dimension_z;
box_.assign(getSize(), HashGridBox3<Item>(this));
}
template <typename Item>
void HashGrid3<Item>::set(const Vector3& origin, float unit, Size size)
{
origin_.set(origin);
unit_.set(unit, unit, unit);
dimension_x_ = size;
dimension_y_ = size;
dimension_z_ = size;
box_.assign(getSize(), HashGridBox3<Item>(this));
}
template <typename Item>
void HashGrid3<Item>::set(const HashGrid3<Item>& grid, bool /* deep */)
{
origin_.set(grid.origin_);
unit_.set(grid.unit_);
dimension_x_ = grid.dimension_x_;
dimension_y_ = grid.dimension_y_;
dimension_z_ = grid.dimension_z_;
box_ = grid.box_;
for(HashGridBox3<Item>& e: box_)
{
e.setParent(this);
}
}
template <typename Item>
BALL_INLINE
const HashGrid3<Item>& HashGrid3<Item>::operator = (const HashGrid3<Item> &grid)
{
set(grid);
return *this;
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::get(Vector3 &origin, Vector3 &unit, Size& dimension_x, Size& dimension_y, Size& dimension_z) const
{
origin.set(origin_);
unit.set(unit_);
dimension_x = dimension_x_;
dimension_y = dimension_y_;
dimension_z = dimension_z_;
}
template <typename Item>
BALL_INLINE void
HashGrid3<Item>::get(HashGrid3<Item> &grid, bool deep) const
{
grid.set(*this, deep);
}
template <typename Item>
Size
HashGrid3<Item>::countNonEmptyBoxes() const
{
return std::count_if(box_.begin(), box_.end(),
std::not1(std::mem_fun_ref(&HashGridBox3<Item>::isEmpty))
);
}
template <typename Item>
BALL_INLINE
Size HashGrid3<Item>::getSize() const
{
return (dimension_x_ * dimension_y_ * dimension_z_);
}
template <typename Item>
BALL_INLINE
Vector3& HashGrid3<Item>::getOrigin()
{
return origin_;
}
template <typename Item>
BALL_INLINE
const Vector3& HashGrid3<Item>::getOrigin() const
{
return origin_;
}
template <typename Item>
BALL_INLINE
Vector3& HashGrid3<Item>::getUnit()
{
return unit_;
}
template <typename Item>
BALL_INLINE
const Vector3& HashGrid3<Item>::getUnit() const
{
return unit_;
}
template <typename Item>
BALL_INLINE
Size HashGrid3<Item>::getSizeX() const
{
return dimension_x_;
}
template <typename Item>
BALL_INLINE
Size HashGrid3<Item>::getSizeY() const
{
return dimension_y_;
}
template <typename Item>
BALL_INLINE
Size HashGrid3<Item>::getSizeZ() const
{
return dimension_z_;
}
template <typename Item>
const Item* HashGrid3<Item>::getClosestItem(const Vector3& point, Size dist) const
{
const HashGridBox3<Item>* box = getBox(point);
if (!box) return 0;
Position x, y, z;
getIndices(*box, x, y, z);
const Item* item = 0;
float distance = std::numeric_limits<float>::max();
// iterator over neighbour boxes
for (Index xi = -(Index)dist; xi <= (Index)dist; xi++)
{
const Index xn = x + xi;
for (Index yi = -(Index)dist; yi <= (Index)dist; yi++)
{
const Index yn = y + yi;
for (Index zi = -(Index)dist; zi <= (Index)dist; zi++)
{
// iterate over all data items
const HashGridBox3<Item>* const box_ptr = getBox(xn, yn, z+zi);
if (box_ptr != 0 && !box_ptr->isEmpty())
{
typename HashGridBox3<Item>::ConstDataIterator hit = box_ptr->beginData();
for (;hit != box_ptr->endData(); hit++)
{
const float new_dist = ((*hit)->getPosition() - point).getSquareLength();
if (new_dist < distance)
{
item = &*hit;
distance = new_dist;
}
}
}
}
}
}
return item;
}
template <typename Item>
BALL_INLINE
float HashGrid3<Item>::calculateMinSpacing(LongIndex memory, const Vector3& size)
{
LongSize memory_for_box = sizeof(HashGridBox3<Item>) + sizeof(HashGridBox3<Item>*);
LongSize nr_boxes =(LongSize)floor((float)(memory / memory_for_box));
return pow((double)((size.x * size.y * size.z) / nr_boxes), (double)(1.0 / 3.0));
}
template <typename Item>
BALL_INLINE
HashGridBox3<Item>* HashGrid3<Item>::getBox(Position x, Position y, Position z)
{
if (x >= (Position)dimension_x_ ||
y >= (Position)dimension_y_ ||
z >= (Position)dimension_z_)
{
return 0;
}
else
{
return &(box_[x * dimension_y_ * dimension_z_ + y * dimension_z_ + z]);
}
}
template <typename Item>
BALL_INLINE
const HashGridBox3<Item>* HashGrid3<Item>::getBox(Position x, Position y, Position z) const
{
return ((HashGrid3*)this)->getBox(x, y, z);
}
template <typename Item>
BALL_INLINE
HashGridBox3<Item>* HashGrid3<Item>::getBox(const Vector3& vector)
{
float x = (vector.x - origin_.x) / unit_.x;
float y = (vector.y - origin_.y) / unit_.y;
float z = (vector.z - origin_.z) / unit_.z;
// workaround for MSVC 7, dont change this !!!
Index x1 = (Index) Maths::floor(x);
Index y1 = (Index) Maths::floor(y);
Index z1 = (Index) Maths::floor(z);
return getBox(x1, y1, z1);
}
template <typename Item>
BALL_INLINE
const HashGridBox3<Item>* HashGrid3<Item>::getBox(const Vector3& vector) const
{
return ((HashGrid3 *)this)->getBox(vector);
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::getIndices
(const HashGridBox3<Item>& box,
Position& x, Position& y, Position& z) const
{
Index index = getIndex_(box);
if (index == INVALID_Index)
{
x = y = z = INVALID_Position;
return false;
}
x = index / (dimension_y_ * dimension_z_);
index -= x * dimension_y_ * dimension_z_;
y = index / dimension_z_;
z = index - y * dimension_z_;
return true;
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::insert
(Position x, Position y, Position z, const Item& item)
{
HashGridBox3<Item>* box = getBox(x, y, z);
if (box)
{
box->insert(item);
}
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::insert(const Vector3& vector, const Item& item)
{
HashGridBox3<Item> *box = getBox(vector);
if (box)
{
box->insert(item);
}
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::remove(Position x, Position y, Position z, const Item& item)
{
HashGridBox3<Item>* box = getBox(x, y, z);
return box ? box->remove(item) : false;
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::remove(const Vector3& vector, const Item& item)
{
HashGridBox3<Item>* box = getBox(vector);
return box ? box->remove(item) : false;
}
template <typename Item>
BALL_INLINE
void HashGrid3<Item>::host(Visitor< HashGrid3<Item> >& visitor)
{
visitor.visit(*this);
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::operator == (const HashGrid3<Item>& grid) const
{
if (getSize() != grid.getSize()
|| origin_ != grid.origin_
|| unit_ != grid.unit_
|| dimension_x_ != grid.dimension_x_
|| dimension_y_ != grid.dimension_y_
|| dimension_z_ != grid.dimension_z_)
{
return false;
}
return box_ == grid.box_;
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::operator != (const HashGrid3<Item>& grid) const
{
return !(*this == grid);
}
template <typename Item>
BALL_INLINE
bool HashGrid3<Item>::isEmpty() const
{
return (getSize() == 0);
}
template <typename Item>
bool HashGrid3<Item>::isValid() const
{
for(const HashGridBox3<Item>& e: box_)
{
if(!e.isValid()) return false;
}
return true;
}
template <typename Item>
void HashGrid3<Item>::dump(std::ostream& s, Size depth) const
{
BALL_DUMP_STREAM_PREFIX(s);
BALL_DUMP_DEPTH(s, depth);
BALL_DUMP_DEPTH(s, depth);
s << " origin: " << origin_ << std::endl;
BALL_DUMP_DEPTH(s, depth);
s << " unit: " << unit_.z << std::endl;
BALL_DUMP_DEPTH(s, depth);
s << " dimension: " << dimension_x_ << " "
<< dimension_y_ << " "
<< dimension_z_ << std::endl;
Size size = getSize();
BALL_DUMP_DEPTH(s, depth);
s << " size: " << size << std::endl;
BALL_DUMP_DEPTH(s, depth);
s << " non empty boxes: " << countNonEmptyBoxes() << std::endl;
BALL_DUMP_DEPTH(s, depth);
s << " boxes:" << std::endl;
Position x, y, z;
for (Position index = 0; index < (Position)size; ++index)
{
BALL_DUMP_DEPTH(s, depth);
getIndices(box_[index], x, y, z);
s << " " << index << ". box: ("
<< x << ',' << y << ',' << z << ')' << std::endl;
box_[index].dump(s, 1);
}
BALL_DUMP_DEPTH(s, depth);
s << " non-empty boxes:" << std::endl;
for (Position i=0; i<27; ++i)
{
if (!box_[i].isEmpty())
s << " " << getIndex_(box_[i]) << std::endl;
}
BALL_DUMP_STREAM_SUFFIX(s);
}
template <typename Item>
bool HashGrid3<Item>::apply(UnaryProcessor<Item>& processor)
{
if (!processor.start())
{
return false;
}
Processor::Result result;
for (Position i=0; i<27; ++i)
{
HashGridBox3<Item>* box = &box_[i];
for (typename HashGridBox3<Item>::DataIterator *item = box->beginData(); +item; ++item)
{
result = processor(*item);
if (result <= Processor::BREAK)
{
return result == Processor::BREAK;
}
}
}
return processor->finish();
}
template <typename Item>
bool HashGrid3<Item>::apply(UnaryProcessor< HashGridBox3<Item> >& processor)
{
if (!processor.start())
{
return false;
}
Processor::Result result;
for (Position i=0; i<27; ++i)
{
HashGridBox3<Item>* box = &box_[i];
result = processor(*box);
if (result <= Processor::BREAK)
{
return result == Processor::BREAK;
}
}
return processor->finish();
}
template <typename Item>
BALL_INLINE
Index HashGrid3<Item>::getIndex_(const HashGridBox3<Item>& box) const
{
if ((&box < &box_[0]) || (&box - &box_[0] >= getSize()))
{
return INVALID_Index;
}
else
{
return (Index)(&box - &box_[0]);
}
}
} // namespace BALL
#endif // BALL_DATATYPE_HASHGRID_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::ConstForwardIterator
Definition forwardIterator.h:26
BALL::ConstForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits >::begin
static ConstForwardIterator begin(const HashGridBox3< Item > &container)
BALL::ConstForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits >::end
static ConstForwardIterator end(const HashGridBox3< Item > &container)
BALL::ForwardIterator
Definition forwardIterator.h:199
BALL::ForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits >::begin
static ForwardIterator begin(const HashGridBox3< Item > &container)
BALL::ForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits >::end
static ForwardIterator end(const HashGridBox3< Item > &container)
BALL::HashGrid3::BoxIteratorTraits::isSingular
bool isSingular() const
Definition hashGrid.h:1023
BALL::HashGrid3::BoxIteratorTraits::toBegin
void toBegin()
Definition hashGrid.h:1059
BALL::HashGrid3::BoxIteratorTraits::getData
const HashGridBox3< Item > & getData() const
Definition hashGrid.h:1084
BALL::HashGrid3::BoxIteratorTraits::toEnd
void toEnd()
Definition hashGrid.h:1069
BALL::HashGrid3::BoxIteratorTraits::isEnd
bool isEnd() const
Definition hashGrid.h:1074
BALL::HashGrid3::BoxIteratorTraits::isValid
bool isValid() const
Definition hashGrid.h:1048
BALL::HashGrid3::BoxIteratorTraits::invalidate
void invalidate()
Definition hashGrid.h:1053
BALL::HashGrid3::BoxIteratorTraits::getData
HashGridBox3< Item > & getData()
Definition hashGrid.h:1079
BALL::HashGrid3::BoxIteratorTraits::forward
void forward()
Definition hashGrid.h:1089
BALL::HashGrid3::BoxIteratorTraits::getPosition
BoxIteratorPosition & getPosition()
Definition hashGrid.h:1028
BALL::HashGrid3::BoxIteratorTraits::isBegin
bool isBegin() const
Definition hashGrid.h:1064
BALL::HashGrid3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits(const BoxIteratorTraits &traits, bool=true)
Definition hashGrid.h:1000
BALL::HashGrid3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits()
Definition hashGrid.h:988
BALL::HashGrid3::BoxIteratorTraits::getPosition
const BoxIteratorPosition & getPosition() const
Definition hashGrid.h:1033
BALL::HashGrid3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits(const HashGrid3 &grid)
Definition hashGrid.h:994
BALL::HashGrid3::BoxIteratorTraits::getContainer
HashGrid3 * getContainer()
Definition hashGrid.h:1013
BALL::HashGrid3::BoxIteratorTraits::getContainer
const HashGrid3 * getContainer() const
Definition hashGrid.h:1018
BALL::HashGrid3
Three-dimensional Hash Grid Class.
Definition hashGrid.h:755
BALL::HashGrid3< const Atom * >::destroy
void destroy()
BALL::HashGrid3< const Atom * >::isEmpty
bool isEmpty() const
BALL::HashGrid3< const Atom * >::set
void set(const Vector3 &origin, const Vector3 &unit, Size dimension_x, Size dimension_y, Size dimension_z)
BALL::HashGrid3::operator==
bool operator==(const HashGrid3 &grid) const
Equality operator.
Definition hashGrid.h:1585
BALL::HashGrid3< const Atom * >::getIndices
bool getIndices(const HashGridBox3< const Atom * > &box, Position &x, Position &y, Position &z) const
BALL::HashGrid3< const Atom * >::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::HashGrid3< const Atom * >::calculateMinSpacing
static float calculateMinSpacing(LongIndex memory, const Vector3 &size)
BALL::HashGrid3< const Atom * >::getUnit
Vector3 & getUnit()
BALL::HashGrid3< const Atom * >::getOrigin
Vector3 & getOrigin()
BALL::HashGrid3::BoxIterator
ForwardIterator< HashGrid3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits > BoxIterator
Definition hashGrid.h:1106
BALL::HashGrid3< const Atom * >::remove
bool remove(Position x, Position y, Position z, const const Atom *&item)
BALL::HashGrid3< const Atom * >::isValid
virtual bool isValid() const
BALL::HashGrid3::operator!=
bool operator!=(const HashGrid3 &grid) const
Inequality operator.
Definition hashGrid.h:1602
BALL::HashGrid3::beginBox
BoxIterator beginBox()
Definition hashGrid.h:1109
BALL::HashGrid3< const Atom * >::clear
virtual void clear()
BALL::HashGrid3< const Atom * >::insert
void insert(Position x, Position y, Position z, const const Atom *&item)
BALL::HashGrid3::~HashGrid3
virtual ~HashGrid3()
Destructor.
Definition hashGrid.h:1221
BALL::HashGrid3< const Atom * >::countNonEmptyBoxes
Size countNonEmptyBoxes() const
BALL::HashGrid3< const Atom * >::apply
bool apply(UnaryProcessor< const Atom * > &processor)
BALL::HashGrid3::ConstBoxIterator
ConstForwardIterator< HashGrid3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits > ConstBoxIterator
Definition hashGrid.h:1125
BALL::HashGrid3::BoxIteratorTraits
friend class BoxIteratorTraits
Definition hashGrid.h:1100
BALL::HashGrid3::operator=
const HashGrid3 & operator=(const HashGrid3 &grid)
Assignment operator.
Definition hashGrid.h:1321
BALL::HashGrid3< const Atom * >::getBox
HashGridBox3< const Atom * > * getBox(Position x, Position y, Position z)
BALL::HashGrid3::endBox
BoxIterator endBox()
Definition hashGrid.h:1115
BALL::HashGrid3< const Atom * >::get
void get(Vector3 &origin, Vector3 &unit, Size &dimension_x, Size &dimension_y, Size &dimension_z) const
BALL::HashGrid3< const Atom * >::getSizeY
Size getSizeY() const
BALL::HashGrid3< const Atom * >::getSizeZ
Size getSizeZ() const
BALL::HashGrid3::endBox
ConstBoxIterator endBox() const
Definition hashGrid.h:1134
BALL::HashGrid3::BoxIteratorPosition
Position BoxIteratorPosition
Definition hashGrid.h:978
BALL::HashGrid3< const Atom * >::getSize
Size getSize() const
BALL::HashGrid3::beginBox
ConstBoxIterator beginBox() const
Definition hashGrid.h:1128
BALL::HashGrid3< const Atom * >::getClosestItem
const const Atom ** getClosestItem(const Vector3 &point, Size distance) const
BALL::HashGrid3< const Atom * >::host
void host(Visitor< HashGrid3 > &visitor)
BALL::HashGrid3::HashGrid3
HashGrid3()
Default constructor.
Definition hashGrid.h:1165
BALL::HashGrid3< const Atom * >::getSizeX
Size getSizeX() const
BALL::HashGridBox3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits(const HashGridBox3 &box)
Definition hashGrid.h:198
BALL::HashGridBox3::BoxIteratorTraits::operator!=
bool operator!=(const BoxIteratorTraits &traits) const
Definition hashGrid.h:249
BALL::HashGridBox3::BoxIteratorTraits::getContainer
const HashGridBox3 * getContainer() const
Definition hashGrid.h:224
BALL::HashGridBox3::BoxIteratorTraits::isSingular
bool isSingular() const
Definition hashGrid.h:229
BALL::HashGridBox3::BoxIteratorTraits::toBegin
void toBegin()
Definition hashGrid.h:265
BALL::HashGridBox3::BoxIteratorTraits::forward
void forward()
Definition hashGrid.h:297
BALL::HashGridBox3::BoxIteratorTraits::isEnd
bool isEnd() const
Definition hashGrid.h:282
BALL::HashGridBox3::BoxIteratorTraits::toEnd
void toEnd()
Definition hashGrid.h:276
BALL::HashGridBox3::BoxIteratorTraits::getData
const HashGridBox3< Item > & getData() const
Definition hashGrid.h:292
BALL::HashGridBox3::BoxIteratorTraits::operator==
bool operator==(const BoxIteratorTraits &traits) const
Definition hashGrid.h:244
BALL::HashGridBox3::BoxIteratorTraits::isBegin
bool isBegin() const
Definition hashGrid.h:271
BALL::HashGridBox3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits()
Definition hashGrid.h:188
BALL::HashGridBox3::BoxIteratorTraits::getPosition
BoxIteratorPosition & getPosition()
Definition hashGrid.h:234
BALL::HashGridBox3::BoxIteratorTraits::getData
HashGridBox3< Item > & getData()
Definition hashGrid.h:287
BALL::HashGridBox3::BoxIteratorTraits::isValid
bool isValid() const
Definition hashGrid.h:254
BALL::HashGridBox3::BoxIteratorTraits::getPosition
const BoxIteratorPosition & getPosition() const
Definition hashGrid.h:239
BALL::HashGridBox3::BoxIteratorTraits::invalidate
void invalidate()
Definition hashGrid.h:259
BALL::HashGridBox3::BoxIteratorTraits::BoxIteratorTraits
BoxIteratorTraits(const BoxIteratorTraits &traits, bool=true)
Definition hashGrid.h:209
BALL::HashGridBox3::BoxIteratorTraits::getContainer
HashGridBox3 * getContainer()
Definition hashGrid.h:219
BALL::HashGridBox3::DataIteratorTraits::operator!=
bool operator!=(const DataIteratorTraits &traits) const
Definition hashGrid.h:427
BALL::HashGridBox3::DataIteratorTraits::isValid
bool isValid() const
Definition hashGrid.h:432
BALL::HashGridBox3::DataIteratorTraits::getPosition
DataIteratorPosition & getPosition()
Definition hashGrid.h:412
BALL::HashGridBox3::DataIteratorTraits::DataIteratorTraits
DataIteratorTraits(const DataIteratorTraits &traits, bool=true)
Definition hashGrid.h:384
BALL::HashGridBox3::DataIteratorTraits::DataIteratorTraits
DataIteratorTraits(const HashGridBox3 &box)
Definition hashGrid.h:378
BALL::HashGridBox3::DataIteratorTraits::operator=
const DataIteratorTraits & operator=(const DataIteratorTraits &traits)
Definition hashGrid.h:390
BALL::HashGridBox3::DataIteratorTraits::getPosition
const DataIteratorPosition & getPosition() const
Definition hashGrid.h:417
BALL::HashGridBox3::DataIteratorTraits::isEnd
bool isEnd() const
Definition hashGrid.h:458
BALL::HashGridBox3::DataIteratorTraits::isSingular
bool isSingular() const
Definition hashGrid.h:407
BALL::HashGridBox3::DataIteratorTraits::getContainer
const HashGridBox3 * getContainer() const
Definition hashGrid.h:402
BALL::HashGridBox3::DataIteratorTraits::invalidate
void invalidate()
Definition hashGrid.h:437
BALL::HashGridBox3::DataIteratorTraits::toBegin
void toBegin()
Definition hashGrid.h:443
BALL::HashGridBox3::DataIteratorTraits::DataIteratorTraits
DataIteratorTraits()
Definition hashGrid.h:372
BALL::HashGridBox3::DataIteratorTraits::getData
Item & getData()
Definition hashGrid.h:463
BALL::HashGridBox3::DataIteratorTraits::operator==
bool operator==(const DataIteratorTraits &traits) const
Definition hashGrid.h:422
BALL::HashGridBox3::DataIteratorTraits::forward
void forward()
Definition hashGrid.h:473
BALL::HashGridBox3::DataIteratorTraits::getData
const Item & getData() const
Definition hashGrid.h:468
BALL::HashGridBox3::DataIteratorTraits::getContainer
HashGridBox3 * getContainer()
Definition hashGrid.h:397
BALL::HashGridBox3::DataIteratorTraits::isBegin
bool isBegin() const
Definition hashGrid.h:448
BALL::HashGridBox3::DataIteratorTraits::toEnd
void toEnd()
Definition hashGrid.h:453
BALL::HashGridBox3
Definition hashGrid.h:55
BALL::HashGridBox3::endData
ConstDataIterator endData() const
Definition hashGrid.h:522
BALL::HashGridBox3::removeAll
bool removeAll(const Item &item)
Definition hashGrid.h:615
BALL::HashGridBox3::apply
bool apply(UnaryProcessor< Item > &processor)
Definition hashGrid.h:685
BALL::HashGridBox3::ConstBoxIterator
ConstForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits > ConstBoxIterator
This is the const version of BoxIterator .
Definition hashGrid.h:346
BALL::HashGridBox3::DataIterator
ForwardIterator< HashGridBox3< Item >, Item, DataIteratorPosition, DataIteratorTraits > DataIterator
Definition hashGrid.h:492
BALL::HashGridBox3::remove
bool remove(const Item &item)
Definition hashGrid.h:600
BALL::HashGridBox3::find
const Item * find(const Item &item) const
The const version of find().
Definition hashGrid.h:581
BALL::HashGridBox3::DataIteratorTraits
friend class DataIteratorTraits
Definition hashGrid.h:484
BALL::HashGridBox3::endBox
ConstBoxIterator endBox() const
get the last box
Definition hashGrid.h:355
BALL::HashGridBox3::dump
void dump(std::ostream &s=std::cout, Size depth=0) const
Definition hashGrid.h:664
BALL::HashGridBox3::ConstDataIterator
ConstForwardIterator< HashGridBox3< Item >, Item, DataIteratorPosition, DataIteratorTraits > ConstDataIterator
Definition hashGrid.h:513
BALL::HashGridBox3::beginData
DataIterator beginData()
Definition hashGrid.h:495
BALL::HashGridBox3::host
void host(Visitor< HashGridBox3 > &visitor)
Host method.
Definition hashGrid.h:624
BALL::HashGridBox3::isValid
bool isValid() const
Definition hashGrid.h:657
BALL::HashGridBox3::data
DataContainer data
Definition hashGrid.h:531
BALL::HashGridBox3::endData
DataIterator endData()
Definition hashGrid.h:501
BALL::HashGridBox3::destroy
void destroy()
Definition hashGrid.h:548
BALL::HashGridBox3::beginBox
ConstBoxIterator beginBox() const
get the first box
Definition hashGrid.h:349
BALL::HashGridBox3::HashGridBox3
HashGridBox3(HashGrid3< Item > *parent)
Default constructor.
Definition hashGrid.h:535
BALL::HashGridBox3::getIndices
void getIndices(Position &x, Position &y, Position &z)
Definition hashGrid.h:561
BALL::HashGridBox3::has
bool has(const Item &item) const
Definition hashGrid.h:644
BALL::HashGridBox3::BoxIteratorPosition
Position BoxIteratorPosition
Definition hashGrid.h:178
BALL::HashGridBox3::isEmpty
bool isEmpty() const
Definition hashGrid.h:651
BALL::HashGridBox3::BoxIteratorTraits
friend class BoxIteratorTraits
Definition hashGrid.h:318
BALL::HashGridBox3::BoxIterator
ForwardIterator< HashGridBox3< Item >, HashGridBox3< Item >, BoxIteratorPosition, BoxIteratorTraits > BoxIterator
Definition hashGrid.h:327
BALL::HashGridBox3::find
Item * find(const Item &item)
Definition hashGrid.h:567
BALL::HashGridBox3::DataIteratorPosition
DataContainer::iterator DataIteratorPosition
Definition hashGrid.h:362
BALL::HashGridBox3::apply
bool apply(UnaryProcessor< HashGridBox3< Item > > &processor)
Definition hashGrid.h:708
BALL::HashGridBox3::endBox
BoxIterator endBox()
get the last box
Definition hashGrid.h:336
BALL::HashGridBox3::setParent
void setParent(HashGrid3< Item > *p)
Definition hashGrid.h:554
BALL::HashGridBox3::DataContainer
std::forward_list< Item > DataContainer
Definition hashGrid.h:360
BALL::HashGridBox3::clear
void clear()
Clears the grid box.
Definition hashGrid.h:541
BALL::HashGridBox3::operator==
bool operator==(const HashGridBox3 &box) const
Equality operator.
Definition hashGrid.h:630
BALL::HashGridBox3< const Atom * >::parent
HashGrid3< const Atom * > * parent
Definition hashGrid.h:529
BALL::HashGridBox3::beginBox
BoxIterator beginBox()
get the first box
Definition hashGrid.h:330
BALL::HashGridBox3::operator!=
bool operator!=(const HashGridBox3 &box) const
Inequality operator.
Definition hashGrid.h:637
BALL::HashGridBox3::getSize
Size getSize() const
Definition hashGrid.h:587
BALL::HashGridBox3::beginData
ConstDataIterator beginData() const
Definition hashGrid.h:516
BALL::HashGridBox3::insert
void insert(const Item &item)
Definition hashGrid.h:594
BALL::Processor::BREAK
@ BREAK
Definition processor.h:47
BALL::Processor::Result
int Result
Definition processor.h:36
BALL::TVector3::x
T x
Definition vector3.h:489
BALL::TVector3::y
T y
Definition vector3.h:493
BALL::TVector3::set
void set(const T *ptr)
Definition vector3.h:615
BALL::TVector3::z
T z
Definition vector3.h:497
BALL::UnaryProcessor
Definition processor.h:60
BALL::UnaryProcessor::start
virtual bool start()
Definition processor.h:92
BALL::UnaryProcessor::finish
virtual bool finish()
Definition processor.h:99
BALL::Visitor
Definition visitor.h:23
common.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL_INLINE
#define BALL_INLINE
Definition debug.h:15
forwardIterator.h
BALL_CREATE_DEEP
#define BALL_CREATE_DEEP(name)
Definition create.h:26
BALL_DUMP_STREAM_PREFIX
#define BALL_DUMP_STREAM_PREFIX(os)
Definition macros.h:391
BALL_DUMP_STREAM_SUFFIX
#define BALL_DUMP_STREAM_SUFFIX(os)
Definition macros.h:395
BALL_DUMP_DEPTH
#define BALL_DUMP_DEPTH(os, depth)
Definition macros.h:390
BALL::Maths::floor
long floor(const T &t)
Definition MATHS/common.h:284
BALL::__private
Definition hashGrid.h:34
BALL::__private::neighbour_table_
const signed char BALL_EXPORT neighbour_table_[27][3]
BALL
Definition constants.h:13
BALL::INVALID_Position
static const Position INVALID_Position
Definition COMMON/global.h:243
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::LongSize
BALL_ULONG64_TYPE LongSize
Definition COMMON/global.h:192
BALL::INVALID_Index
static const Index INVALID_Index
Definition COMMON/global.h:239
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
BALL::LongIndex
BALL_LONG64_TYPE LongIndex
Definition COMMON/global.h:201
BALL::Index
BALL_INDEX_TYPE Index
Definition COMMON/global.h:105
std
STL namespace.
processor.h
vector3.h
visitor.h