1*1b95d8c6SJeremy L Thompson // Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and other CEED contributors. 2*1b95d8c6SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*1b95d8c6SJeremy L Thompson // 4*1b95d8c6SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5*1b95d8c6SJeremy L Thompson // 6*1b95d8c6SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7*1b95d8c6SJeremy L Thompson 8*1b95d8c6SJeremy L Thompson #include <ceed/types.h> 9*1b95d8c6SJeremy L Thompson 10*1b95d8c6SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 11*1b95d8c6SJeremy L Thompson const CeedScalar *weight = in[0], *J = in[1]; 12*1b95d8c6SJeremy L Thompson CeedScalar *rho = out[0]; 13*1b95d8c6SJeremy L Thompson 14*1b95d8c6SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 15*1b95d8c6SJeremy L Thompson rho[i] = weight[i] * (J[i + Q * 0] * J[i + Q * 3] - J[i + Q * 1] * J[i + Q * 2]); 16*1b95d8c6SJeremy L Thompson } 17*1b95d8c6SJeremy L Thompson return 0; 18*1b95d8c6SJeremy L Thompson } 19*1b95d8c6SJeremy L Thompson 20*1b95d8c6SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 21*1b95d8c6SJeremy L Thompson CeedInt num_comp = *(CeedInt *)ctx; 22*1b95d8c6SJeremy L Thompson const CeedScalar *rho = in[0], *u = in[1]; 23*1b95d8c6SJeremy L Thompson CeedScalar *v = out[0]; 24*1b95d8c6SJeremy L Thompson 25*1b95d8c6SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 26*1b95d8c6SJeremy L Thompson for (CeedInt c = 0; c < num_comp; c++) v[i + c * Q] = rho[i] * c * u[i + c * Q]; 27*1b95d8c6SJeremy L Thompson } 28*1b95d8c6SJeremy L Thompson return 0; 29*1b95d8c6SJeremy L Thompson } 30