1a0154adeSJed Brown // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2a0154adeSJed Brown // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3a0154adeSJed Brown // 4a0154adeSJed Brown // SPDX-License-Identifier: BSD-2-Clause 5a0154adeSJed Brown // 6a0154adeSJed Brown // This file is part of CEED: http://github.com/ceed 7a0154adeSJed Brown 8a0154adeSJed Brown /** 9a0154adeSJed Brown @brief Identity QFunction that copies inputs directly into outputs 10a0154adeSJed Brown **/ 11a0154adeSJed Brown 12a0154adeSJed Brown #ifndef identity_h 13a0154adeSJed Brown #define identity_h 14a0154adeSJed Brown 15*c9c2c079SJeremy L Thompson #include <ceed.h> 16*c9c2c079SJeremy L Thompson 17a0154adeSJed Brown typedef struct { 18a0154adeSJed Brown CeedInt size; 19a0154adeSJed Brown } IdentityCtx; 20a0154adeSJed Brown 21a0154adeSJed Brown CEED_QFUNCTION(Identity)(void *ctx, const CeedInt Q, 22a0154adeSJed Brown const CeedScalar *const *in, 23a0154adeSJed Brown CeedScalar *const *out) { 24a0154adeSJed Brown // Ctx holds field size 25a0154adeSJed Brown IdentityCtx identity_ctx = *(IdentityCtx *)ctx; 26a0154adeSJed Brown const CeedInt size = identity_ctx.size; 27a0154adeSJed Brown 28a0154adeSJed Brown // in[0] is input, size (Q*size) 29a0154adeSJed Brown const CeedScalar *input = in[0]; 30a0154adeSJed Brown // out[0] is output, size (Q*size) 31a0154adeSJed Brown CeedScalar *output = out[0]; 32a0154adeSJed Brown 33a0154adeSJed Brown // Quadrature point loop 34a0154adeSJed Brown CeedPragmaSIMD 35a0154adeSJed Brown for (CeedInt i=0; i<Q*size; i++) { 36a0154adeSJed Brown output[i] = input[i]; 37a0154adeSJed Brown } // End of Quadrature Point Loop 38a0154adeSJed Brown 39a0154adeSJed Brown return CEED_ERROR_SUCCESS; 40a0154adeSJed Brown } 41a0154adeSJed Brown 42a0154adeSJed Brown #endif // identity_h 43