xref: /libCEED/tests/t409-qfunction.h (revision c9c2c07970382857cc7b4a28d359710237b91a3e)
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 #include <ceed.h>
9 
10 CEED_QFUNCTION(scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in,
11                       CeedScalar *const *out) {
12   CeedScalar *scale = (CeedScalar *)ctx;
13   const CeedScalar *u = in[0];
14   CeedScalar *v = out[0];
15 
16   for (CeedInt i=0; i<Q; i++) {
17     v[i] = scale[1] * u[i];
18   }
19   scale[0] = 42;
20 
21   return 0;
22 }
23