1*d965c7a7SJeremy L Thompson // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 2*d965c7a7SJeremy L Thompson // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 3*d965c7a7SJeremy L Thompson // All Rights reserved. See files LICENSE and NOTICE for details. 4*d965c7a7SJeremy L Thompson // 5*d965c7a7SJeremy L Thompson // This file is part of CEED, a collection of benchmarks, miniapps, software 6*d965c7a7SJeremy L Thompson // libraries and APIs for efficient high-order finite element and spectral 7*d965c7a7SJeremy L Thompson // element discretizations for exascale applications. For more information and 8*d965c7a7SJeremy L Thompson // source code availability see http://github.com/ceed. 9*d965c7a7SJeremy L Thompson // 10*d965c7a7SJeremy L Thompson // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 11*d965c7a7SJeremy L Thompson // a collaborative effort of two U.S. Department of Energy organizations (Office 12*d965c7a7SJeremy L Thompson // of Science and the National Nuclear Security Administration) responsible for 13*d965c7a7SJeremy L Thompson // the planning and preparation of a capable exascale ecosystem, including 14*d965c7a7SJeremy L Thompson // software, applications, hardware, advanced system engineering and early 15*d965c7a7SJeremy L Thompson // testbed platforms, in support of the nation's exascale computing imperative. 16*d965c7a7SJeremy L Thompson 17*d965c7a7SJeremy L Thompson CEED_QFUNCTION(setup)(void *ctx, const CeedInt Q, 18*d965c7a7SJeremy L Thompson const CeedScalar *const *in, 19*d965c7a7SJeremy L Thompson CeedScalar *const *out) { 20*d965c7a7SJeremy L Thompson const CeedScalar *weight = in[0], *J = in[1]; 21*d965c7a7SJeremy L Thompson CeedScalar *rho = out[0]; 22*d965c7a7SJeremy L Thompson for (CeedInt i=0; i<Q; i++) { 23*d965c7a7SJeremy L Thompson rho[i] = weight[i] * (J[i+Q*0]*J[i+Q*3] - J[i+Q*1]*J[i+Q*2]); 24*d965c7a7SJeremy L Thompson } 25*d965c7a7SJeremy L Thompson return 0; 26*d965c7a7SJeremy L Thompson } 27*d965c7a7SJeremy L Thompson 28*d965c7a7SJeremy L Thompson CEED_QFUNCTION(mass)(void *ctx, const CeedInt Q, const CeedScalar *const *in, 29*d965c7a7SJeremy L Thompson CeedScalar *const *out) { 30*d965c7a7SJeremy L Thompson const CeedScalar *rho = in[0], *u = in[1]; 31*d965c7a7SJeremy L Thompson CeedScalar *v = out[0]; 32*d965c7a7SJeremy L Thompson for (CeedInt i=0; i<Q; i++) { 33*d965c7a7SJeremy L Thompson for (CeedInt c=0; c<2; c++) 34*d965c7a7SJeremy L Thompson v[i+Q*c] = rho[i] * u[i+Q*(c ? 0 : 1)]; 35*d965c7a7SJeremy L Thompson } 36*d965c7a7SJeremy L Thompson return 0; 37*d965c7a7SJeremy L Thompson } 38