@@ -49,19 +49,36 @@ namespace mg5amcCpu
4949
5050 struct FLV_COUPLING_VIEW {
5151
52- const int * partner1;
53- const int * partner2;
54- const fptype* value;
52+ const int * const partner1;
53+ const int * const partner2;
54+ const fptype* const value;
5555
56- __host__ __device__ FLV_COUPLING_VIEW () = default;
5756 __host__ __device__
58- FLV_COUPLING_VIEW (const int * partner1_base,
59- const int * partner2_base,
60- const fptype* value_base,
61- const int n)
62- : partner1(partner1_base + n),
63- partner2 (partner2_base + n),
64- value(value_base + 2 *n) {}
57+ FLV_COUPLING_VIEW (const int * p1, const int * p2, const fptype* v)
58+ : partner1(p1), partner2(p2), value(v) {}
6559 };
6660
61+ template <int SIZE, int STRIDE>
62+ class FLV_COUPLING_ARRAY {
63+
64+ static_assert (SIZE >= 0 , " flvCOUPs SIZE must be non-negative" );
65+ static_assert (STRIDE > 0 , " flvCOUPs STRIDE must be positive" );
66+ const int * const partner1;
67+ const int * const partner2;
68+ const fptype* const value;
69+
70+ public:
71+ __host__ __device__
72+ FLV_COUPLING_ARRAY (const int * p1, const int * p2, const fptype* v)
73+ : partner1(p1), partner2(p2), value(v) {}
74+
75+ __host__ __device__
76+ FLV_COUPLING_VIEW operator [](const int i) const {
77+ return FLV_COUPLING_VIEW{
78+ partner1 + i*STRIDE,
79+ partner2 + i*STRIDE,
80+ value + i*2 *STRIDE
81+ };
82+ }
83+ };
6784%(function_declarations)s
0 commit comments