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 typedef struct { 16 CeedInt size; 17 } IdentityCtx; 18 19 CEED_QFUNCTION(Identity)(void *ctx, const CeedInt Q, 20 const CeedScalar *const *in, 21 CeedScalar *const *out) { 22 // Ctx holds field size 23 IdentityCtx identity_ctx = *(IdentityCtx *)ctx; 24 const CeedInt size = identity_ctx.size; 25 26 // in[0] is input, size (Q*size) 27 const CeedScalar *input = in[0]; 28 // out[0] is output, size (Q*size) 29 CeedScalar *output = out[0]; 30 31 // Quadrature point loop 32 CeedPragmaSIMD 33 for (CeedInt i=0; i<Q*size; i++) { 34 output[i] = input[i]; 35 } // End of Quadrature Point Loop 36 37 return CEED_ERROR_SUCCESS; 38 } 39 40 #endif // identity_h 41