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 // clang-format off 10 // Note - ceed/types.h should be used over ceed.h 11 #include <ceed.h> 12 // Note - system headers like math.h and std*.h should be guarded 13 #ifndef CEED_RUNNING_JIT_PASS 14 # include <math.h> 15 #endif 16 17 #include "t406-qfunction-helper.h" 18 // Test duplicate includes of guarded files 19 // Also test include path with "/../" 20 #include "../tests/t406-qfunction-helper.h" 21 // Also test include path with "/../../" 22 #include "../../libCEED/tests/t406-qfunction-helper.h" 23 # include "t406-qfunction-scales.h" 24 // clang-format on 25 26 CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 27 const CeedScalar *w = in[0]; 28 CeedScalar *q_data = out[0]; 29 for (CeedInt i = 0; i < Q; i++) { 30 q_data[i] = w[i]; 31 } 32 return 0; 33 } 34 35 CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 36 const CeedScalar *q_data = in[0], *u = in[1]; 37 CeedScalar *v = out[0]; 38 for (CeedInt i = 0; i < Q; i++) { 39 v[i] = q_data[i] * (times_two(u[i]) + times_three(u[i])) * sqrt(1.0 * SCALE_TWO); 40 } 41 return 0; 42 } 43