xref: /libCEED/tests/t591-operator.h (revision 5aed82e4fa97acf4ba24a7f10a35f5303a6798e0)
1*5aed82e4SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
248acf710SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
348acf710SJeremy L Thompson //
448acf710SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
548acf710SJeremy L Thompson //
648acf710SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
748acf710SJeremy L Thompson 
848acf710SJeremy L Thompson #include <ceed.h>
948acf710SJeremy L Thompson 
1048acf710SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
1148acf710SJeremy L Thompson   const CeedScalar(*J)[2][CEED_Q_VLA] = (const CeedScalar(*)[2][CEED_Q_VLA])in[0];
1248acf710SJeremy L Thompson   const CeedScalar *w                 = in[1];
1348acf710SJeremy L Thompson   CeedScalar       *q_data            = out[0];
1448acf710SJeremy L Thompson 
1548acf710SJeremy L Thompson   // Quadrature point loop
1648acf710SJeremy 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]; }
1748acf710SJeremy L Thompson   return 0;
1848acf710SJeremy L Thompson }
1948acf710SJeremy L Thompson 
2048acf710SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) {
2148acf710SJeremy L Thompson   const CeedScalar *u = in[0], *rho = in[1];
2248acf710SJeremy L Thompson   CeedScalar       *v = out[0];
2348acf710SJeremy L Thompson 
2448acf710SJeremy L Thompson   // Quadrature point loop
2548acf710SJeremy L Thompson   CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { v[i] = rho[i] * u[i]; }
2648acf710SJeremy L Thompson   return 0;
2748acf710SJeremy L Thompson }
28