12 #include "../tmop.hpp" 13 #include "../linearform.hpp" 14 #include "../pgridfunc.hpp" 15 #include "../tmop_tools.hpp" 16 #include "../quadinterpolator.hpp" 17 #include "../../general/forall.hpp" 18 #include "../../linalg/kernels.hpp" 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!")
61 MFEM_VERIFY(dynamic_cast<TMOP_QuadraticLimiter*>(
lim_func) ||
62 dynamic_cast<TMOP_ExponentialLimiter*>(
lim_func),
63 "Only TMOP_QuadraticLimiter and TMOP_ExponentialLimiter are supported");
67 if (NE == 0) {
return; }
73 PA.H0.UseDevice(
true);
74 PA.H0.SetSize(
PA.dim *
PA.dim *
PA.nq * NE, mt);
77 PA.C0.UseDevice(
true);
79 dynamic_cast<ConstantCoefficient*>(
lim_coeff))
83 PA.C0(0) = cQ->constant;
89 for (
int e = 0; e < NE; ++e)
103 PA.X0.UseDevice(
true);
112 PA.LD.UseDevice(
true);
132 if (
dim == 2) { done = ComputeAllElementTargets<2>(fes, ir, xe, Jtr); }
133 if (
dim == 3) { done = ComputeAllElementTargets<3>(fes, ir, xe, Jtr); }
169 PA.Jtr_needs_update =
false;
170 PA.Jtr_debug_grad =
false;
172 if (
PA.ne == 0) {
return; }
187 if (
ne == 0) {
return; }
189 MFEM_VERIFY(
PA.dim == 2 ||
PA.dim == 3,
"Not yet implemented!");
191 "mixed meshes are not supported");
197 "PA Only supports Ordering::byNODES!");
201 PA.maps = &fe.GetDofToQuad(
ir, mode);
205 PA.E.UseDevice(
true);
209 PA.H.UseDevice(
true);
218 PA.Jtr_needs_update =
true;
219 PA.Jtr_debug_grad =
false;
229 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
233 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called" 234 " or Jtr was overwritten by another method!");
276 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
280 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called or " 281 "Jtr was overwritten by another method!");
Abstract class for all finite elements.
int GetNPoints() const
Returns the number of the points in the integration rule.
Class for an integration rule - an Array of IntegrationPoint.
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
Tensor product representation using 1D matrices/tensors with dimensions using 1D number of quadrature...
A coefficient that is constant across space and time.
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.
const GridFunction * lim_dist
void AddMultGradPA_2D(const Vector &, Vector &) const
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
struct mfem::TMOP_Integrator::@23 PA
int Dimension() const
Dimension of the reference space used within the elements.
void AssembleGradPA_2D(const Vector &) const
void ComputeAllElementTargets(const Vector &xe=Vector()) const
void AddMultPA_3D(const Vector &, Vector &) const
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
const IntegrationRule * ir
virtual double GetLocalStateEnergyPA(const Vector &) const
Compute the local (to the MPI rank) energy with partial assembly.
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
int GetNumGeometries(int dim) const
Return the number of geometries of the given dimension present in the mesh.
const ElementRestrictionOperator * GetElementRestriction(ElementDofOrdering e_ordering) const
Return an Operator that converts L-vectors to E-vectors.
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
virtual void AddMultPA(const Vector &, Vector &) const
Method for partially assembled action.
void AddMultPA_C0_2D(const Vector &, Vector &) const
bool ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
double GetLocalStateEnergyPA_C0_3D(const Vector &) const
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...
void AssembleGradPA_C0_2D(const Vector &) const
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
virtual void AssembleGradPA(const Vector &, const FiniteElementSpace &)
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
void AddMultGradPA_3D(const Vector &, Vector &) const
void AssembleDiagonalPA_3D(Vector &) const
void AddMultGradPA_C0_2D(const Vector &, Vector &) const
static MemoryType GetDeviceMemoryType()
Get the current Device MemoryType. This is the MemoryType used by most MFEM classes when allocating m...
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
const TargetConstructor * targetC
const GridFunction * lim_nodes0
virtual void AssemblePA(const FiniteElementSpace &)
Method defining partial assembly.
void AssembleGradPA_C0_3D(const Vector &) const
FiniteElementSpace * FESpace()
void AssembleDiagonalPA_2D(Vector &) const
void AssemblePA_Limiting()
double GetLocalStateEnergyPA_3D(const Vector &) const
Mesh * GetMesh() const
Returns the mesh.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void AddMultPA_C0_3D(const Vector &, Vector &) const
MemoryType
Memory types supported by MFEM.
void AssembleDiagonalPA_C0_2D(Vector &) const
int GetDof() const
Returns the number of degrees of freedom in the finite element.
virtual void AssembleGradDiagonalPA(Vector &) const
Method for computing the diagonal of the gradient with partial assembly.
int GetNE() const
Returns number of elements.
double GetLocalStateEnergyPA_C0_2D(const Vector &) const
Mode
Type of data stored in the arrays B, Bt, G, and Gt.
const FiniteElementSpace * fes
void AssembleDiagonalPA_C0_3D(Vector &) const
Ordering::Type GetOrdering() const
Return the ordering method.
virtual void AddMultGradPA(const Vector &, Vector &) const
Method for partially assembled gradient action.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
Lexicographic ordering for tensor-product FiniteElements.
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
void AssembleGradPA_3D(const Vector &) const
double GetLocalStateEnergyPA_2D(const Vector &) const
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...
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
void AddMultPA_2D(const Vector &, Vector &) const
Rank 3 tensor (array of matrices)
TMOP_LimiterFunction * lim_func
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
void AddMultGradPA_C0_3D(const Vector &, Vector &) const
ElementTransformation * GetElementTransformation(int i) const
Returns ElementTransformation for the i-th element.