CMS 3D CMS Logo

TestSoA.h
Go to the documentation of this file.
1 #ifndef DataFormats_PortableTestObjects_interface_TestSoA_h
2 #define DataFormats_PortableTestObjects_interface_TestSoA_h
3 
4 #include <array>
5 
6 #include <Eigen/Core>
7 #include <Eigen/Dense>
8 
13 
14 namespace portabletest {
15 
16  // the type aliases are needed because commas confuse macros
18  //using Array = std::array<short, 4>;
19  using Matrix = Eigen::Matrix<double, 3, 6>;
20 
21  // SoA layout with x, y, z, id fields
23  // columns: one value per element
24  SOA_COLUMN(double, x),
25  SOA_COLUMN(double, y),
26  SOA_COLUMN(double, z),
27  SOA_COLUMN(int32_t, id),
28  // scalars: one value for the whole structure
29  SOA_SCALAR(double, r),
30  // column of arrays: one fixed-size array per element
32  // Eigen columns: each matrix element is stored in a separate column
34 
35  using TestSoA = TestSoALayout<>;
36 
38  // columns: one value per element
39  SOA_COLUMN(double, x2),
40  SOA_COLUMN(double, y2),
41  SOA_COLUMN(double, z2),
42  SOA_COLUMN(int32_t, id2),
43  // scalars: one value for the whole structure
44  SOA_SCALAR(double, r2),
45  // Eigen columns
46  // the typedef is needed because commas confuse macros
48 
49  using TestSoA2 = TestSoALayout2<>;
50 
52  // columns: one value per element
53  SOA_COLUMN(double, x3),
54  SOA_COLUMN(double, y3),
55  SOA_COLUMN(double, z3),
56  SOA_COLUMN(int32_t, id3),
57  // scalars: one value for the whole structure
58  SOA_SCALAR(double, r3),
59  // Eigen columns
60  // the typedef is needed because commas confuse macros
62 
63  using TestSoA3 = TestSoALayout3<>;
64 
65 } // namespace portabletest
66 
67 #endif // DataFormats_PortableTestObjects_interface_TestSoA_h
Eigen::Matrix< double, 3, 6 > Matrix
Definition: TestSoA.h:19
#define GENERATE_SOA_LAYOUT(CLASS,...)
Definition: SoALayout.h:431
#define SOA_SCALAR(TYPE, NAME)
Definition: SoACommon.h:563
#define SOA_EIGEN_COLUMN(TYPE, NAME)
Definition: SoACommon.h:565
#define SOA_COLUMN(TYPE, NAME)
Definition: SoACommon.h:564