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