xref: /libCEED/tests/t591-operator.h (revision 48acf7109003d10be9ba6e2ea1703bbbf207ad3b)
1*48acf710SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2*48acf710SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3*48acf710SJeremy L Thompson //
4*48acf710SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
5*48acf710SJeremy L Thompson //
6*48acf710SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
7*48acf710SJeremy L Thompson 
8*48acf710SJeremy L Thompson #include <ceed.h>
9*48acf710SJeremy L Thompson 
10*48acf710SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
11*48acf710SJeremy L Thompson   const CeedScalar(*J)[2][CEED_Q_VLA] = (const CeedScalar(*)[2][CEED_Q_VLA])in[0];
12*48acf710SJeremy L Thompson   const CeedScalar *w                 = in[1];
13*48acf710SJeremy L Thompson   CeedScalar       *q_data            = out[0];
14*48acf710SJeremy L Thompson 
15*48acf710SJeremy L Thompson   // Quadrature point loop
16*48acf710SJeremy L Thompson   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { q_data[i] = (J[0][0][i] * J[1][1][i] - J[0][1][i] * J[1][0][i]) * w[i]; }
17*48acf710SJeremy L Thompson   return 0;
18*48acf710SJeremy L Thompson }
19*48acf710SJeremy L Thompson 
20*48acf710SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
21*48acf710SJeremy L Thompson   const CeedScalar *u = in[0], *rho = in[1];
22*48acf710SJeremy L Thompson   CeedScalar       *v = out[0];
23*48acf710SJeremy L Thompson 
24*48acf710SJeremy L Thompson   // Quadrature point loop
25*48acf710SJeremy L Thompson   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { v[i] = rho[i] * u[i]; }
26*48acf710SJeremy L Thompson   return 0;
27*48acf710SJeremy L Thompson }
28