xref: /libCEED/include/ceed/jit-source/hip/hip-ref-qfunction.h (revision e6a0ab89c38f1283091e68ca521745ca21d629af)
1 // Copyright (c) 2017-2022, 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 #include <ceed/ceed.h>
9 
10 template <int SIZE>
11 //------------------------------------------------------------------------------
12 // Read from quadrature points
13 //------------------------------------------------------------------------------
14 inline __device__ void readQuads(const CeedInt quad, const CeedInt num_qpts,
15                                  const CeedScalar* d_u, CeedScalar* r_u) {
16   for(CeedInt comp = 0; comp < SIZE; comp++) {
17     r_u[comp] = d_u[quad + num_qpts * comp];
18   }
19 }
20 
21 //------------------------------------------------------------------------------
22 // Write at quadrature points
23 //------------------------------------------------------------------------------
24 template <int SIZE>
25 inline __device__ void writeQuads(const CeedInt quad, const CeedInt num_qpts,
26                                   const CeedScalar* r_v, CeedScalar* d_v) {
27   for(CeedInt comp = 0; comp < SIZE; comp++) {
28     d_v[quad + num_qpts * comp] = r_v[comp];
29   }
30 }
31 
32 //------------------------------------------------------------------------------
33