xref: /libCEED/rust/libceed-sys/c-src/include/ceed/jit-source/gallery/ceed-massapply.h (revision 2b730f8b5a9c809740a0b3b302db43a719c636b1)
1a0154adeSJed Brown // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2a0154adeSJed Brown // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3a0154adeSJed Brown //
4a0154adeSJed Brown // SPDX-License-Identifier: BSD-2-Clause
5a0154adeSJed Brown //
6a0154adeSJed Brown // This file is part of CEED:  http://github.com/ceed
7a0154adeSJed Brown 
8a0154adeSJed Brown /**
9a0154adeSJed Brown   @brief Ceed QFunction for applying the mass matrix
10a0154adeSJed Brown **/
11a0154adeSJed Brown 
12a0154adeSJed Brown #ifndef massapply_h
13a0154adeSJed Brown #define massapply_h
14a0154adeSJed Brown 
15c9c2c079SJeremy L Thompson #include <ceed.h>
16c9c2c079SJeremy L Thompson 
17*2b730f8bSJeremy L Thompson CEED_QFUNCTION(MassApply)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
18a0154adeSJed Brown   // in[0] is u, size (Q)
19a0154adeSJed Brown   // in[1] is quadrature data, size (Q)
20a0154adeSJed Brown   const CeedScalar *u = in[0], *q_data = in[1];
21a0154adeSJed Brown   // out[0] is v, size (Q)
22a0154adeSJed Brown   CeedScalar *v = out[0];
23a0154adeSJed Brown 
24a0154adeSJed Brown   // Quadrature point loop
25*2b730f8bSJeremy L Thompson   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { v[i] = u[i] * q_data[i]; }  // End of Quadrature Point Loop
26a0154adeSJed Brown 
27a0154adeSJed Brown   return CEED_ERROR_SUCCESS;
28a0154adeSJed Brown }
29a0154adeSJed Brown 
30a0154adeSJed Brown #endif  // massapply_h
31