1*3a10b0eeSJames Wright // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2*3a10b0eeSJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*3a10b0eeSJames Wright // 4*3a10b0eeSJames Wright // SPDX-License-Identifier: BSD-2-Clause 5*3a10b0eeSJames Wright // 6*3a10b0eeSJames Wright // This file is part of CEED: http://github.com/ceed 7*3a10b0eeSJames Wright 8*3a10b0eeSJames Wright /// @file 9*3a10b0eeSJames Wright 10*3a10b0eeSJames Wright #ifndef inverse_multiplicity_h 11*3a10b0eeSJames Wright #define inverse_multiplicity_h 12*3a10b0eeSJames Wright 13*3a10b0eeSJames Wright #include <ceed.h> 14*3a10b0eeSJames Wright 15*3a10b0eeSJames Wright // @brief Calculate the inverse of the multiplicity, reducing to a single component 16*3a10b0eeSJames Wright CEED_QFUNCTION(InverseMultiplicity)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 17*3a10b0eeSJames Wright const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; 18*3a10b0eeSJames Wright CeedScalar(*inv_multiplicity) = (CeedScalar(*))out[0]; 19*3a10b0eeSJames Wright 20*3a10b0eeSJames Wright CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) inv_multiplicity[i] = 1.0 / multiplicity[0][i]; 21*3a10b0eeSJames Wright return 0; 22*3a10b0eeSJames Wright } 23*3a10b0eeSJames Wright 24*3a10b0eeSJames Wright #endif // sgs_dd_utils_h 25