26 MFEM_VERIFY(
PA.enabled,
"PA extension setup has not been done!");
27 MFEM_VERIFY(
PA.fes == &
fes,
"");
35 PA.Jtr_debug_grad =
true;
59 MFEM_VERIFY(
PA.enabled,
"AssemblePA_Limiting but PA is not enabled!");
60 MFEM_VERIFY(
lim_func,
"No TMOP_LimiterFunction specification!")
63 "Only TMOP_QuadraticLimiter and TMOP_ExponentialLimiter are supported");
67 if (NE == 0) {
return; }
74 PA.H0.SetSize(
PA.dim *
PA.dim *
PA.nq * NE, mt);
77 PA.C0.UseDevice(
true);
83 PA.C0(0) = cQ->constant;
89 for (
int e = 0; e < NE; ++e)
103 PA.X0.UseDevice(
true);
112 PA.LD.UseDevice(
true);
169 PA.Jtr_needs_update =
false;
170 PA.Jtr_debug_grad =
false;
172 if (
PA.ne == 0) {
return; }
182 if (
PA.MC.Size() == 1 &&
PA.C0.Size() == 1) {
return; }
190 for (
int e = 0; e <
PA.ne; ++e)
193 PA.fes->GetMesh()->GetElementTransformation(e, x_loc, T);
195 if (
PA.MC.Size() > 1)
197 for (
int q = 0; q <
PA.nq; ++q)
203 if (
PA.C0.Size() > 1)
205 for (
int q = 0; q <
PA.nq; ++q)
223 if (
ne == 0) {
return; }
225 MFEM_VERIFY(
PA.dim == 2 ||
PA.dim == 3,
"Not yet implemented!");
227 "mixed meshes are not supported");
233 "PA Only supports Ordering::byNODES!");
241 PA.E.UseDevice(
true);
245 PA.H.UseDevice(
true);
258 PA.MC(0) = cc->constant;
264 for (
int e = 0; e <
PA.ne; ++e)
283 PA.Jtr_needs_update =
true;
284 PA.Jtr_debug_grad =
false;
294 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
298 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called"
299 " or Jtr was overwritten by another method!");
341 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
345 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called or "
346 "Jtr was overwritten by another method!");
virtual void ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Computes reference-to-target transformation Jacobians for all quadrature points in all elements.
bool UseDevice() const
Return the device flag of the Memory object used by the Array.
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
A coefficient that is constant across space and time.
Rank 3 tensor (array of matrices)
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
static MemoryType GetDeviceMemoryType()
Get the current Device MemoryType. This is the MemoryType used by most MFEM classes when allocating m...
Mode
Type of data stored in the arrays B, Bt, G, and Gt.
@ TENSOR
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Ordering::Type GetOrdering() const
Return the ordering method.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
Mesh * GetMesh() const
Returns the mesh.
Abstract class for all finite elements.
virtual const DofToQuad & GetDofToQuad(const IntegrationRule &ir, DofToQuad::Mode mode) const
Return a DofToQuad structure corresponding to the given IntegrationRule using the given DofToQuad::Mo...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
FiniteElementSpace * FESpace()
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
const GeometricFactors * GetGeometricFactors(const IntegrationRule &ir, const int flags, MemoryType d_mt=MemoryType::DEFAULT)
Return the mesh geometric factors corresponding to the given integration rule.
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
Exponential limiter function in TMOP_Integrator.
virtual void AssembleGradPA(const Vector &, const FiniteElementSpace &)
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
real_t GetLocalStateEnergyPA_C0_2D(const Vector &) const
TMOP_LimiterFunction * lim_func
void ComputeAllElementTargets(const Vector &xe=Vector()) const
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
void AddMultPA_C0_3D(const Vector &, Vector &) const
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
real_t GetLocalStateEnergyPA_2D(const Vector &) const
void AssembleDiagonalPA_2D(Vector &) const
const GridFunction * lim_dist
void AssembleDiagonalPA_C0_3D(Vector &) const
virtual real_t GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
void AddMultGradPA_2D(const Vector &, Vector &) const
void AssembleGradPA_C0_2D(const Vector &) const
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
const TargetConstructor * targetC
const GridFunction * lim_nodes0
const IntegrationRule * ir
void AssembleDiagonalPA_C0_2D(Vector &) const
real_t GetLocalStateEnergyPA_C0_3D(const Vector &) const
void AddMultGradPA_3D(const Vector &, Vector &) const
const FiniteElementSpace * fes
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
void AssemblePA_Limiting()
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
void AddMultPA_2D(const Vector &, Vector &) const
struct mfem::TMOP_Integrator::@23 PA
void UpdateCoefficientsPA(const Vector &x_loc)
void AddMultPA_3D(const Vector &, Vector &) const
void AssembleGradPA_C0_3D(const Vector &) const
void AssembleGradPA_2D(const Vector &) const
Coefficient * metric_coeff
void AddMultGradPA_C0_2D(const Vector &, Vector &) const
void AssembleDiagonalPA_3D(Vector &) const
void AssembleGradPA_3D(const Vector &) const
real_t GetLocalStateEnergyPA_3D(const Vector &) const
void AddMultPA_C0_2D(const Vector &, Vector &) const
void AddMultGradPA_C0_3D(const Vector &, Vector &) const
Default limiter function in TMOP_Integrator.
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
bool ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
MemoryType
Memory types supported by MFEM.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
@ LEXICOGRAPHIC
Lexicographic ordering for tensor-product FiniteElements.