1 // Copyright (c) 2017-2022, 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 /** 9 @brief Scaling QFunction that scales inputs 10 **/ 11 12 #ifndef scale_h 13 #define scale_h 14 15 #include <ceed.h> 16 17 CEED_QFUNCTION(Scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in, 18 CeedScalar *const *out) { 19 // Ctx holds field size 20 const CeedInt size = *(CeedInt *)ctx; 21 22 // in[0] is input, size (Q*size) 23 // in[1] is scaling factor, size (Q*size) 24 const CeedScalar *input = in[0]; 25 const CeedScalar *scale = in[1]; 26 // out[0] is output, size (Q*size) 27 CeedScalar *output = out[0]; 28 29 // Quadrature point loop 30 CeedPragmaSIMD 31 for (CeedInt i=0; i<Q*size; i++) { 32 output[i] = input[i] * scale[i]; 33 } // End of Quadrature Point Loop 34 return 0; 35 } 36 37 #endif // scale_h 38