xref: /honee/qfunctions/inverse_multiplicity.h (revision b78d7c7d152a2530c4ff7c4fb0143fe9be02cbec)
1ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3*3e17a7a1SJames Wright #include <ceed/types.h>
45930f037SJames Wright 
55930f037SJames Wright // @brief Calculate the inverse of the multiplicity, reducing to a single component
InverseMultiplicity(void * ctx,CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)65930f037SJames Wright CEED_QFUNCTION(InverseMultiplicity)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
75930f037SJames Wright   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0];
85930f037SJames Wright   CeedScalar(*inv_multiplicity)               = (CeedScalar(*))out[0];
95930f037SJames Wright 
105930f037SJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) inv_multiplicity[i] = 1.0 / multiplicity[0][i];
115930f037SJames Wright   return 0;
125930f037SJames Wright }
13