xref: /libCEED/include/ceed/jit-source/gallery/ceed-poisson1dbuild.h (revision 33490f6ef26c584470cb54133cdd71c442f1841b)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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 **/
11c0b5abf0SJeremy L Thompson #include <ceed/types.h>
12c9c2c079SJeremy L Thompson 
Poisson1DBuild(void * ctx,const CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)132b730f8bSJeremy L Thompson CEED_QFUNCTION(Poisson1DBuild)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
14a0154adeSJed Brown   // At every quadrature point, compute w/det(J).adj(J).adj(J)^T and store
15a0154adeSJed Brown   // the symmetric part of the result.
16a0154adeSJed Brown 
17a0154adeSJed Brown   // in[0] is Jacobians, size (Q)
18a0154adeSJed Brown   // in[1] is quadrature weights, size (Q)
19a0154adeSJed Brown   const CeedScalar *J = in[0], *w = in[1];
20a0154adeSJed Brown 
21a0154adeSJed Brown   // out[0] is qdata, size (Q)
22a0154adeSJed Brown   CeedScalar *q_data = out[0];
23a0154adeSJed Brown 
24a0154adeSJed Brown   // Quadrature point loop
252b730f8bSJeremy L Thompson   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { q_data[i] = w[i] / J[i]; }  // End of Quadrature Point Loop
26a0154adeSJed Brown   return CEED_ERROR_SUCCESS;
27a0154adeSJed Brown }
28