xref: /libCEED/include/ceed/jit-source/hip/hip-ref-qfunction.h (revision c0b5abf0f23b15c4f0ada76f8abe9f8d2b6fa247)
1 // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause
5 //
6 // This file is part of CEED:  http://github.com/ceed
7 
8 /// @file
9 /// Internal header for HIP backend QFunction read/write kernels
10 
11 #include <ceed/types.h>
12 
13 //------------------------------------------------------------------------------
14 // Read from quadrature points
15 //------------------------------------------------------------------------------
16 template <int SIZE>
17 inline __device__ void readQuads(const CeedInt quad, const CeedInt num_qpts, const CeedScalar *d_u, CeedScalar *r_u) {
18   for (CeedInt comp = 0; comp < SIZE; comp++) {
19     r_u[comp] = d_u[quad + num_qpts * comp];
20   }
21 }
22 
23 //------------------------------------------------------------------------------
24 // Write at quadrature points
25 //------------------------------------------------------------------------------
26 template <int SIZE>
27 inline __device__ void writeQuads(const CeedInt quad, const CeedInt num_qpts, const CeedScalar *r_v, CeedScalar *d_v) {
28   for (CeedInt comp = 0; comp < SIZE; comp++) {
29     d_v[quad + num_qpts * comp] = r_v[comp];
30   }
31 }
32