xref: /libCEED/include/ceed/jit-source/gallery/ceed-poisson1dapply.h (revision c9c2c07970382857cc7b4a28d359710237b91a3e)
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 1D Poisson operator
10 **/
11 
12 #ifndef poisson1dapply_h
13 #define poisson1dapply_h
14 
15 #include <ceed.h>
16 
17 CEED_QFUNCTION(Poisson1DApply)(void *ctx, const CeedInt Q,
18                                const CeedScalar *const *in,
19                                CeedScalar *const *out) {
20   // in[0] is gradient u, size (Q)
21   // in[1] is quadrature data, size (Q)
22   const CeedScalar *ug = in[0], *q_data = in[1];
23 
24   // out[0] is output to multiply against gradient v, size (Q)
25   CeedScalar *vg = out[0];
26 
27   // Quadrature point loop
28   CeedPragmaSIMD
29   for (CeedInt i=0; i<Q; i++) {
30     vg[i] = ug[i] * q_data[i];
31   } // End of Quadrature Point Loop
32 
33   return CEED_ERROR_SUCCESS;
34 }
35 
36 #endif // poisson1dapply_h
37