Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:01

0001 #ifndef DataFormats_PortableTestObjects_interface_TestSoA_h
0002 #define DataFormats_PortableTestObjects_interface_TestSoA_h
0003 
0004 #include <array>
0005 
0006 #include <Eigen/Core>
0007 #include <Eigen/Dense>
0008 
0009 #include "DataFormats/Common/interface/StdArray.h"
0010 #include "DataFormats/SoATemplate/interface/SoACommon.h"
0011 #include "DataFormats/SoATemplate/interface/SoALayout.h"
0012 #include "DataFormats/SoATemplate/interface/SoAView.h"
0013 
0014 namespace portabletest {
0015 
0016   // the type aliases are needed because commas confuse macros
0017   using Array = edm::StdArray<short, 4>;
0018   //using Array = std::array<short, 4>;
0019   using Matrix = Eigen::Matrix<double, 3, 6>;
0020 
0021   // SoA layout with x, y, z, id fields
0022   GENERATE_SOA_LAYOUT(TestSoALayout,
0023                       // columns: one value per element
0024                       SOA_COLUMN(double, x),
0025                       SOA_COLUMN(double, y),
0026                       SOA_COLUMN(double, z),
0027                       SOA_COLUMN(int32_t, id),
0028                       // scalars: one value for the whole structure
0029                       SOA_SCALAR(double, r),
0030                       // column of arrays: one fixed-size array per element
0031                       SOA_COLUMN(Array, flags),
0032                       // Eigen columns: each matrix element is stored in a separate column
0033                       SOA_EIGEN_COLUMN(Matrix, m))
0034 
0035   using TestSoA = TestSoALayout<>;
0036 
0037   GENERATE_SOA_LAYOUT(TestSoALayout2,
0038                       // columns: one value per element
0039                       SOA_COLUMN(double, x2),
0040                       SOA_COLUMN(double, y2),
0041                       SOA_COLUMN(double, z2),
0042                       SOA_COLUMN(int32_t, id2),
0043                       // scalars: one value for the whole structure
0044                       SOA_SCALAR(double, r2),
0045                       // Eigen columns
0046                       // the typedef is needed because commas confuse macros
0047                       SOA_EIGEN_COLUMN(Matrix, m2))
0048 
0049   using TestSoA2 = TestSoALayout2<>;
0050 
0051   GENERATE_SOA_LAYOUT(TestSoALayout3,
0052                       // columns: one value per element
0053                       SOA_COLUMN(double, x3),
0054                       SOA_COLUMN(double, y3),
0055                       SOA_COLUMN(double, z3),
0056                       SOA_COLUMN(int32_t, id3),
0057                       // scalars: one value for the whole structure
0058                       SOA_SCALAR(double, r3),
0059                       // Eigen columns
0060                       // the typedef is needed because commas confuse macros
0061                       SOA_EIGEN_COLUMN(Matrix, m3))
0062 
0063   using TestSoA3 = TestSoALayout3<>;
0064 
0065 }  // namespace portabletest
0066 
0067 #endif  // DataFormats_PortableTestObjects_interface_TestSoA_h