1 // Copyright (c) 2017-2024, 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 CEED_IDENTITY_H 13 #define CEED_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, const CeedScalar *const *in, 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 for (CeedInt i = 0; i < Q * size; i++) { output[i] = input[i]; } // End of Quadrature Point Loop 33 34 return CEED_ERROR_SUCCESS; 35 } 36 37 #endif // CEED_IDENTITY_H 38