xref: /libCEED/include/ceed/jit-source/gallery/ceed-identity-to-scalar.h (revision 736f144a02fcdbcd732ee675ef7e42bf47b1eba5)
1 // Copyright (c) 2017-2026, 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 /**
9   @brief  Identity QFunction that copies first input component directly into output
10 **/
11 #include <ceed/types.h>
12 
13 CEED_QFUNCTION(IdentityScalar)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
14   // in[0] is input, size (Q*size)
15   const CeedScalar *input = in[0];
16   // out[0] is output, size (Q)
17   CeedScalar *output = out[0];
18 
19   // Quadrature point loop
20   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { output[i] = input[i]; }  // End of Quadrature Point Loop
21   return CEED_ERROR_SUCCESS;
22 }
23