1*becbf5cdSJeremy L Thompson // Copyright (c) 2017-2026, Lawrence Livermore National Security, LLC and other CEED contributors. 2*becbf5cdSJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*becbf5cdSJeremy L Thompson // 4*becbf5cdSJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 5*becbf5cdSJeremy L Thompson // 6*becbf5cdSJeremy L Thompson // This file is part of CEED: http://github.com/ceed 7*becbf5cdSJeremy L Thompson 8*becbf5cdSJeremy L Thompson /** 9*becbf5cdSJeremy L Thompson @brief Scaling QFunction that scales inputs 10*becbf5cdSJeremy L Thompson **/ 11*becbf5cdSJeremy L Thompson #include <ceed/types.h> 12*becbf5cdSJeremy L Thompson 13*becbf5cdSJeremy L Thompson CEED_QFUNCTION(ScaleScalar)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 14*becbf5cdSJeremy L Thompson // Ctx holds field size 15*becbf5cdSJeremy L Thompson const CeedInt size = *(CeedInt *)ctx; 16*becbf5cdSJeremy L Thompson 17*becbf5cdSJeremy L Thompson // in[0] is input, size (Q*size) 18*becbf5cdSJeremy L Thompson // in[1] is scaling factor, size (Q*size) 19*becbf5cdSJeremy L Thompson const CeedScalar *input = in[0]; 20*becbf5cdSJeremy L Thompson const CeedScalar *scale = in[1]; 21*becbf5cdSJeremy L Thompson // out[0] is output, size (Q*size) 22*becbf5cdSJeremy L Thompson CeedScalar *output = out[0]; 23*becbf5cdSJeremy L Thompson 24*becbf5cdSJeremy L Thompson // Quadrature point loop 25*becbf5cdSJeremy L Thompson CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { 26*becbf5cdSJeremy L Thompson for (CeedInt j = 0; j < size; j++) output[i + j * Q] = input[i + j * Q] * scale[i]; 27*becbf5cdSJeremy L Thompson } // End of Quadrature Point Loop 28*becbf5cdSJeremy L Thompson return 0; 29*becbf5cdSJeremy L Thompson } 30