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 
13 #include "Grid1D.h"
14 #include <vector>
16 
18 public:
19 
20  // typedef double Scalar;
21  typedef float Scalar;
24 
25  Grid3D() {}
26 
27  Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
28  std::vector<ValueType>& data) :
29  grida_(ga), gridb_(gb), gridc_(gc) {
30  data_.swap(data);
31  stride1_ = gridb_.nodes() * gridc_.nodes();
32  stride2_ = gridc_.nodes();
33  }
34 
35 
36  // Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
37  // std::vector<ValueType> const & data);
38 
39 
40  int index(int i, int j, int k) const {return i*stride1_ + j*stride2_ + k;}
41  int stride1() const { return stride1_;}
42  int stride2() const { return stride2_;}
43  int stride3() const { return 1;}
44  const ValueType& operator()(int i) const {
45  return data_[i];
46  }
47 
48  ValueType const & operator()(int i, int j, int k) const {
49  return (*this)(index(i,j,k));
50  }
51 
52  const Grid1D& grida() const {return grida_;}
53  const Grid1D& gridb() const {return gridb_;}
54  const Grid1D& gridc() const {return gridc_;}
55 
56  const std::vector<ValueType>& data() const {return data_;}
57 
58  void dump() const;
59 
60 private:
61 
65 
66  std::vector<ValueType> data_;
67 
68  int stride1_;
69  int stride2_;
70 
71 
72 };
73 
74 #endif
Grid1D gridb_
Definition: Grid3D.h:63
int i
Definition: DBlmapReader.cc:9
int stride3() const
Definition: Grid3D.h:43
Grid3D(const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< ValueType > &data)
Definition: Grid3D.h:27
const Grid1D & grida() const
Definition: Grid3D.h:52
int stride2_
Definition: Grid3D.h:69
int stride2() const
Definition: Grid3D.h:42
Grid1D grida_
Definition: Grid3D.h:62
int index(int i, int j, int k) const
Definition: Grid3D.h:40
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:22
std::vector< ValueType > data_
Definition: Grid3D.h:66
Grid1D gridc_
Definition: Grid3D.h:64
const Grid1D & gridc() const
Definition: Grid3D.h:54
int j
Definition: DBlmapReader.cc:9
#define dso_internal
Definition: Visibility.h:13
int stride1() const
Definition: Grid3D.h:41
ValueType ReturnType
Definition: Grid3D.h:23
int stride1_
Definition: Grid3D.h:68
Definition: Grid3D.h:17
float Scalar
Definition: Grid3D.h:21
int k[5][pyjets_maxn]
Definition: Grid1D.h:7
Grid3D()
Definition: Grid3D.h:25
const ValueType & operator()(int i) const
Definition: Grid3D.h:44
ValueType const & operator()(int i, int j, int k) const
Definition: Grid3D.h:48
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const Grid1D & gridb() const
Definition: Grid3D.h:53
const std::vector< ValueType > & data() const
Definition: Grid3D.h:56