xref: /libCEED/tests/t409-qfunction.h (revision c0b5abf0f23b15c4f0ada76f8abe9f8d2b6fa247)
15aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3441428dfSJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5441428dfSJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7441428dfSJeremy L Thompson 
8*c0b5abf0SJeremy L Thompson #include <ceed/types.h>
9c9c2c079SJeremy L Thompson 
102b730f8bSJeremy L Thompson CEED_QFUNCTION(scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
11441428dfSJeremy L Thompson   CeedScalar       *scale = (CeedScalar *)ctx;
12441428dfSJeremy L Thompson   const CeedScalar *u     = in[0];
13441428dfSJeremy L Thompson   CeedScalar       *v     = out[0];
14441428dfSJeremy L Thompson 
15441428dfSJeremy L Thompson   for (CeedInt i = 0; i < Q; i++) {
16441428dfSJeremy L Thompson     v[i] = scale[1] * u[i];
17441428dfSJeremy L Thompson   }
18441428dfSJeremy L Thompson   scale[0] = 42;
19441428dfSJeremy L Thompson 
20441428dfSJeremy L Thompson   return 0;
21441428dfSJeremy L Thompson }
22