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 /** 9 @brief Identity QFunction that copies inputs directly into outputs 10 **/ 11 12 #ifndef identity_h 13 #define identity_h 14 15 #include <ceed.h> 16 17 typedef struct { 18 CeedInt size; 19 } IdentityCtx; 20 21 CEED_QFUNCTION(Identity)(void *ctx, const CeedInt Q, 22 const CeedScalar *const *in, 23 CeedScalar *const *out) { 24 // Ctx holds field size 25 IdentityCtx identity_ctx = *(IdentityCtx *)ctx; 26 const CeedInt size = identity_ctx.size; 27 28 // in[0] is input, size (Q*size) 29 const CeedScalar *input = in[0]; 30 // out[0] is output, size (Q*size) 31 CeedScalar *output = out[0]; 32 33 // Quadrature point loop 34 CeedPragmaSIMD 35 for (CeedInt i=0; i<Q*size; i++) { 36 output[i] = input[i]; 37 } // End of Quadrature Point Loop 38 39 return CEED_ERROR_SUCCESS; 40 } 41 42 #endif // identity_h 43