11#pragma once
22
33#if defined( __CUDACC__ ) || defined( __HIPCC__ )
4- #define HOST_DEVICE __host__ __device__
4+ #define HPCREACT_HOST_DEVICE __host__ __device__
55#else
6- #define HOST_DEVICE
6+ #define HPCREACT_HOST_DEVICE
77#endif
88
99/* *
@@ -38,28 +38,28 @@ struct CArrayWrapper< T, 1, DIM0 >
3838 * @param dim The index (must be in range [0, DIM0)).
3939 * @return Reference to the element at the specified index.
4040 */
41- HOST_DEVICE inline T & operator ()( int const dim ) { return data[dim]; }
41+ HPCREACT_HOST_DEVICE inline T & operator ()( int const dim ) { return data[dim]; }
4242
4343 /* *
4444 * @brief Read-only access to an element by index (const overload).
4545 * @param dim The index (must be in range [0, DIM0)).
4646 * @return Const reference to the element at the specified index.
4747 */
48- HOST_DEVICE inline T const & operator ()( int const dim ) const { return data[dim]; }
48+ HPCREACT_HOST_DEVICE inline T const & operator ()( int const dim ) const { return data[dim]; }
4949
5050 /* *
5151 * @brief Subscript operator for read/write access.
5252 * @param dim The index (must be in range [0, DIM0)).
5353 * @return Reference to the element at the specified index.
5454 */
55- HOST_DEVICE inline T & operator []( int const dim ) { return data[dim]; }
55+ HPCREACT_HOST_DEVICE inline T & operator []( int const dim ) { return data[dim]; }
5656
5757 /* *
5858 * @brief Subscript operator for read-only access (const overload).
5959 * @param dim The index (must be in range [0, DIM0)).
6060 * @return Const reference to the element at the specified index.
6161 */
62- HOST_DEVICE inline T const & operator []( int const dim ) const { return data[dim]; }
62+ HPCREACT_HOST_DEVICE inline T const & operator []( int const dim ) const { return data[dim]; }
6363
6464 // / The underlying 1D C-style array.
6565 T data[DIM0];
@@ -84,7 +84,7 @@ struct CArrayWrapper< T, 2, DIM0, DIM1 >
8484 * @param dim1 Index in the second dimension (range [0, DIM1)).
8585 * @return Reference to the element at the specified 2D location.
8686 */
87- HOST_DEVICE inline T & operator ()( int const dim0, int const dim1 )
87+ HPCREACT_HOST_DEVICE inline T & operator ()( int const dim0, int const dim1 )
8888 {
8989 return data[dim0][dim1];
9090 }
@@ -95,7 +95,7 @@ struct CArrayWrapper< T, 2, DIM0, DIM1 >
9595 * @param dim1 Index in the second dimension (range [0, DIM1)).
9696 * @return Const reference to the element at the specified 2D location.
9797 */
98- HOST_DEVICE inline T const & operator ()( int const dim0, int const dim1 ) const
98+ HPCREACT_HOST_DEVICE inline T const & operator ()( int const dim0, int const dim1 ) const
9999 {
100100 return data[dim0][dim1];
101101 }
@@ -107,7 +107,7 @@ struct CArrayWrapper< T, 2, DIM0, DIM1 >
107107 *
108108 * This allows usage like `obj[dim0][dim1]`.
109109 */
110- HOST_DEVICE inline T ( & operator []( int const dim0 ))[DIM1]
110+ HPCREACT_HOST_DEVICE inline T ( & operator []( int const dim0 ))[DIM1]
111111 {
112112 return data[dim0];
113113 }
@@ -117,7 +117,7 @@ struct CArrayWrapper< T, 2, DIM0, DIM1 >
117117 * @param dim0 The row index (range [0, DIM0)).
118118 * @return Const reference to an array of type T[DIM1].
119119 */
120- HOST_DEVICE inline T const (&operator []( int const dim0 ) const )[DIM1]
120+ HPCREACT_HOST_DEVICE inline T const (&operator []( int const dim0 ) const )[DIM1]
121121 {
122122 return data[dim0];
123123 }
@@ -150,7 +150,7 @@ struct CArrayWrapper< T, 3, DIM0, DIM1, DIM2 >
150150 * @note Currently, this function incorrectly indexes data[dim0][dim1], missing dim2.
151151 * It should be `data[dim0][dim1][dim2]`. Please correct if intended.
152152 */
153- HOST_DEVICE inline T & operator ()( int const dim0, int const dim1, int const dim2 )
153+ HPCREACT_HOST_DEVICE inline T & operator ()( int const dim0, int const dim1, int const dim2 )
154154 {
155155 // NOTE: This looks like a bug in your original code. Should be data[dim0][dim1][dim2].
156156 return data[dim0][dim1][dim2];
@@ -163,7 +163,7 @@ struct CArrayWrapper< T, 3, DIM0, DIM1, DIM2 >
163163 * @param dim2 Index in the third dimension (range [0, DIM2)).
164164 * @return Const reference to the element at the specified 3D location.
165165 */
166- HOST_DEVICE inline T const & operator ()( int const dim0, int const dim1, int const dim2 ) const
166+ HPCREACT_HOST_DEVICE inline T const & operator ()( int const dim0, int const dim1, int const dim2 ) const
167167 {
168168 // NOTE: Same potential bug as above. Should be data[dim0][dim1][dim2].
169169 return data[dim0][dim1][dim2];
@@ -176,7 +176,7 @@ struct CArrayWrapper< T, 3, DIM0, DIM1, DIM2 >
176176 *
177177 * This allows usage like `obj[dim0][dim1][dim2]`.
178178 */
179- HOST_DEVICE inline T ( & operator []( int const dim0 ))[DIM1][DIM2]
179+ HPCREACT_HOST_DEVICE inline T ( & operator []( int const dim0 ))[DIM1][DIM2]
180180 {
181181 return data[dim0];
182182 }
@@ -186,7 +186,7 @@ struct CArrayWrapper< T, 3, DIM0, DIM1, DIM2 >
186186 * @param dim0 The slice index (range [0, DIM0)).
187187 * @return Const reference to an array of type T[DIM1][DIM2].
188188 */
189- HOST_DEVICE inline T const (&operator []( int const dim0 ) const )[DIM1][DIM2]
189+ HPCREACT_HOST_DEVICE inline T const (&operator []( int const dim0 ) const )[DIM1][DIM2]
190190 {
191191 return data[dim0];
192192 }
@@ -196,4 +196,4 @@ struct CArrayWrapper< T, 3, DIM0, DIM1, DIM2 >
196196};
197197
198198
199- #undef HOST_DEVICE
199+ #undef HPCREACT_HOST_DEVICE
0 commit comments