xref: /libCEED/tests/t400-qfunction.h (revision d1d35e2f02dc969aee8debf3fd943dd784aa847a)
14d537eeaSYohann // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
24d537eeaSYohann // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
34d537eeaSYohann // All Rights reserved. See files LICENSE and NOTICE for details.
44d537eeaSYohann //
54d537eeaSYohann // This file is part of CEED, a collection of benchmarks, miniapps, software
64d537eeaSYohann // libraries and APIs for efficient high-order finite element and spectral
74d537eeaSYohann // element discretizations for exascale applications. For more information and
84d537eeaSYohann // source code availability see http://github.com/ceed.
94d537eeaSYohann //
104d537eeaSYohann // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
114d537eeaSYohann // a collaborative effort of two U.S. Department of Energy organizations (Office
124d537eeaSYohann // of Science and the National Nuclear Security Administration) responsible for
134d537eeaSYohann // the planning and preparation of a capable exascale ecosystem, including
144d537eeaSYohann // software, applications, hardware, advanced system engineering and early
154d537eeaSYohann // testbed platforms, in support of the nation's exascale computing imperative.
164d537eeaSYohann 
174d537eeaSYohann CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q,
184d537eeaSYohann                       const CeedScalar *const *in,
194d537eeaSYohann                       CeedScalar *const *out) {
204d537eeaSYohann   const CeedScalar *w = in[0];
21*d1d35e2fSjeremylt   CeedScalar *q_data = out[0];
224d537eeaSYohann   for (CeedInt i=0; i<Q; i++) {
23*d1d35e2fSjeremylt     q_data[i] = w[i];
244d537eeaSYohann   }
254d537eeaSYohann   return 0;
264d537eeaSYohann }
274d537eeaSYohann 
284d537eeaSYohann CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in,
294d537eeaSYohann                      CeedScalar *const *out) {
30*d1d35e2fSjeremylt   const CeedScalar *q_data = in[0], *u = in[1];
314d537eeaSYohann   CeedScalar *v = out[0];
324d537eeaSYohann   for (CeedInt i=0; i<Q; i++) {
33*d1d35e2fSjeremylt     v[i] = q_data[i] * u[i];
344d537eeaSYohann   }
354d537eeaSYohann   return 0;
364d537eeaSYohann }
37