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