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