CMS 3D CMS Logo

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  // typedef double Scalar;
31  typedef float Scalar;
34 
36  //using BVector = ValueType;
37  using Container = std::vector<BVector>;
38 
39  Grid3D() {}
40 
41  Grid3D(const Grid1D& ga, const Grid1D& gb, const Grid1D& gc, std::vector<BVector>& data)
42  : grida_(ga), gridb_(gb), gridc_(gc) {
43  data_.swap(data);
44  stride1_ = gridb_.nodes() * gridc_.nodes();
45  stride2_ = gridc_.nodes();
46  }
47 
48  // Grid3D( const Grid1D& ga, const Grid1D& gb, const Grid1D& gc,
49  // std::vector<ValueType> const & data);
50 
51  int index(int i, int j, int k) const { return i * stride1_ + j * stride2_ + k; }
52  int stride1() const { return stride1_; }
53  int stride2() const { return stride2_; }
54  int stride3() const { return 1; }
55  ValueType operator()(int i) const { return ValueType(data_[i][0], data_[i][1], data_[i][2]); }
56 
57  ValueType operator()(int i, int j, int k) const { return (*this)(index(i, j, k)); }
58 
59  const Grid1D& grida() const { return grida_; }
60  const Grid1D& gridb() const { return gridb_; }
61  const Grid1D& gridc() const { return gridc_; }
62 
63  const Container& data() const { return data_; }
64 
65  void dump() const;
66 
67 private:
71 
73 
74  int stride1_;
75  int stride2_;
76 };
77 
78 #endif
DDAxes::y
Visibility.h
Grid3D::stride1_
int stride1_
Definition: Grid3D.h:74
mps_fire.i
i
Definition: mps_fire.py:428
Grid3D::stride2
int stride2() const
Definition: Grid3D.h:53
Grid3D::Grid3D
Grid3D()
Definition: Grid3D.h:39
Grid3D::operator()
ValueType operator()(int i, int j, int k) const
Definition: Grid3D.h:57
Grid3D::ReturnType
ValueType ReturnType
Definition: Grid3D.h:33
Grid3D::ValueType
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:32
Basic3DVector.h
Grid3D::index
int index(int i, int j, int k) const
Definition: Grid3D.h:51
DDAxes::x
BStorageArray::BStorageArray
BStorageArray()
Definition: Grid3D.h:20
Grid3D
Definition: Grid3D.h:28
Grid3D::Scalar
float Scalar
Definition: Grid3D.h:31
Grid1D
Definition: Grid1D.h:7
DDAxes::z
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Grid3D::data
const Container & data() const
Definition: Grid3D.h:63
Grid3D::stride3
int stride3() const
Definition: Grid3D.h:54
BStorageArray::operator[]
float const & operator[](int i) const
Definition: Grid3D.h:23
Grid3D::gridb_
Grid1D gridb_
Definition: Grid3D.h:69
Grid3D::grida
const Grid1D & grida() const
Definition: Grid3D.h:59
Grid3D::data_
Container data_
Definition: Grid3D.h:72
Json::ValueType
ValueType
Type of the value held by a Value object.
Definition: value.h:23
dso_internal
#define dso_internal
Definition: Visibility.h:13
FrontierConditions_GlobalTag_cff.dump
dump
Definition: FrontierConditions_GlobalTag_cff.py:12
Grid3D::grida_
Grid1D grida_
Definition: Grid3D.h:68
Grid3D::Container
std::vector< BVector > Container
Definition: Grid3D.h:37
Grid3D::stride2_
int stride2_
Definition: Grid3D.h:75
BStorageArray::v
float v[3]
Definition: Grid3D.h:25
BStorageArray
Definition: Grid3D.h:19
Grid3D::stride1
int stride1() const
Definition: Grid3D.h:52
Grid3D::operator()
ValueType operator()(int i) const
Definition: Grid3D.h:55
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
Grid3D::gridc_
Grid1D gridc_
Definition: Grid3D.h:70
Grid1D.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Grid3D::gridb
const Grid1D & gridb() const
Definition: Grid3D.h:60
Basic3DVector< Scalar >
Grid3D::gridc
const Grid1D & gridc() const
Definition: Grid3D.h:61
BStorageArray::BStorageArray
BStorageArray(float x, float y, float z)
Definition: Grid3D.h:21
Grid3D::Grid3D
Grid3D(const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< BVector > &data)
Definition: Grid3D.h:41