xref: /libCEED/examples/fluids/qfunctions/inverse_multiplicity.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors.
23a10b0eeSJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33a10b0eeSJames Wright //
43a10b0eeSJames Wright // SPDX-License-Identifier: BSD-2-Clause
53a10b0eeSJames Wright //
63a10b0eeSJames Wright // This file is part of CEED:  http://github.com/ceed
7c0b5abf0SJeremy L Thompson #include <ceed/types.h>
83a10b0eeSJames Wright 
93a10b0eeSJames 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)103a10b0eeSJames Wright CEED_QFUNCTION(InverseMultiplicity)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
113a10b0eeSJames Wright   const CeedScalar(*multiplicity)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0];
123a10b0eeSJames Wright   CeedScalar(*inv_multiplicity)               = (CeedScalar(*))out[0];
133a10b0eeSJames Wright 
143a10b0eeSJames Wright   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) inv_multiplicity[i] = 1.0 / multiplicity[0][i];
153a10b0eeSJames Wright   return 0;
163a10b0eeSJames Wright }
17