Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SparseGrid< CellData > Class Template Reference

#include <KNN_Grid.h>

Inheritance diagram for SparseGrid< CellData >:
Collaboration diagram for SparseGrid< CellData >:

Public Types

typedef Map::iterator iterator
 
typedef Map::const_iterator const_iterator
 
typedef Map::iterator iterator
 
typedef Map::const_iterator const_iterator
 
- Public Types inherited from UniformGrid
typedef unsigned int index_t
 
typedef float coord_t
 
typedef NVec< 3, index_tIndex
 
typedef NVec< 3, coord_tVec
 
typedef unsigned int index_t
 
typedef float coord_t
 
typedef NVec< 3, index_tIndex
 
typedef NVec< 3, coord_tVec
 

Public Member Functions

 SparseGrid (int w, int h, int d)
 
 ~SparseGrid ()
 
iterator begin ()
 
iterator end ()
 
CellData * iterator_data (iterator i)
 
int usage_count () const
 
CellData * locate_index_only (const UniformGrid::Index &i)
 
CellData * locate_packed_index_only (unsigned int i)
 
CellData * locate_only (const Point3D &v)
 
CellData * locate (const Point3D &v)
 
CellData * locate_index (const UniformGrid::Index &i)
 
CellData * locate_packed_index (const unsigned int i)
 
 SparseGrid (int w, int h, int d)
 
 ~SparseGrid ()
 
iterator begin ()
 
iterator end ()
 
CellData * iterator_data (iterator i)
 
int usage_count () const
 
CellData * locate_index_only (const UniformGrid::Index &i)
 
CellData * locate_packed_index_only (unsigned int i)
 
CellData * locate_only (const Point3D &v)
 
CellData * locate (const Point3D &v)
 
CellData * locate_index (const UniformGrid::Index &i)
 
CellData * locate_packed_index (const unsigned int i)
 
- Public Member Functions inherited from UniformGrid
 UniformGrid (index_t w, index_t h, index_t d)
 
void set_extent (const Point3D &m, const Point3D &M)
 
void get_cellsize (Point3D &c)
 
UniformGrid::Index compute_index (const Point3D &v)
 
 UniformGrid (index_t w, index_t h, index_t d)
 
void set_extent (const Point3D &m, const Point3D &M)
 
void get_cellsize (Point3D &c)
 
UniformGrid::Index compute_index (const Point3D &v)
 

Protected Types

typedef map< unsigned int,
CellData * > 
Map
 
typedef map< unsigned int,
CellData * > 
Map
 

Protected Member Functions

unsigned int pack_index (const UniformGrid::Index &i)
 
unsigned int pack_index (const UniformGrid::Index &i)
 

Protected Attributes

Map cellmap
 

Additional Inherited Members

- Public Attributes inherited from UniformGrid
Index size
 
Point3D bb_min
 
Point3D bb_max
 
Point3D cellsize
 

Detailed Description

template<class CellData>
class SparseGrid< CellData >

Definition at line 72 of file Rocon/include/KNN_Grid.h.

Member Typedef Documentation

typedef Map::const_iterator const_iterator

Definition at line 102 of file Rocon/include/KNN_Grid.h.

typedef Map::const_iterator const_iterator

Definition at line 102 of file Rocprop/include/KNN_Grid.h.

typedef Map::iterator iterator

Definition at line 101 of file Rocprop/include/KNN_Grid.h.

typedef Map::iterator iterator

Definition at line 101 of file Rocon/include/KNN_Grid.h.

typedef map<unsigned int, CellData *> Map
protected

Definition at line 75 of file Rocprop/include/KNN_Grid.h.

typedef map<unsigned int, CellData *> Map
protected

Definition at line 75 of file Rocon/include/KNN_Grid.h.

Constructor & Destructor Documentation

SparseGrid ( int  w,
int  h,
int  d 
)
inline

Definition at line 90 of file Rocon/include/KNN_Grid.h.

90 : UniformGrid(w,h,d) { }
const NT & d
UniformGrid(index_t w, index_t h, index_t d)
~SparseGrid ( )
inline

Definition at line 91 of file Rocon/include/KNN_Grid.h.

92  {
93  // Delete all the entries that were allocated by locate()
94  for(typename Map::iterator i=cellmap.begin(); i!=cellmap.end(); ++i)
95  delete i->second;
96  }
blockLoc i
Definition: read.cpp:79
SparseGrid ( int  w,
int  h,
int  d 
)
inline

Definition at line 90 of file Rocprop/include/KNN_Grid.h.

90 : UniformGrid(w,h,d) { }
const NT & d
UniformGrid(index_t w, index_t h, index_t d)
~SparseGrid ( )
inline

Definition at line 91 of file Rocprop/include/KNN_Grid.h.

92  {
93  // Delete all the entries that were allocated by locate()
94  for(typename Map::iterator i=cellmap.begin(); i!=cellmap.end(); ++i)
95  delete i->second;
96  }
blockLoc i
Definition: read.cpp:79

Member Function Documentation

iterator begin ( )
inline

Definition at line 104 of file Rocon/include/KNN_Grid.h.

104 { return cellmap.begin(); }
iterator begin ( )
inline

Definition at line 104 of file Rocprop/include/KNN_Grid.h.

104 { return cellmap.begin(); }
iterator end ( )
inline

Definition at line 105 of file Rocon/include/KNN_Grid.h.

105 { return cellmap.end(); }
iterator end ( )
inline

Definition at line 105 of file Rocprop/include/KNN_Grid.h.

105 { return cellmap.end(); }
CellData* iterator_data ( iterator  i)
inline

Definition at line 106 of file Rocon/include/KNN_Grid.h.

