xref: /libCEED/include/ceed/jit-source/gallery/ceed-poisson1dbuild.h (revision 24a65d3da2f623912f26b42c0b9ba6f37de25307)
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 CEED_POISSON1DBUILD_H
13 #define CEED_POISSON1DBUILD_H
14 
15 #include <ceed.h>
16 
17 CEED_QFUNCTION(Poisson1DBuild)(void *ctx, const CeedInt Q, const CeedScalar *const *in, 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 for (CeedInt i = 0; i < Q; i++) { q_data[i] = w[i] / J[i]; }  // End of Quadrature Point Loop
30 
31   return CEED_ERROR_SUCCESS;
32 }
33 
34 #endif  // CEED_POISSON1DBUILD_H
35