xref: /honee/qfunctions/inverse_multiplicity.h (revision b78d7c7d152a2530c4ff7c4fb0143fe9be02cbec)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 #include <ceed/types.h>
4 
5 // @brief Calculate the inverse of the multiplicity, reducing to a single component
InverseMultiplicity(void * ctx,CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)6 CEED_QFUNCTION(InverseMultiplicity)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
7   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0];
8   CeedScalar(*inv_multiplicity)               = (CeedScalar(*))out[0];
9 
10   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) inv_multiplicity[i] = 1.0 / multiplicity[0][i];
11   return 0;
12 }
13