10#ifdef MOOSE_MFEM_ENABLED
13#include "libmesh/int_range.h"
16 mfem::QuadratureFunction & qf, UpdatePolicy update_policy,
const std::string & name)
17 :
mfem::QuadratureFunctionCoefficient(qf),
27 mfem::Coefficient::SetTime(t);
33 const mfem::IntegrationPoint & ip)
38 return mfem::QuadratureFunctionCoefficient::Eval(T, ip);
46 mfem::QuadratureFunctionCoefficient::Project(qf);
56 const mfem::QuadratureSpaceBase & qspace = *
_qf.GetSpace();
57 const mfem::Mesh &
mesh = *qspace.GetMesh();
58 mfem::IsoparametricTransformation T;
61 for (
const auto iel : make_range(qspace.GetNE()))
64 const mfem::IntegrationRule & ir = qspace.GetIntRule(iel);
65 mesh.GetElementTransformation(iel, &T);
66 for (
const auto iq : make_range(ir.Size()))
68 const mfem::IntegrationPoint & ip = ir[iq];
std::array< Real, 2 > values
Shared lazy-update state for quadrature function coefficients.
void MarkTimeChanged()
Mark the stored values as stale following a change of time.
bool _dirty
Whether the stored values are stale and must be re-projected before use.
void CheckIntegrationRule(const mfem::QuadratureFunction &qf, mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) const
Verify that the integration point ip supplied by a consuming integrator belongs to the same quadratur...
mfem::Coefficient * _source
Source coefficient the stored values are projected from.
mfem::real_t Eval(mfem::ElementTransformation &T, const mfem::IntegrationPoint &ip) override
Return the stored value at ip, re-projecting the source first if invalidated.
void Refresh()
Project the source coefficient into the quadrature function if invalidated.
void Project(mfem::QuadratureFunction &qf) override
Copy the stored values into qf, re-projecting the source first if invalidated.
mfem::QuadratureFunction & _qf
Storage for the projected values, shared with the owning MOOSE object.
void SetTime(mfem::real_t t) override
Set the time for the coefficient, invalidating the stored values unless the update policy is NONE.
MFEMScalarQuadratureFunctionCoefficient(mfem::QuadratureFunction &qf, UpdatePolicy update_policy, const std::string &name)