1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors. 21b95d8c6SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 31b95d8c6SJeremy L Thompson // 41b95d8c6SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 51b95d8c6SJeremy L Thompson // 61b95d8c6SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 71b95d8c6SJeremy L Thompson 81b95d8c6SJeremy L Thompson #include <ceed/types.h> 91b95d8c6SJeremy L Thompson 101b95d8c6SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 111b95d8c6SJeremy L Thompson const CeedScalar *weight = in[0], *J = in[1]; 121b95d8c6SJeremy L Thompson CeedScalar *rho = out[0]; 131b95d8c6SJeremy L Thompson 141b95d8c6SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 151b95d8c6SJeremy L Thompson rho[i] = weight[i] * (J[i + Q * 0] * J[i + Q * 3] - J[i + Q * 1] * J[i + Q * 2]); 161b95d8c6SJeremy L Thompson } 171b95d8c6SJeremy L Thompson return 0; 181b95d8c6SJeremy L Thompson } 191b95d8c6SJeremy L Thompson 201b95d8c6SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 211b95d8c6SJeremy L Thompson CeedInt num_comp = *(CeedInt *)ctx; 221b95d8c6SJeremy L Thompson const CeedScalar *rho = in[0], *u = in[1]; 231b95d8c6SJeremy L Thompson CeedScalar *v = out[0]; 241b95d8c6SJeremy L Thompson 251b95d8c6SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 261b95d8c6SJeremy L Thompson for (CeedInt c = 0; c < num_comp; c++) v[i + c * Q] = rho[i] * c * u[i + c * Q]; 271b95d8c6SJeremy L Thompson } 281b95d8c6SJeremy L Thompson return 0; 291b95d8c6SJeremy L Thompson } 30