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 applying the 2D Poisson operator 10a0154adeSJed Brown **/ 11a0154adeSJed Brown 12a0154adeSJed Brown #ifndef poisson2dapply_h 13a0154adeSJed Brown #define poisson2dapply_h 14a0154adeSJed Brown 15*c9c2c079SJeremy L Thompson #include <ceed.h> 16*c9c2c079SJeremy L Thompson 17a0154adeSJed Brown CEED_QFUNCTION(Poisson2DApply)(void *ctx, const CeedInt Q, 18a0154adeSJed Brown const CeedScalar *const *in, 19a0154adeSJed Brown CeedScalar *const *out) { 20a0154adeSJed Brown // *INDENT-OFF* 21a0154adeSJed Brown // in[0] is gradient u, shape [2, nc=1, Q] 22a0154adeSJed Brown // in[1] is quadrature data, size (3*Q) 23a0154adeSJed Brown const CeedScalar (*ug)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0], 24a0154adeSJed Brown (*q_data)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1]; 25a0154adeSJed Brown // out[0] is output to multiply against gradient v, shape [2, nc=1, Q] 26a0154adeSJed Brown CeedScalar (*vg)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 27a0154adeSJed Brown // *INDENT-ON* 28a0154adeSJed Brown 29a0154adeSJed Brown const CeedInt dim = 2; 30a0154adeSJed Brown 31a0154adeSJed Brown // Quadrature point loop 32a0154adeSJed Brown CeedPragmaSIMD 33a0154adeSJed Brown for (CeedInt i=0; i<Q; i++) { 34a0154adeSJed Brown // Read qdata (dXdxdXdxT symmetric matrix) 35a0154adeSJed Brown // Stored in Voigt convention 36a0154adeSJed Brown // 0 2 37a0154adeSJed Brown // 2 1 38a0154adeSJed Brown // *INDENT-OFF* 39a0154adeSJed Brown const CeedScalar dXdxdXdxT[2][2] = {{q_data[0][i], 40a0154adeSJed Brown q_data[2][i]}, 41a0154adeSJed Brown {q_data[2][i], 42a0154adeSJed Brown q_data[1][i]} 43a0154adeSJed Brown }; 44a0154adeSJed Brown // *INDENT-ON* 45a0154adeSJed Brown 46a0154adeSJed Brown // Apply Poisson operator 47a0154adeSJed Brown // j = direction of vg 48a0154adeSJed Brown for (CeedInt j=0; j<dim; j++) 49a0154adeSJed Brown vg[j][i] = (ug[0][i] * dXdxdXdxT[0][j] + 50a0154adeSJed Brown ug[1][i] * dXdxdXdxT[1][j]); 51a0154adeSJed Brown } // End of Quadrature Point Loop 52a0154adeSJed Brown 53a0154adeSJed Brown return CEED_ERROR_SUCCESS; 54a0154adeSJed Brown } 55a0154adeSJed Brown 56a0154adeSJed Brown #endif // poisson2dapply_h 57