xref: /libCEED/include/ceed/jit-source/gallery/ceed-massapply.h (revision 0d627ac128dbf360e78b18bad1cfd2089ff3d6d8)
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 #include <ceed.h>
16 
17 CEED_QFUNCTION(MassApply)(void *ctx, const CeedInt Q,
18                           const CeedScalar *const *in, CeedScalar *const *out) {
19   // in[0] is u, size (Q)
20   // in[1] is quadrature data, size (Q)
21   const CeedScalar *u = in[0], *q_data = in[1];
22   // out[0] is v, size (Q)
23   CeedScalar *v = out[0];
24 
25   // Quadrature point loop
26   CeedPragmaSIMD
27   for (CeedInt i=0; i<Q; i++) {
28     v[i] = u[i] * q_data[i];
29   } // End of Quadrature Point Loop
30 
31   return CEED_ERROR_SUCCESS;
32 }
33 
34 #endif // massapply_h
35