xref: /libCEED/include/ceed/jit-source/gallery/ceed-massapply.h (revision 71b2a0f6f4a99141ea55c8b15cf50f079031c343)
1 // Copyright (c) 2017-2022, 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 /**
9   @brief Ceed QFunction for applying the mass matrix
10 **/
11 
12 #ifndef massapply_h
13 #define massapply_h
14 
15 CEED_QFUNCTION(MassApply)(void *ctx, const CeedInt Q,
16                           const CeedScalar *const *in, CeedScalar *const *out) {
17   // in[0] is u, size (Q)
18   // in[1] is quadrature data, size (Q)
19   const CeedScalar *u = in[0], *q_data = in[1];
20   // out[0] is v, size (Q)
21   CeedScalar *v = out[0];
22 
23   // Quadrature point loop
24   CeedPragmaSIMD
25   for (CeedInt i=0; i<Q; i++) {
26     v[i] = u[i] * q_data[i];
27   } // End of Quadrature Point Loop
28 
29   return CEED_ERROR_SUCCESS;
30 }
31 
32 #endif // massapply_h
33