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 CEED_QFUNCTION(Scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in, 16 CeedScalar *const *out) { 17 // Ctx holds field size 18 const CeedInt size = *(CeedInt *)ctx; 19 20 // in[0] is input, size (Q*size) 21 // in[1] is scaling factor, size (Q*size) 22 const CeedScalar *input = in[0]; 23 const CeedScalar *scale = in[1]; 24 // out[0] is output, size (Q*size) 25 CeedScalar *output = out[0]; 26 27 // Quadrature point loop 28 CeedPragmaSIMD 29 for (CeedInt i=0; i<Q*size; i++) { 30 output[i] = input[i] * scale[i]; 31 } // End of Quadrature Point Loop 32 return 0; 33 } 34 35 #endif // scale_h 36