CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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  // 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
Grid1D gridb_
Definition: Grid3D.h:69
BStorageArray()
Definition: Grid3D.h:20
int stride3() const
Definition: Grid3D.h:54
const Grid1D & grida() const
Definition: Grid3D.h:59
int stride2_
Definition: Grid3D.h:75
int stride2() const
Definition: Grid3D.h:53
Grid1D grida_
Definition: Grid3D.h:68
float v[3]
Definition: Grid3D.h:25
int index(int i, int j, int k) const
Definition: Grid3D.h:51
Basic3DVector< Scalar > ValueType
Definition: Grid3D.h:32
ValueType operator()(int i) const
Definition: Grid3D.h:55
Grid1D gridc_
Definition: Grid3D.h:70
std::vector< BVector > Container
Definition: Grid3D.h:37
const Grid1D & gridc() const
Definition: Grid3D.h:61
#define dso_internal
Definition: Visibility.h:13
int stride1() const
Definition: Grid3D.h:52
ValueType
Type of the value held by a Value object.
Definition: value.h:23
const Container & data() const
Definition: Grid3D.h:63
ValueType ReturnType
Definition: Grid3D.h:33
int stride1_
Definition: Grid3D.h:74
Definition: Grid3D.h:28
float Scalar
Definition: Grid3D.h:31
ValueType operator()(int i, int j, int k) const
Definition: Grid3D.h:57
Definition: Grid1D.h:7
Grid3D()
Definition: Grid3D.h:39
float const & operator[](int i) const
Definition: Grid3D.h:23
Container data_
Definition: Grid3D.h:72
Grid3D(const Grid1D &ga, const Grid1D &gb, const Grid1D &gc, std::vector< BVector > &data)
Definition: Grid3D.h:41
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
BStorageArray(float x, float y, float z)
Definition: Grid3D.h:21
const Grid1D & gridb() const
Definition: Grid3D.h:60
tuple dump
OutputFilePath = cms.string(&#39;/tmp/zhokin/&#39;), OutputFileExt = cms.string(&#39;&#39;),.