13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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*c9c2c079SJeremy L Thompson #include <ceed.h> 9*c9c2c079SJeremy L Thompson 101da99368SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, 111da99368SJeremy L Thompson const CeedScalar *const *in, 121da99368SJeremy L Thompson CeedScalar *const *out) { 131da99368SJeremy L Thompson const CeedScalar *weight = in[0], *dxdX = in[1]; 141da99368SJeremy L Thompson CeedScalar *rho = out[0]; 151da99368SJeremy L Thompson 161da99368SJeremy L Thompson for (CeedInt i=0; i<Q; i++) { 171da99368SJeremy L Thompson rho[i] = weight[i] * dxdX[i]; 181da99368SJeremy L Thompson } 191da99368SJeremy L Thompson return 0; 201da99368SJeremy L Thompson } 211da99368SJeremy L Thompson 221da99368SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, 231da99368SJeremy L Thompson CeedScalar *const *out) { 241da99368SJeremy L Thompson // *INDENT-OFF* 251da99368SJeremy L Thompson const CeedScalar *rho = in[0], 261da99368SJeremy L Thompson (*u)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[1]; 271da99368SJeremy L Thompson CeedScalar (*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 281da99368SJeremy L Thompson // *INDENT-ON* 291da99368SJeremy L Thompson 301da99368SJeremy L Thompson for (CeedInt i=0; i<Q; i++) { 311da99368SJeremy L Thompson v[0][i] = rho[i] * u[0][i]; 321da99368SJeremy L Thompson v[1][i] = rho[i] * u[1][i]; 331da99368SJeremy L Thompson } 341da99368SJeremy L Thompson return 0; 351da99368SJeremy L Thompson } 36