GEL  2
GEL is a library for Geometry and Linear Algebra
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
Geometry::Cell< T, CELL_DIM, ChildT > Class Template Reference

Class template for a cell in a hierarchical grid. More...

#include <Cell.h>

List of all members.

Public Types

typedef T DataType

Public Member Functions

 Cell (const T &val)
void coalesce (const T &val)
void split ()
 Split cell - causes memory to be reserved for CELL_DIM^3 voxels.
bool is_coalesced () const
 Check if the cell is coalesced.
const T & operator[] (const CGLA::Vec3i &p) const
void store (const CGLA::Vec3i &p, const T &new_val)
const T * get () const
T * get ()
void untouch ()
void touch ()
bool is_touched () const

Static Public Member Functions

static int get_dim ()

Protected Member Functions

void store_priv (const CGLA::Vec3i &p, const T &new_val)

Detailed Description

template<class T, int CELL_DIM, class ChildT>
class Geometry::Cell< T, CELL_DIM, ChildT >

Class template for a cell in a hierarchical grid.

The template arguments are the type and the cell dimension. A Cell is much like an RGrid - except that a Cell may be coalesced into a single value and then split again when a new value is inserted. Also cells are constrained to be of size NxNxN where N=2^m for some m. This makes some things faster.

The reason for making CELL_DIM a template argument rather than a constructor argument is that we generally have many cells and do not wish that each cell contains its dimension.


Constructor & Destructor Documentation

template<class T, int CELL_DIM, class ChildT>
Geometry::Cell< T, CELL_DIM, ChildT >::Cell ( const T &  val) [inline]

Create empty grid cell. A Cell contains initially a single value. Reading (using operator[]) any voxel will yield this value.


Member Function Documentation

template<class T, int CELL_DIM, class ChildT>
void Geometry::Cell< T, CELL_DIM, ChildT >::coalesce ( const T &  val) [inline]

Clear cell. Removes Cell contents replacing it with a single specified value.

template<class T, int CELL_DIM, class ChildT>
const T* Geometry::Cell< T, CELL_DIM, ChildT >::get ( ) const [inline]

Const get a pointer to the first element in the linear array representation of the grid.

template<class T, int CELL_DIM, class ChildT>
T* Geometry::Cell< T, CELL_DIM, ChildT >::get ( ) [inline]

Non-const get a pointer to the first element in the linear array representation of the grid.

template<class T, int CELL_DIM, class ChildT>
static int Geometry::Cell< T, CELL_DIM, ChildT >::get_dim ( ) [inline, static]

Get dimensions of Cell. Returns only one value since x, y, and z dimensions are the same.

template<class T, int CELL_DIM, class ChildT>
const T& Geometry::Cell< T, CELL_DIM, ChildT >::operator[] ( const CGLA::Vec3i p) const [inline]

Read access to voxel grid. This function is passed a Vec3i and returns the corresponding voxel. If the cell is coalesced, the single value stored is returned.

template<class T, int CELL_DIM, class ChildT>
void Geometry::Cell< T, CELL_DIM, ChildT >::store_priv ( const CGLA::Vec3i p,
const T &  new_val 
) [inline, protected]

Store a value in the Cell. If the Cell is coalesced, it is first resized to contain CELL_DIMS cubed voxels, and then the voxel is inserted.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations