xref: /libCEED/tests/t400-qfunction.h (revision d4cc18453651bd0f94c1a2e078b2646a92dafdcc)
1*9ba83ac0SJeremy L Thompson // Copyright (c) 2017-2026, 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.
34d537eeaSYohann //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
54d537eeaSYohann //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
74d537eeaSYohann 
8c0b5abf0SJeremy L Thompson #include <ceed/types.h>
9c9c2c079SJeremy L Thompson 
setup(void * ctx,const CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)102b730f8bSJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
114d537eeaSYohann   const CeedScalar *w      = in[0];
12d1d35e2fSjeremylt   CeedScalar       *q_data = out[0];
134d537eeaSYohann   for (CeedInt i = 0; i < Q; i++) {
14d1d35e2fSjeremylt     q_data[i] = w[i];
154d537eeaSYohann   }
164d537eeaSYohann   return 0;
174d537eeaSYohann }
184d537eeaSYohann 
mass(void * ctx,const CeedInt Q,const CeedScalar * const * in,CeedScalar * const * out)192b730f8bSJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
20d1d35e2fSjeremylt   const CeedScalar *q_data = in[0], *u = in[1];
214d537eeaSYohann   CeedScalar       *v = out[0];
224d537eeaSYohann   for (CeedInt i = 0; i < Q; i++) {
23d1d35e2fSjeremylt     v[i] = q_data[i] * u[i];
244d537eeaSYohann   }
254d537eeaSYohann   return 0;
264d537eeaSYohann }
27