26 MFEM_VERIFY(
PA.enabled,
"PA extension setup has not been done!");
27 MFEM_VERIFY(
PA.fes == &
fes,
"");
44 PA.Jtr_debug_grad =
true;
68 MFEM_VERIFY(
PA.enabled,
"AssemblePA_Limiting but PA is not enabled!");
69 MFEM_VERIFY(
lim_func,
"No TMOP_LimiterFunction specification!")
72 "Only TMOP_QuadraticLimiter and TMOP_ExponentialLimiter are supported");
76 if (NE == 0) {
return; }
83 PA.H0.SetSize(
PA.dim *
PA.dim *
PA.nq * NE, mt);
86 PA.C0.UseDevice(
true);
92 PA.C0(0) = cQ->constant;
98 for (
int e = 0; e < NE; ++e)
112 PA.XL.UseDevice(
true);
121 PA.LD.UseDevice(
true);
127 else {
PA.LD = 1.0; }
175 PA.Jtr_needs_update =
false;
176 PA.Jtr_debug_grad =
false;
178 if (
PA.ne == 0) {
return; }
199 if (
PA.MC.Size() == 1 &&
PA.C0.Size() == 1) {
return; }
207 for (
int e = 0; e <
PA.ne; ++e)
210 PA.fes->GetMesh()->GetElementTransformation(e, x_loc, T);
212 if (
PA.MC.Size() > 1)
214 for (
int q = 0; q <
PA.nq; ++q)
220 if (
PA.C0.Size() > 1)
222 for (
int q = 0; q <
PA.nq; ++q)
242 MFEM_VERIFY(
PA.dim == 2 ||
PA.dim == 3,
"Not yet implemented!");
244 "TMOP+PA does not support mixed meshes.");
247 "TMOP+PA only supports squares and cubes.");
250 "TMOP+PAP only supports Ordering::byNODES!");
267 PA.X0.UseDevice(
true);
273 PA.E.UseDevice(
true);
277 PA.H.UseDevice(
true);
290 PA.MC(0) = cc->constant;
296 for (
int e = 0; e <
PA.ne; ++e)
316 PA.Jtr_needs_update =
true;
317 PA.Jtr_debug_grad =
false;
327 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
331 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called"
332 " or Jtr was overwritten by another method!");
383 MFEM_VERIFY(
PA.Jtr_needs_update ==
false,
"");
387 MFEM_VERIFY(
PA.Jtr_debug_grad ==
true,
"AssembleGradPA() was not called or "
388 "Jtr was overwritten by another method!");
void ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const override
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.
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.
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
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.
bool HasGeometry(Geometry::Type geom) const
Return true iff the given geom is encountered in the mesh. Geometries of dimensions lower than Dimens...
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.
void AddMultGradPA(const Vector &, Vector &) const override
Method for partially assembled gradient action.
real_t GetLocalStateEnergyPA_C0_2D(const Vector &) const
TMOP_LimiterFunction * lim_func
void ComputeAllElementTargets(const Vector &xe=Vector()) const
void AddMultPA_C0_3D(const Vector &, Vector &) const
real_t GetLocalStateEnergyPA_2D(const Vector &) const
void AssembleDiagonalPA_2D(Vector &) const
const GridFunction * lim_dist
void AssembleDiagonalPA_C0_3D(Vector &) const
void AddMultGradPA_2D(const Vector &, Vector &) const
void AssembleGradPA_C0_2D(const Vector &) const
const TargetConstructor * targetC
const GridFunction * lim_nodes0
const IntegrationRule * ir
void AssemblePA(const FiniteElementSpace &) override
Method defining partial assembly.
void AssembleGradDiagonalPA(Vector &) const override
Method for computing the diagonal of the gradient with partial assembly.
void AssembleDiagonalPA_C0_2D(Vector &) const
real_t GetLocalStateEnergyPA_C0_3D(const Vector &) const
void AddMultGradPA_3D(const Vector &, Vector &) const
const FiniteElementSpace * fes
void AssemblePA_Limiting()
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
void AddMultPA_2D(const Vector &, Vector &) const
void AddMultPA_3D(const Vector &, Vector &) const
void AssembleGradPA_C0_3D(const Vector &) const
void AssembleGradPA_2D(const Vector &) const
struct mfem::TMOP_Integrator::@26 PA
Coefficient * metric_coeff
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void AddMultGradPA_C0_2D(const Vector &, Vector &) const
void AssembleDiagonalPA_3D(Vector &) const
void UpdateCoefficientsPA(const Vector &d_loc)
void AssembleGradPA_3D(const Vector &) const
void AssembleGradPA(const Vector &, const FiniteElementSpace &) override
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
real_t GetLocalStateEnergyPA_3D(const Vector &) const
void AddMultPA_C0_2D(const Vector &, Vector &) const
real_t GetLocalStateEnergyPA(const Vector &) const override
Compute the local (to the MPI rank) energy with partial assembly.
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
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
void add(const Vector &v1, const Vector &v2, Vector &v)
MFEM_HOST_DEVICE DeviceTensor< sizeof...(Dims), T > Reshape(T *ptr, Dims... dims)
Wrap a pointer as a DeviceTensor with automatically deduced template parameters.
void GetPeriodicPositions(const Vector &x_0, const Vector &dx, const FiniteElementSpace &fesL2, const FiniteElementSpace &fesH1, Vector &x)
MemoryType
Memory types supported by MFEM.
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.