IMP logo
IMP Reference Guide  2.6.1
The Integrative Modeling Platform
IMP::algebra::SparseGridStorageD< D, VT, Base, Map > Class Template Reference

#include <IMP/algebra/grid_storages.h>

+ Inheritance diagram for IMP::algebra::SparseGridStorageD< D, VT, Base, Map >:

Detailed Description

template<int D, class VT, class Base, class Map = typename boost::unordered_map<GridIndexD<D>, VT>>
class IMP::algebra::SparseGridStorageD< D, VT, Base, Map >

Store a grid as a sparse set of voxels (only the voxels which have been added are actually stored). The get_has_index() functions allow one to tell if a voxel has been added.

Warning: SparseGridStorageD has not been stabilized and is likely to change without notice.

Base should be one of BoundedGridRangeD or UnboundedGridRangeD.

See Also
Grid3D

Definition at line 183 of file grid_storages.h.

Public Types

typedef VT Value
 

Public Member Functions

 SparseGridStorageD (const Ints &counts, const VT &default_value)
 
GridIndexD< D > add_voxel (const ExtendedGridIndexD< D > &i, const VT &gi)
 Add a voxel to the storage, this voxel will now have a GridIndex3D. More...
 
template<class Functor , class Grid >
Functor apply (const Grid &g, Functor f) const
 
bool get_has_index (const ExtendedGridIndexD< D > &i) const
 Return true if the voxel has been added. More...
 
GridIndexD< D > get_index (const ExtendedGridIndexD< D > &i) const
 requires get_has_index(i) is true. More...
 
unsigned int get_number_of_voxels () const
 
void remove_voxel (const GridIndexD< D > &gi)
 
void show (std::ostream &out=std::cout) const
 

Operator []

Operator[] isn't very useful at the moment as it can only be used with a cell which has already been set. This behavior/the existence of these functions is likely to change.

const VT at (GridIndexD< D >) const
 
VT & at (GridIndexD< D >)
 
const VT operator[] (GridIndexD< D >) const
 
VT & operator[] (GridIndexD< D >)
 

Iterators through set cells

Iterate through the voxels which have been set. The value type is a pair of GridIndex3D and VT.

typedef Data::const_iterator AllConstIterator
 
typedef
boost::transform_iterator
< GetIndex, AllConstIterator > 
AllIndexIterator
 
AllConstIterator all_begin () const
 
AllConstIterator all_end () const
 
AllIndexIterator all_indexes_begin () const
 
AllIndexIterator all_indexes_end () const
 

Index Iterators

Iterate through a range of actual indexes. The value type for the iterator is an GridIndex3D.

The range is defined by a pair of indexes. It includes all indexes in the axis aligned box defined by lb as the lower corner and the second as the ub. That is, if lb is \((l_x, l_y, l_z)\) and ub is \((u_x, u_y, u_z)\), then the range includes all indexes \((i_x, i_y, i_z)\) such that \(l_x \leq i_x \leq u_x\), \(l_y \leq i_y \leq u_y\) and \(l_z \leq i_z \leq u_z\).

IndexIterator indexes_begin (const ExtendedGridIndexD< D > &lb, const ExtendedGridIndexD< D > &ub) const
 
IndexIterator indexes_end (const ExtendedGridIndexD< D > &, const ExtendedGridIndexD< D > &) const
 
Vector< GridIndexD< D > > get_indexes (const ExtendedGridIndexD< D > &lb, const ExtendedGridIndexD< D > &ub) const
 

Member Function Documentation

template<int D, class VT, class Base, class Map = typename boost::unordered_map<GridIndexD<D>, VT>>
GridIndexD<D> IMP::algebra::SparseGridStorageD< D, VT, Base, Map >::add_voxel ( const ExtendedGridIndexD< D > &  i,
const VT &  gi 
)

Add a voxel to the storage, this voxel will now have a GridIndex3D.

Definition at line 218 of file grid_storages.h.

template<int D, class VT, class Base, class Map = typename boost::unordered_map<GridIndexD<D>, VT>>
bool IMP::algebra::SparseGridStorageD< D, VT, Base, Map >::get_has_index ( const ExtendedGridIndexD< D > &  i) const

Return true if the voxel has been added.

Definition at line 232 of file grid_storages.h.

template<int D, class VT, class Base, class Map = typename boost::unordered_map<GridIndexD<D>, VT>>
GridIndexD<D> IMP::algebra::SparseGridStorageD< D, VT, Base, Map >::get_index ( const ExtendedGridIndexD< D > &  i) const

requires get_has_index(i) is true.

Definition at line 236 of file grid_storages.h.


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