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