xref: /libCEED/tests/t409-qfunction.h (revision 441428df2c2036d88c450263ab42e401d8838e73)
1*441428dfSJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*441428dfSJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*441428dfSJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details.
4*441428dfSJeremy L Thompson //
5*441428dfSJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software
6*441428dfSJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral
7*441428dfSJeremy L Thompson // element discretizations for exascale applications. For more information and
8*441428dfSJeremy L Thompson // source code availability see http://github.com/ceed.
9*441428dfSJeremy L Thompson //
10*441428dfSJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*441428dfSJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office
12*441428dfSJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for
13*441428dfSJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including
14*441428dfSJeremy L Thompson // software, applications, hardware, advanced system engineering and early
15*441428dfSJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative.
16*441428dfSJeremy L Thompson 
17*441428dfSJeremy L Thompson CEED_QFUNCTION(scale)(void *ctx, const CeedInt Q, const CeedScalar *const *in,
18*441428dfSJeremy L Thompson                       CeedScalar *const *out) {
19*441428dfSJeremy L Thompson   CeedScalar *scale = (CeedScalar *)ctx;
20*441428dfSJeremy L Thompson   const CeedScalar *u = in[0];
21*441428dfSJeremy L Thompson   CeedScalar *v = out[0];
22*441428dfSJeremy L Thompson 
23*441428dfSJeremy L Thompson   for (CeedInt i=0; i<Q; i++) {
24*441428dfSJeremy L Thompson     v[i] = scale[1] * u[i];
25*441428dfSJeremy L Thompson   }
26*441428dfSJeremy L Thompson   scale[0] = 42;
27*441428dfSJeremy L Thompson 
28*441428dfSJeremy L Thompson   return 0;
29*441428dfSJeremy L Thompson }
30