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