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