xref: /libCEED/tests/t409-qfunction.h (revision c9c2c07970382857cc7b4a28d359710237b91a3e)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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*c9c2c079SJeremy L Thompson #include <ceed.h>
9*c9c2c079SJeremy L Thompson 
10441428dfSJeremy L Thompson CEED_QFUNCTION(scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in,
11441428dfSJeremy L Thompson                       CeedScalar *const *out) {
12441428dfSJeremy L Thompson   CeedScalar *scale = (CeedScalar *)ctx;
13441428dfSJeremy L Thompson   const CeedScalar *u = in[0];
14441428dfSJeremy L Thompson   CeedScalar *v = out[0];
15441428dfSJeremy L Thompson 
16441428dfSJeremy L Thompson   for (CeedInt i=0; i<Q; i++) {
17441428dfSJeremy L Thompson     v[i] = scale[1] * u[i];
18441428dfSJeremy L Thompson   }
19441428dfSJeremy L Thompson   scale[0] = 42;
20441428dfSJeremy L Thompson 
21441428dfSJeremy L Thompson   return 0;
22441428dfSJeremy L Thompson }
23