1 // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at 2 // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights 3 // reserved. See files LICENSE and NOTICE for details. 4 // 5 // This file is part of CEED, a collection of benchmarks, miniapps, software 6 // libraries and APIs for efficient high-order finite element and spectral 7 // element discretizations for exascale applications. For more information and 8 // source code availability see http://github.com/ceed. 9 // 10 // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11 // a collaborative effort of two U.S. Department of Energy organizations (Office 12 // of Science and the National Nuclear Security Administration) responsible for 13 // the planning and preparation of a capable exascale ecosystem, including 14 // software, applications, hardware, advanced system engineering and early 15 // testbed platforms, in support of the nation's exascale computing imperative. 16 17 /// @file 18 /// Mass operator for Navier-Stokes example using PETSc 19 20 #ifndef mass_h 21 #define mass_h 22 23 #ifndef __CUDACC__ 24 # include <math.h> 25 #endif 26 27 // ***************************************************************************** 28 // This QFunction applies the mass matrix to five interlaced fields. 29 // 30 // Inputs: 31 // u - Input vector at quadrature points 32 // q_data - Quadrature weights 33 // 34 // Output: 35 // v - Output vector at quadrature points 36 // 37 // ***************************************************************************** 38 CEED_QFUNCTION(Mass)(void *ctx, CeedInt Q, 39 const CeedScalar *const *in, CeedScalar *const *out) { 40 // *INDENT-OFF* 41 // Inputs 42 const CeedScalar (*u)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0], 43 (*q_data) = in[1]; 44 45 // Outputs 46 CeedScalar (*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0]; 47 // *INDENT-ON* 48 49 CeedPragmaSIMD 50 for (CeedInt i=0; i<Q; i++) { 51 v[0][i] = q_data[i] * u[0][i]; 52 v[1][i] = q_data[i] * u[1][i]; 53 v[2][i] = q_data[i] * u[2][i]; 54 v[3][i] = q_data[i] * u[3][i]; 55 v[4][i] = q_data[i] * u[4][i]; 56 } 57 return 0; 58 } 59 60 // ***************************************************************************** 61 62 #endif // mass_h 63