1 // Copyright (c) 2017-2025, 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 "output/../../tests/t406-qfunction-helper.h" 23 # include "t406-qfunction-scales.h" 24 // clang-format on 25 26 // Extra define set via CeedAddJitDefine() during JiT 27 #ifndef CEED_RUNNING_JIT_PASS 28 #define COMPILER_DEFINED_SCALE 42 29 #endif 30 31 CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 32 const CeedScalar *w = in[0]; 33 CeedScalar *q_data = out[0]; 34 for (CeedInt i = 0; i < Q; i++) { 35 q_data[i] = w[i]; 36 } 37 return 0; 38 } 39 40 CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 41 const CeedScalar *q_data = in[0], *u = in[1]; 42 CeedScalar *v = out[0]; 43 for (CeedInt i = 0; i < Q; i++) { 44 v[i] = q_data[i] * COMPILER_DEFINED_SCALE * (times_two(u[i]) + times_three(u[i])) * sqrt(1.0 * SCALE_TWO); 45 } 46 return 0; 47 } 48