https://mooseframework.inl.gov
MFEMScalarQuadratureFunctionCoefficient.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #pragma once
13 
15 
16 // The class derives from mfem::QuadratureFunctionCoefficient, so the complete type is required.
17 #include "libmesh/ignore_warnings.h"
18 #include "mfem.hpp"
19 #include "libmesh/restore_warnings.h"
20 
27 class MFEMScalarQuadratureFunctionCoefficient : public mfem::QuadratureFunctionCoefficient,
29 {
30 public:
31  MFEMScalarQuadratureFunctionCoefficient(mfem::Coefficient & source,
32  mfem::QuadratureFunction & qf,
33  UpdatePolicy update_policy,
34  const std::string & name);
35 
38  void SetTime(mfem::real_t t) override;
39 
41  mfem::real_t Eval(mfem::ElementTransformation & T, const mfem::IntegrationPoint & ip) override;
42 
44  void Project(mfem::QuadratureFunction & qf) override;
45 
46 private:
48  void Refresh();
49 
51  mfem::Coefficient & _source;
53  mfem::QuadratureFunction & _qf;
54 };
55 
56 #endif
std::string name(const ElemQuality q)
void SetTime(mfem::real_t t) override
Set the time for the coefficient, invalidating the stored values unless the update policy is NONE...
void Refresh()
Project the source coefficient into the quadrature function if invalidated.
Scalar coefficient holding precomputed values of a source coefficient at the quadrature points of a Q...
MFEMScalarQuadratureFunctionCoefficient(mfem::Coefficient &source, mfem::QuadratureFunction &qf, UpdatePolicy update_policy, const std::string &name)
void Project(mfem::QuadratureFunction &qf) override
Copy the stored values into qf, re-projecting the source first if invalidated.
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.
mfem::Coefficient & _source
Source coefficient the stored values are projected from.
Shared lazy-update state for quadrature function coefficients.
mfem::QuadratureFunction & _qf
Storage for the projected values, shared with the owning MOOSE object.