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 
12 // #include "DataFormats/Math/interface/SIMDVec.h"
13 #include "Grid1D.h"
14 #include <vector>
16 
17 // the storage class
18 // needed just because legacy software used () constructor
19 struct BStorageArray {
21  BStorageArray(float x,float y, float z) : v{x,y,z}{}
22 
23  float const & operator[](int i) const { return v[i];}
24 
25  float v[3];
26 };
27 
29 public:
30 
31  // typedef double Scalar;
32  typedef float Scalar;
35 
37  //using BVector = ValueType;
38  using Container = std::vector<BVector>;
39 
40  Grid3D() {}
41 
42  Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
43  std::vector<BVector>& data) :
44  grida_(ga), gridb_(gb), gridc_(gc) {
45  data_.swap(data);
46  stride1_ = gridb_.nodes() * gridc_.nodes();
47  stride2_ = gridc_.nodes();
48  }
49 
50 
51  // Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
52  // std::vector<ValueType> const & data);
53 
54 
55  int index(int i, int j, int k) const {return i*stride1_ + j*stride2_ + k;}
56  int stride1() const { return stride1_;}
57  int stride2() const { return stride2_;}
58  int stride3() const { return 1;}
59  ValueType operator()(int i) const {
60  return ValueType(data_[i][0],data_[i][1],data_[i][2]);
61  }
62 
63  ValueType operator()(int i, int j, int k) const {
64  return (*this)(index(i,j,k));
65  }
66 
67  const Grid1D& grida() const {return grida_;}
68  const Grid1D& gridb() const {return gridb_;}
69  const Grid1D& gridc() const {return gridc_;}
70 
71  const Container & data() const {return data_;}
72 
73  void dump() const;
74 
75 private:
76 
80 
82 
83  int stride1_;
84  int stride2_;
85 
86 
87 };
88 
89 #endif
Grid1D gridb_
Definition: Grid3D.h:78
BStorageArray()
Definition: Grid3D.h:20
int i
Definition: DBlmapReader.cc:9
int stride3() const
Definition: Grid3D.h:58
const Grid1D & grida() const
Definition: Grid3D.h:67
int stride2_
Definition: Grid3D.h:84
int stride2() const
Definition: Grid3D.h:57
Grid1D grida_
Definition: Grid3D.h:77
float v[3]
Definition: Grid3D.h:25
int index(int i, int j, int k) const
Definition: Grid3D.h:55
float float float z
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:33
ValueType operator()(int i) const
Definition: Grid3D.h:59
Grid1D gridc_
Definition: Grid3D.h:79
std::vector< BVector > Container
Definition: Grid3D.h:38
const Grid1D & gridc() const
Definition: Grid3D.h:69
int j
Definition: DBlmapReader.cc:9
int stride1() const
Definition: Grid3D.h:56
ValueType
Type of the value held by a Value object.
Definition: value.h:23
const Container & data() const
Definition: Grid3D.h:71
ValueType ReturnType
Definition: Grid3D.h:34
int stride1_
Definition: Grid3D.h:83
Definition: Grid3D.h:28
float Scalar
Definition: Grid3D.h:32
int k[5][pyjets_maxn]
ValueType operator()(int i, int j, int k) const
Definition: Grid3D.h:63
Definition: Grid1D.h:7
Grid3D()
Definition: Grid3D.h:40
float const & operator[](int i) const
Definition: Grid3D.h:23
Container data_
Definition: Grid3D.h:81
#define dso_internal
Grid3D(const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< BVector > &data)
Definition: Grid3D.h:42
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
BStorageArray(float x, float y, float z)
Definition: Grid3D.h:21
Definition: DDAxes.h:10
const Grid1D & gridb() const
Definition: Grid3D.h:68