13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, 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. 377841947SLeila Ghaffari // 43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 577841947SLeila Ghaffari // 63d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 777841947SLeila Ghaffari 877841947SLeila Ghaffari /// @file 977841947SLeila Ghaffari /// Mass operator for Navier-Stokes example using PETSc 1077841947SLeila Ghaffari 1177841947SLeila Ghaffari #ifndef mass_h 1277841947SLeila Ghaffari #define mass_h 1377841947SLeila Ghaffari 14ba6664aeSJames Wright #include <ceed.h> 15c9c2c079SJeremy L Thompson #include <math.h> 1677841947SLeila Ghaffari 1777841947SLeila Ghaffari // ***************************************************************************** 1877841947SLeila Ghaffari // This QFunction applies the mass matrix to five interlaced fields. 1977841947SLeila Ghaffari // 2077841947SLeila Ghaffari // Inputs: 2177841947SLeila Ghaffari // u - Input vector at quadrature points 2277841947SLeila Ghaffari // q_data - Quadrature weights 2377841947SLeila Ghaffari // 2477841947SLeila Ghaffari // Output: 2577841947SLeila Ghaffari // v - Output vector at quadrature points 2677841947SLeila Ghaffari // 2777841947SLeila Ghaffari // ***************************************************************************** 282b730f8bSJeremy L Thompson CEED_QFUNCTION(Mass)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { 2977841947SLeila Ghaffari // Inputs 30*46603fc5SJames Wright const CeedScalar(*u)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0]; 31*46603fc5SJames Wright const CeedScalar(*q_data) = in[1]; 3277841947SLeila Ghaffari 3377841947SLeila Ghaffari // Outputs 3477841947SLeila Ghaffari CeedScalar(*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 3577841947SLeila Ghaffari 362b730f8bSJeremy L Thompson CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) { 3777841947SLeila Ghaffari v[0][i] = q_data[i] * u[0][i]; 3877841947SLeila Ghaffari v[1][i] = q_data[i] * u[1][i]; 3977841947SLeila Ghaffari v[2][i] = q_data[i] * u[2][i]; 4077841947SLeila Ghaffari v[3][i] = q_data[i] * u[3][i]; 4177841947SLeila Ghaffari v[4][i] = q_data[i] * u[4][i]; 4277841947SLeila Ghaffari } 4377841947SLeila Ghaffari return 0; 4477841947SLeila Ghaffari } 4577841947SLeila Ghaffari 4677841947SLeila Ghaffari // ***************************************************************************** 4777841947SLeila Ghaffari 4877841947SLeila Ghaffari #endif // mass_h 49