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