xref: /libCEED/include/ceed/jit-source/gallery/ceed-poisson1dbuild.h (revision 2ba3f748b44edc091d4082cfe571655b6bd7a424)
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 building the geometric data for the 1D Poisson operator
10 **/
11 
12 #ifndef poisson1dbuild_h
13 #define poisson1dbuild_h
14 
15 #include <ceed.h>
16 
17 CEED_QFUNCTION(Poisson1DBuild)(void *ctx, const CeedInt Q,
18                                const CeedScalar *const *in,
19                                CeedScalar *const *out) {
20   // At every quadrature point, compute w/det(J).adj(J).adj(J)^T and store
21   // the symmetric part of the result.
22 
23   // in[0] is Jacobians, size (Q)
24   // in[1] is quadrature weights, size (Q)
25   const CeedScalar *J = in[0], *w = in[1];
26 
27   // out[0] is qdata, size (Q)
28   CeedScalar *q_data = out[0];
29 
30   // Quadrature point loop
31   CeedPragmaSIMD
32   for (CeedInt i=0; i<Q; i++) {
33     q_data[i] = w[i] / J[i];
34   } // End of Quadrature Point Loop
35 
36   return CEED_ERROR_SUCCESS;
37 }
38 
39 #endif // poisson1dbuild_h
40