// Copyright (c) 2010-2023, Lawrence Livermore National Security, LLC. Produced // at the Lawrence Livermore National Laboratory. All Rights reserved. See files // LICENSE and NOTICE for details. LLNL-CODE-806117. // // This file is part of the MFEM library. For more information and source code // availability visit https://mfem.org. // // MFEM is free software; you can redistribute it and/or modify it under the // terms of the BSD-3 license. We welcome feedback and contributions, see file // CONTRIBUTING.md for details. /// A structure used to pass additional data to f_build_diff and f_apply_diff struct MassContext { CeedInt dim, space_dim, vdim; CeedScalar coeff; }; /// libCEED Q-function for building quadrature data for a mass operator with a /// constant coefficient CEED_QFUNCTION(f_build_mass_const)(void *ctx, CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) { // in[0] is Jacobians with shape [dim, nc=dim, Q] // in[1] is quadrature weights, size (Q) MassContext *bc = (MassContext *)ctx; const CeedScalar coeff = bc->coeff; const CeedScalar *J = in[0], *qw = in[1]; CeedScalar *rho = out[0]; switch (bc->dim + 10*bc->space_dim) { case 11: for (CeedInt i=0; idim + 10*bc->space_dim) { case 11: for (CeedInt i=0; ivdim) { case 1: for (CeedInt i=0; icoeff; const CeedScalar *u = in[0], *J = in[1], *qw = in[2]; CeedScalar *v = out[0]; switch (10 * bc->dim + bc->vdim) { case 11: for (CeedInt i = 0; i < Q; i++) { const CeedScalar rho = coeff * qw[i] / J[i]; v[i] = rho * u[i]; } break; case 21: for (CeedInt i = 0; i < Q; i++) { const CeedScalar rho = coeff * (J[i+Q*0]*J[i+Q*3] - J[i+Q*1]*J[i+Q*2]) * qw[i]; v[i] = rho * u[i]; } break; case 22: for (CeedInt i=0; idim + bc->vdim) { case 11: for (CeedInt i=0; i