106 { return i->second; }
blockLoc i
Definition: read.cpp:79
CellData* iterator_data ( iterator  i)
inline

Definition at line 106 of file Rocprop/include/KNN_Grid.h.

106 { return i->second; }
blockLoc i
Definition: read.cpp:79
CellData* locate ( const Point3D v)
inline

Definition at line 130 of file Rocon/include/KNN_Grid.h.

131  {
133  CellData *d = locate_index(i);//locate_index_only(i);
134  if( !d )
135  {
136  cellmap[pack_index(i)] = d = new CellData;
137  }
138  return d;
139  }
const NT & d
CellData * locate_index(const UniformGrid::Index &i)
UniformGrid::Index compute_index(const Point3D &v)
blockLoc i
Definition: read.cpp:79
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate ( const Point3D v)
inline

Definition at line 130 of file Rocprop/include/KNN_Grid.h.

131  {
133  CellData *d = locate_index(i);//locate_index_only(i);
134  if( !d )
135  {
136  cellmap[pack_index(i)] = d = new CellData;
137  }
138  return d;
139  }
const NT & d
CellData * locate_index(const UniformGrid::Index &i)
UniformGrid::Index compute_index(const Point3D &v)
blockLoc i
Definition: read.cpp:79
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate_index ( const UniformGrid::Index i)
inline

Definition at line 141 of file Rocon/include/KNN_Grid.h.

142  {
143  CellData *d = locate_index_only(i);
144  if( !d )
145  {
146  cellmap[pack_index(i)] = d = new CellData;
147  }
148  return d;
149  }
const NT & d
CellData * locate_index_only(const UniformGrid::Index &i)
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate_index ( const UniformGrid::Index i)
inline

Definition at line 141 of file Rocprop/include/KNN_Grid.h.

142  {
143  CellData *d = locate_index_only(i);
144  if( !d )
145  {
146  cellmap[pack_index(i)] = d = new CellData;
147  }
148  return d;
149  }
const NT & d
CellData * locate_index_only(const UniformGrid::Index &i)
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate_index_only ( const UniformGrid::Index i)
inline

Definition at line 115 of file Rocprop/include/KNN_Grid.h.

116  {
117  iterator iter = cellmap.find(pack_index(i));
118  return iter==cellmap.end() ? NULL : iter->second;
119  }
Map::iterator iterator
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate_index_only ( const UniformGrid::Index i)
inline

Definition at line 115 of file Rocon/include/KNN_Grid.h.

116  {
117  iterator iter = cellmap.find(pack_index(i));
118  return iter==cellmap.end() ? NULL : iter->second;
119  }
Map::iterator iterator
unsigned int pack_index(const UniformGrid::Index &i)
CellData* locate_only ( const Point3D v)
inline

Definition at line 127 of file Rocprop/include/KNN_Grid.h.

128  { return locate_index_only(compute_index(v)); }
CellData * locate_index_only(const UniformGrid::Index &i)
UniformGrid::Index compute_index(const Point3D &v)
CellData* locate_only ( const Point3D v)
inline

Definition at line 127 of file Rocon/include/KNN_Grid.h.

128  { return locate_index_only(compute_index(v)); }
CellData * locate_index_only(const UniformGrid::Index &i)
UniformGrid::Index compute_index(const Point3D &v)
CellData* locate_packed_index ( const unsigned int  i)
inline

Definition at line 151 of file Rocon/include/KNN_Grid.h.

152  {
153  CellData *d = locate_packed_index_only(i);
154  if( !d )
155  {
156  cellmap[i] = d = new CellData;
157  }
158  return d;
159  }
CellData * locate_packed_index_only(unsigned int i)
const NT & d
blockLoc i
Definition: read.cpp:79
CellData* locate_packed_index ( const unsigned int  i)
inline

Definition at line 151 of file Rocprop/include/KNN_Grid.h.

152  {
153  CellData *d = locate_packed_index_only(i);
154  if( !d )
155  {
156  cellmap[i] = d = new CellData;
157  }
158  return d;
159  }
CellData * locate_packed_index_only(unsigned int i)
const NT & d
blockLoc i
Definition: read.cpp:79
CellData* locate_packed_index_only ( unsigned int  i)
inline

Definition at line 121 of file Rocon/include/KNN_Grid.h.

122  {
123  iterator iter = cellmap.find(i);
124  return iter==cellmap.end() ? NULL : iter->second;
125  }
Map::iterator iterator
blockLoc i
Definition: read.cpp:79
CellData* locate_packed_index_only ( unsigned int  i)
inline

Definition at line 121 of file Rocprop/include/KNN_Grid.h.

122  {
123  iterator iter = cellmap.find(i);
124  return iter==cellmap.end() ? NULL : iter->second;
125  }
Map::iterator iterator
blockLoc i
Definition: read.cpp:79
unsigned int pack_index ( const UniformGrid::Index i)
inlineprotected

Definition at line 82 of file Rocon/include/KNN_Grid.h.

83  { return (i[0]<<20) | (i[1]<<10) | i[2]; }
unsigned int pack_index ( const UniformGrid::Index i)
inlineprotected

Definition at line 82 of file Rocprop/include/KNN_Grid.h.

83  { return (i[0]<<20) | (i[1]<<10) | i[2]; }
int usage_count ( ) const
inline

Definition at line 108 of file Rocprop/include/KNN_Grid.h.

108 { return cellmap.size(); }
int usage_count ( ) const
inline

Definition at line 108 of file Rocon/include/KNN_Grid.h.

108 { return cellmap.size(); }

Member Data Documentation

Map cellmap
protected

Definition at line 87 of file Rocon/include/KNN_Grid.h.


The documentation for this class was generated from the following files: