xref: /libCEED/tests/t409-qfunction.h (revision 3d8e882215d238700cdceb37404f76ca7fa24eaa)
1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3441428dfSJeremy L Thompson //
4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5441428dfSJeremy L Thompson //
6*3d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7441428dfSJeremy L Thompson 
8441428dfSJeremy L Thompson CEED_QFUNCTION(scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in,
9441428dfSJeremy L Thompson                       CeedScalar *const *out) {
10441428dfSJeremy L Thompson   CeedScalar *scale = (CeedScalar *)ctx;
11441428dfSJeremy L Thompson   const CeedScalar *u = in[0];
12441428dfSJeremy L Thompson   CeedScalar *v = out[0];
13441428dfSJeremy L Thompson 
14441428dfSJeremy L Thompson   for (CeedInt i=0; i<Q; i++) {
15441428dfSJeremy L Thompson     v[i] = scale[1] * u[i];
16441428dfSJeremy L Thompson   }
17441428dfSJeremy L Thompson   scale[0] = 42;
18441428dfSJeremy L Thompson 
19441428dfSJeremy L Thompson   return 0;
20441428dfSJeremy L Thompson }
21