xref: /libCEED/include/ceed/jit-source/gallery/ceed-poisson1dbuild.h (revision a0154adecfab8547cdc0febbbf40ac009dbe9d1d)
1*a0154adeSJed Brown // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*a0154adeSJed Brown // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*a0154adeSJed Brown //
4*a0154adeSJed Brown // SPDX-License-Identifier: BSD-2-Clause
5*a0154adeSJed Brown //
6*a0154adeSJed Brown // This file is part of CEED:  http://github.com/ceed
7*a0154adeSJed Brown 
8*a0154adeSJed Brown /**
9*a0154adeSJed Brown   @brief Ceed QFunction for building the geometric data for the 1D Poisson operator
10*a0154adeSJed Brown **/
11*a0154adeSJed Brown 
12*a0154adeSJed Brown #ifndef poisson1dbuild_h
13*a0154adeSJed Brown #define poisson1dbuild_h
14*a0154adeSJed Brown 
15*a0154adeSJed Brown CEED_QFUNCTION(Poisson1DBuild)(void *ctx, const CeedInt Q,
16*a0154adeSJed Brown                                const CeedScalar *const *in,
17*a0154adeSJed Brown                                CeedScalar *const *out) {
18*a0154adeSJed Brown   // At every quadrature point, compute w/det(J).adj(J).adj(J)^T and store
19*a0154adeSJed Brown   // the symmetric part of the result.
20*a0154adeSJed Brown 
21*a0154adeSJed Brown   // in[0] is Jacobians, size (Q)
22*a0154adeSJed Brown   // in[1] is quadrature weights, size (Q)
23*a0154adeSJed Brown   const CeedScalar *J = in[0], *w = in[1];
24*a0154adeSJed Brown 
25*a0154adeSJed Brown   // out[0] is qdata, size (Q)
26*a0154adeSJed Brown   CeedScalar *q_data = out[0];
27*a0154adeSJed Brown 
28*a0154adeSJed Brown   // Quadrature point loop
29*a0154adeSJed Brown   CeedPragmaSIMD
30*a0154adeSJed Brown   for (CeedInt i=0; i<Q; i++) {
31*a0154adeSJed Brown     q_data[i] = w[i] / J[i];
32*a0154adeSJed Brown   } // End of Quadrature Point Loop
33*a0154adeSJed Brown 
34*a0154adeSJed Brown   return CEED_ERROR_SUCCESS;
35*a0154adeSJed Brown }
36*a0154adeSJed Brown 
37*a0154adeSJed Brown #endif // poisson1dbuild_h
38