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