IMP  2.0.0
The Integrative Modeling Platform
standard_grids.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/standard_grids.h
3  * \brief A class to represent a voxel grid.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPALGEBRA_STANDARD_GRIDS_H
10 #define IMPALGEBRA_STANDARD_GRIDS_H
11 
12 #include <IMP/algebra/algebra_config.h>
13 #include "GridD.h"
14 #include "grid_ranges.h"
15 #include "grid_storages.h"
16 #include "grid_embeddings.h"
17 IMPALGEBRA_BEGIN_NAMESPACE
18 
19 // They are created with %template in swig to get around inclusion order issues
20 #ifndef SWIG
21 
22 /** A sparse, infinite grid of values. In python SparseUnboundedIntGrid3D
23  is provided.*/
24 template <int D, class VT>
26  public GridD<D, SparseGridStorageD<D, VT,
27  UnboundedGridRangeD<D> >,
28  VT, DefaultEmbeddingD<D> >{
29  typedef GridD<D, SparseGridStorageD<D, VT,
31  VT, DefaultEmbeddingD<D> > P;
32  SparseUnboundedGridD(double side,
33  const VectorD<D> &origin,
34  VT def=VT()): P(side, origin, def){}
36  SparseUnboundedGridD(double side, unsigned int d,
37  const VT& def= VT()): P(side, d, def) {}
38 
39 };
40 
41 /** A dense grid of values. In python DenseFloatGrid3D and DenseDoubleGrid3D are
42  provided. See IMP_GRID3D_FOREACH_VOXEL() for a useful macro when operating
43  on all voxels of the grid.
44 */
45 template <class VT>
46 struct DenseGrid3D:
47  public GridD<3, DenseGridStorageD<3, VT>, VT,
48  DefaultEmbeddingD<3> > {
51  DenseGrid3D(double side,
52  const BoundingBoxD<3> &bb,
53  VT def=VT()): P(side, bb, def) {}
54  DenseGrid3D(int xd, int yd, int zd,
55  const BoundingBoxD<3> &bb,
56  VT def=VT()): P(xd, yd, zd, bb, def) {}
57  DenseGrid3D(){}
58 
59 };
60 
61 /** A sparse grid of values. In python SparseIntGrid3D is provided.*/
62 template <class VT>
63 struct SparseGrid3D:
64  public GridD<3, SparseGridStorageD<3, VT,
65  BoundedGridRangeD<3> >, VT,
66  DefaultEmbeddingD<3> > {
67  typedef GridD<3, SparseGridStorageD<3, VT,
70  SparseGrid3D(double side,
71  const BoundingBoxD<3> &bb,
72  VT def=VT()): P(side, bb, def) {}
73  SparseGrid3D(int xd, int yd, int zd,
74  const BoundingBoxD<3> &bb,
75  VT def=VT()): P(xd, yd, zd, bb, def) {}
76  SparseGrid3D(){}
77 };
78 
79 /** A sparse, infinite grid of values. In python SparseUnboundedIntGrid3D
80  is provided.*/
81 template <class VT>
83  public GridD<3, SparseGridStorageD<3, VT,
84  UnboundedGridRangeD<3> >, VT,
85  DefaultEmbeddingD<3> >{
86  typedef GridD<3, SparseGridStorageD<3, VT,
89  SparseUnboundedGrid3D(double side,
90  const Vector3D &origin,
91  VT def=VT()): P(side, origin, def){}
93 
94 };
95 
96 #endif
97 
98 IMPALGEBRA_END_NAMESPACE
99 
100 
101 #endif /* IMPALGEBRA_STANDARD_GRIDS_H */