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