15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, 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 building the geometric data for the 3D mass matrix 10a0154adeSJed Brown **/ 11a0154adeSJed Brown 12*c0b5abf0SJeremy L Thompson #include <ceed/types.h> 13c9c2c079SJeremy L Thompson 142b730f8bSJeremy L Thompson CEED_QFUNCTION(Mass3DBuild)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 15a0154adeSJed Brown // in[0] is Jacobians with shape [2, nc=3, Q] 16a0154adeSJed Brown // in[1] is quadrature weights, size (Q) 172b730f8bSJeremy L Thompson const CeedScalar(*J)[3][CEED_Q_VLA] = (const CeedScalar(*)[3][CEED_Q_VLA])in[0], *w = in[1]; 18a0154adeSJed Brown // out[0] is quadrature data, size (Q) 19a0154adeSJed Brown CeedScalar *q_data = out[0]; 20a0154adeSJed Brown 21a0154adeSJed Brown // Quadrature point loop 222b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { 232b730f8bSJeremy L Thompson q_data[i] = (J[0][0][i] * (J[1][1][i] * J[2][2][i] - J[1][2][i] * J[2][1][i]) - J[0][1][i] * (J[1][0][i] * J[2][2][i] - J[1][2][i] * J[2][0][i]) + 242b730f8bSJeremy L Thompson J[0][2][i] * (J[1][0][i] * J[2][1][i] - J[1][1][i] * J[2][0][i])) * 252b730f8bSJeremy L Thompson w[i]; 26a0154adeSJed Brown } // End of Quadrature Point Loop 27a0154adeSJed Brown 28a0154adeSJed Brown return CEED_ERROR_SUCCESS; 29a0154adeSJed Brown } 30