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