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