1 // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2 // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3 // 4 // SPDX-License-Identifier: BSD-2-Clause 5 // 6 // This file is part of CEED: http://github.com/ceed 7 8 // Note: intentionally testing strange spacing in '#include's 9 #include <ceed.h> 10 #include <math.h> 11 12 #include "t406-qfunction-helper.h" 13 #include "t406-qfunction-scales.h" 14 15 CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 16 const CeedScalar *w = in[0]; 17 CeedScalar *q_data = out[0]; 18 for (CeedInt i = 0; i < Q; i++) { 19 q_data[i] = w[i]; 20 } 21 return 0; 22 } 23 24 CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 25 const CeedScalar *q_data = in[0], *u = in[1]; 26 CeedScalar *v = out[0]; 27 for (CeedInt i = 0; i < Q; i++) { 28 v[i] = q_data[i] * (times_two(u[i]) + times_three(u[i])) * sqrt(1.0 * SCALE_TWO); 29 } 30 return 0; 31 } 32