CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Grid3D.h
Go to the documentation of this file.
1 #ifndef Grid3D_h
2 #define Grid3D_h
3 
14 #include <vector>
15 
16 class Grid3D {
17 public:
18 
19  // typedef double Scalar;
20  typedef float Scalar;
23 
24  Grid3D() {}
25 
26  Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
27  std::vector<ValueType>& data) :
28  grida_(ga), gridb_(gb), gridc_(gc) {
29  data_.swap(data);
31  stride2_ = gridc_.nodes();
32  }
33 
34 
35  // Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
36  // std::vector<ValueType> const & data);
37 
38 
39  int index(int i, int j, int k) const {return i*stride1_ + j*stride2_ + k;}
40  int stride1() const { return stride1_;}
41  int stride2() const { return stride2_;}
42  int stride3() const { return 1;}
43  const ValueType& operator()(int i) const {
44  return data_[i];
45  }
46 
47  ValueType const & operator()(int i, int j, int k) const {
48  return (*this)(index(i,j,k));
49  }
50 
51  const Grid1D& grida() const {return grida_;}
52  const Grid1D& gridb() const {return gridb_;}
53  const Grid1D& gridc() const {return gridc_;}
54 
55  const std::vector<ValueType>& data() const {return data_;}
56 
57  void dump() const;
58 
59 private:
60 
64 
65  std::vector<ValueType> data_;
66 
67  int stride1_;
68  int stride2_;
69 
70 
71 };
72 
73 #endif
Grid1D gridb_
Definition: Grid3D.h:62
int i
Definition: DBlmapReader.cc:9
int stride3() const
Definition: Grid3D.h:42
Grid3D(const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< ValueType > &data)
Definition: Grid3D.h:26
const Grid1D & grida() const
Definition: Grid3D.h:51
int stride2_
Definition: Grid3D.h:68
int stride2() const
Definition: Grid3D.h:41
Grid1D grida_
Definition: Grid3D.h:61
void dump() const
Definition: Grid3D.cc:18
int index(int i, int j, int k) const
Definition: Grid3D.h:39
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:21
std::vector< ValueType > data_
Definition: Grid3D.h:65
Grid1D gridc_
Definition: Grid3D.h:63
int nodes() const
Definition: Grid1D.h:23
const Grid1D & gridc() const
Definition: Grid3D.h:53
int j
Definition: DBlmapReader.cc:9
int stride1() const
Definition: Grid3D.h:40
ValueType ReturnType
Definition: Grid3D.h:22
int stride1_
Definition: Grid3D.h:67
Definition: Grid3D.h:16
float Scalar
Definition: Grid3D.h:20
int k[5][pyjets_maxn]
Definition: Grid1D.h:6
Grid3D()
Definition: Grid3D.h:24
const ValueType & operator()(int i) const
Definition: Grid3D.h:43
ValueType const & operator()(int i, int j, int k) const
Definition: Grid3D.h:47
const Grid1D & gridb() const
Definition: Grid3D.h:52
const std::vector< ValueType > & data() const
Definition: Grid3D.h:55