15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 31da99368SJeremy L Thompson // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 51da99368SJeremy L Thompson // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 71da99368SJeremy L Thompson 8*c0b5abf0SJeremy L Thompson #include <ceed/types.h> 9c9c2c079SJeremy L Thompson 102b730f8bSJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 111da99368SJeremy L Thompson const CeedScalar *weight = in[0], *dxdX = in[1]; 121da99368SJeremy L Thompson CeedScalar *rho = out[0]; 131da99368SJeremy L Thompson 141da99368SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 151da99368SJeremy L Thompson rho[i] = weight[i] * dxdX[i]; 161da99368SJeremy L Thompson } 171da99368SJeremy L Thompson return 0; 181da99368SJeremy L Thompson } 191da99368SJeremy L Thompson 202b730f8bSJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 212b730f8bSJeremy L Thompson const CeedScalar *rho = in[0], (*u)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1]; 221da99368SJeremy L Thompson CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 231da99368SJeremy L Thompson 241da99368SJeremy L Thompson for (CeedInt i = 0; i < Q; i++) { 251da99368SJeremy L Thompson v[0][i] = rho[i] * u[0][i]; 261da99368SJeremy L Thompson v[1][i] = rho[i] * u[1][i]; 271da99368SJeremy L Thompson } 281da99368SJeremy L Thompson return 0; 291da99368SJeremy L Thompson } 30