22using AD1Type = future::dual<real_t, real_t>;
23using AD2Type = future::dual<AD1Type, AD1Type>;
79 const std::vector<AD1Type> &W)
const
81 MFEM_ABORT(
"EvalW_AD1 not implemented for this metric");
87 const std::vector<AD2Type> &W)
const
89 MFEM_ABORT(
"EvalW_AD2 not implemented for this metric");
108 virtual int Id()
const {
return 0; }
111class TargetConstructor;
148 const std::vector<AD1Type> &W)
const override;
151 const std::vector<AD2Type> &W)
const override;
181 MFEM_VERIFY(
tmop_q_arr.Size() == weights.
Size(),
"Incorrect #weights");
239 "Worst-case optimization has not been fully developed!");
243 MFEM_VERIFY(m_id == 4 || m_id == 14 || m_id == 66,
244 "Incorrect input barrier metric -- must be 4 / 14 / 66");
251 const std::vector<AD1Type> &W)
const override;
254 const std::vector<AD2Type> &W)
const override;
285 int Id()
const override {
return 0; }
303 int Id()
const override {
return 1; }
317 {
return EvalWMatrixForm(Jpt); }
335 { MFEM_ABORT(
"Not implemented"); }
339 { MFEM_ABORT(
"Not implemented"); }
350 { MFEM_ABORT(
"Not implemented"); }
354 { MFEM_ABORT(
"Not implemented"); }
365 { MFEM_ABORT(
"Not implemented"); }
369 { MFEM_ABORT(
"Not implemented"); }
391 int Id()
const override {
return 2; }
401 template<
typename type>
403 const std::vector<type> &W)
const;
415 const std::vector<AD1Type> &W)
const override;
418 const std::vector<AD2Type> &W)
const override;
420 int Id()
const override {
return 4; }
438 int Id()
const override {
return 7; }
456 int Id()
const override {
return 9; }
465 template <
typename type>
467 const std::vector<type> &W)
const;
482 const std::vector<AD1Type> &W)
const override;
485 const std::vector<AD2Type> &W)
const override;
487 int Id()
const override {
return 14; }
508 int Id()
const override {
return 22; }
530 int Id()
const override {
return 50; }
540 template<
typename type>
542 const std::vector<type> &W)
const;
554 const std::vector<AD1Type> &W)
const override;
557 const std::vector<AD2Type> &W)
const override;
559 int Id()
const override {
return 55; }
582 int Id()
const override {
return 56; }
603 int Id()
const override {
return 58; }
622 int Id()
const override {
return 66; }
647 int Id()
const override {
return 77; }
667 int Id()
const override {
return 80; }
687 int Id()
const override {
return 85; }
707 int Id()
const override {
return 90; }
728 int Id()
const override {
return 94; }
746 int Id()
const override {
return 98; }
767 int Id()
const override {
return 211; }
789 int Id()
const override {
return 252; }
810 int Id()
const override {
return 301; }
831 int Id()
const override {
return 302; }
852 int Id()
const override {
return 303; }
873 int Id()
const override {
return 304; }
894 int Id()
const override {
return 311; }
915 int Id()
const override {
return 313; }
933 int Id()
const override {
return 315; }
954 int Id()
const override {
return 316; }
975 int Id()
const override {
return 318; }
996 int Id()
const override {
return 321; }
1017 int Id()
const override {
return 322; }
1038 int Id()
const override {
return 323; }
1058 int Id()
const override {
return 328; }
1077 int Id()
const override {
return 332; }
1099 int Id()
const override {
return 333; }
1119 int Id()
const override {
return 334; }
1142 int Id()
const override {
return 338; }
1163 int Id()
const override {
return 342; }
1182 int Id()
const override {
return 347; }
1206 int Id()
const override {
return 352; }
1227 int Id()
const override {
return 360; }
1390 int Id()
const override {
return 49; }
1426 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1432 Vector &d1)
const override
1434 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1437 subtract(1.0 / (dist * dist), x, x0, d1);
1443 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1445 d2.
Diag(1.0 / (dist * dist), x.
Size());
1457 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1463 Vector &d1)
const override
1465 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1468 real_t dist_squared = dist*dist;
1470 dist_squared, x, x0, d1);
1476 MFEM_ASSERT(x.
Size() == x0.
Size(),
"Bad input.");
1479 real_t dist_squared = dist*dist;
1480 real_t dist_squared_squared = dist_squared*dist_squared;
1485 d2(0,0) = ((400.0*tmp(0)*tmp(0)*
f)/dist_squared_squared)+(20.0*
f/dist_squared);
1486 d2(1,1) = ((400.0*tmp(1)*tmp(1)*
f)/dist_squared_squared)+(20.0*
f/dist_squared);
1487 d2(0,1) = (400.0*tmp(0)*tmp(1)*
f)/dist_squared_squared;
1492 d2(0,2) = (400.0*tmp(0)*tmp(2)*
f)/dist_squared_squared;
1493 d2(1,2) = (400.0*tmp(1)*tmp(2)*
f)/dist_squared_squared;
1496 d2(2,2) = ((400.0*tmp(2)*tmp(2)*
f)/dist_squared_squared)+(20.0*
f/dist_squared);
1504class FiniteElementCollection;
1505class FiniteElementSpace;
1506class ParFiniteElementSpace;
1545 const Vector &init_field) = 0;
1646 comm = MPI_COMM_NULL;
1767class ParGridFunction;
1898 int nodenum,
int idir,
1908 bool reuse_flag =
false,
1915 bool reuse_flag =
false,
1984class TMOPNewtonSolver;
2183 Vector &d_el,
const int nodenum,
const int idir,
2184 const real_t baseenergy,
bool update_stored);
2231 real_t &lim_energy)
const;
2234 real_t &lim_energy)
const;
2267 int new_x_ordering);
2287 {
PA.enabled =
false; }
2319 "This function must be called before EnableNormalization, as "
2320 "the normalization computations must know how to integrate.");
2466 const Vector &d_el)
override;
2565 for (
int i = 0; i <
tmopi.Size(); i++)
2566 {
tmopi[i]->SetInitialMeshPos(x0); }
2574 for (
int i = 0; i <
tmopi.Size(); i++) {
delete tmopi[i]; }
2596 const Vector &elfun)
override;
2632 const TargetConstructor &tc,
2633 const Mesh &mesh, GridFunction &metric_gf);
virtual ~AdaptivityEvaluator()
virtual void SetNewFieldFESpace(const FiniteElementSpace &fes)=0
virtual void SetInitialField(const Vector &init_nodes, const Vector &init_field)=0
virtual void ComputeAtGivenPositions(const Vector &positions, Vector &values, int p_ordering=Ordering::byNODES)=0
Using the source mesh and field given by SetInitialField(), compute corresponding values at specified...
void SetSerialMetaInfo(const Mesh &m, const FiniteElementSpace &f)
void SetParMetaInfo(const ParMesh &m, const ParFiniteElementSpace &f)
Parallel version of SetSerialMetaInfo.
void ClearGeometricFactors()
virtual void ComputeAtNewPosition(const Vector &new_mesh_nodes, Vector &new_field, int nodes_ordering=Ordering::byNODES)=0
Perform field transfer between the original and a new mesh. The source mesh and field are given by Se...
ParFiniteElementSpace * pfes
AnalyticAdaptTC(TargetType ttype)
Coefficient * scalar_tspec
virtual void SetAnalyticTargetSpec(Coefficient *sspec, VectorCoefficient *vspec, TMOPMatrixCoefficient *mspec)
TMOPMatrixCoefficient * matrix_tspec
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.
VectorCoefficient * vector_tspec
void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const override
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const override
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Data type dense matrix using column-major storage.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
void Diag(real_t c, int n)
Creates n x n diagonal matrix with diagonal elements c.
void Clear()
Delete the matrix data array (if owned) and reset the matrix state.
Rank 3 tensor (array of matrices)
const Vector & GetTspecPert1H()
void UpdateTargetSpecification(const Vector &new_x, bool reuse_flag=false, int new_x_ordering=Ordering::byNODES)
virtual void SetSerialDiscreteTargetSkew(const GridFunction &tspec_)
virtual void SetParDiscreteTargetAspectRatio(const ParGridFunction &tspec_)
ParGridFunction * tspec_pgf
FiniteElementSpace * GetTSpecFESpace()
Get the FESpace associated with tspec.
virtual void SetSerialDiscreteTargetAspectRatio(const GridFunction &tspec_)
const AdaptivityEvaluator * GetAdaptivityEvaluator() const
void SetTspecDataForDerefinement(FiniteElementSpace *fes)
Computes target specification data with respect to the coarse FE space.
void ResetDerefinementTspecData()
const Vector & GetTspecPertMixH()
void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const override
void SetMinSizeForTargets(real_t min_size_)
virtual void SetParDiscreteTargetSpec(const ParGridFunction &tspec_)
AdaptivityEvaluator * adapt_eval
void FinalizeSerialDiscreteTargetSpec(const GridFunction &tspec_)
void FinalizeParDiscreteTargetSpec(const ParGridFunction &tspec_)
ParFiniteElementSpace * ptspec_fesv
FiniteElementSpace * coarse_tspec_fesv
virtual ~DiscreteAdaptTC()
GridFunction * GetTSpecData()
Get the entire tspec.
virtual void SetSerialDiscreteTargetSize(const GridFunction &tspec_)
virtual void SetParDiscreteTargetSize(const ParGridFunction &tspec_)
const Vector & GetTspecPert2H()
void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const override
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
void UpdateAfterMeshTopologyChange()
Update all discrete fields based on tspec and update for AMR.
void SetAdaptivityEvaluator(AdaptivityEvaluator *ae)
virtual void SetSerialDiscreteTargetSpec(const GridFunction &tspec_)
virtual void SetParDiscreteTargetOrientation(const ParGridFunction &tspec_)
void ResetRefinementTspecData()
virtual void SetParDiscreteTargetSkew(const ParGridFunction &tspec_)
void ParUpdateAfterMeshTopologyChange()
void UpdateTargetSpecificationAtNode(const FiniteElement &el, ElementTransformation &T, int nodenum, int idir, const Vector &IntData)
void ResetUpdateFlags()
Used in combination with the Update methods to avoid extra computations.
void RestoreTargetSpecificationAtNode(ElementTransformation &T, int nodenum)
FiniteElementSpace * tspec_fesv
virtual void SetSerialDiscreteTargetOrientation(const GridFunction &tspec_)
void SetTspecAtIndex(int idx, const GridFunction &tspec_)
ParFiniteElementSpace * GetTSpecParFESpace()
void SetRefinementSubElement(int amr_el_)
void GetDiscreteTargetSpec(GridFunction &tspec_, int idx)
Get one of the discrete fields from tspec.
void UpdateHessianTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
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.
void SetDiscreteTargetBase(const GridFunction &tspec_)
DiscreteAdaptTC(TargetType ttype)
void UpdateGradientTargetSpecification(const Vector &x, real_t dx, bool reuse_flag=false, int x_ordering=Ordering::byNODES)
void SetTspecFromIntRule(int e_id, const IntegrationRule &intrule)
Structure representing the matrices/tensors needed to evaluate (in reference space) the values,...
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Abstract class for all finite elements.
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
Geometry::Type GetGeomType() const
Returns the Geometry::Type of the reference element.
Structure for storing mesh geometric factors: coordinates, Jacobians, and determinants of the Jacobia...
Class for grid function - Vector with associated FE space.
Abstract class for hyperelastic models.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
Container class for integration rules.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
const IntegrationRule * IntRule
Auxiliary class for evaluating the 2x2 matrix invariants and their first and second derivatives.
Auxiliary class for evaluating the 3x3 matrix invariants and their first and second derivatives.
Base class for Matrix Coefficients that optionally depend on time and space.
Abstract parallel finite element space.
Class for parallel grid function.
Class for parallel meshes.
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
void AssembleGradPA(const Vector &, const FiniteElementSpace &) override
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
void AssembleGradDiagonalPA(Vector &) const override
Method for computing the diagonal of the gradient with partial assembly.
real_t GetLocalStateEnergyPA(const Vector &) const override
Compute the local (to the MPI rank) energy with partial assembly.
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
void ParEnableNormalization(const ParGridFunction &x)
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Adds the limiting term to the first integrator. Disables it for the rest.
void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, DenseMatrix &elmat) override
Assemble the local gradient matrix.
real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun) override
Compute the local energy.
void AddMultGradPA(const Vector &, Vector &) const override
Method for partially assembled gradient action.
virtual real_t GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
void AssemblePA(const FiniteElementSpace &) override
Method defining partial assembly.
Array< TMOP_Integrator * > tmopi
void SetInitialMeshPos(const GridFunction *x0)
void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, Vector &elvect) override
Perform the local action of the NonlinearFormIntegrator.
void EnableNormalization(const GridFunction &x)
Normalization factor that considers all integrators in the combination.
void AddTMOPIntegrator(TMOP_Integrator *ti)
Adds a new TMOP_Integrator to the combination.
const Array< TMOP_Integrator * > & GetTMOPIntegrators() const
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
virtual ~TMOPMatrixCoefficient()
TMOPMatrixCoefficient(int dim)
virtual void EvalGrad(DenseMatrix &K, ElementTransformation &T, const IntegrationPoint &ip, int comp)=0
Evaluate the derivative of the matrix coefficient with respect to comp in the element described by T ...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator2D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
2D barrier Size (V) metric (polyconvex).
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
InvariantsEvaluator2D< real_t > ie
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sh_metric
int Id() const override
Return the metric ID.
TMOP_AMetric_049(real_t gamma)
TMOP_QualityMetric * sk_metric
virtual ~TMOP_AMetric_049()
2D barrier Skew (Q) metric.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
2D barrier Size+Skew (VQ) metric.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
2D barrier Shape+Orientation (OS) metric (polyconvex).
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const override
2D barrier Shape+Size (VS) metric (polyconvex).
virtual ~TMOP_AMetric_126()
TMOP_QualityMetric * sh_metric
TMOP_AMetric_126(real_t gamma)
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sz_metric
void SetTargetJacobian(const DenseMatrix &Jtr_) override
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void GetLocalEnergyPA_3D(const GridFunction &nodes, const TargetConstructor &tc, int m_index, real_t &energy, real_t &vol, const IntegrationRule &ir) const
void GetLocalEnergyPA_2D(const GridFunction &nodes, const TargetConstructor &tc, int m_index, real_t &energy, real_t &vol, const IntegrationRule &ir) const
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void SetWeights(const Vector &weights)
Changes the weights of the metrics in the combination.
void ComputeAvgMetrics(const GridFunction &nodes, const TargetConstructor &tc, Vector &averages, bool use_pa=false, const IntegrationRule *IntRule=nullptr) const
AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const override
Second-derivative hook for AD-based computations.
void ComputeBalancedWeights(const GridFunction &nodes, const TargetConstructor &tc, Vector &weights, bool use_pa=false, const IntegrationRule *IntRule=nullptr) const
void GetWeights(Array< real_t > &weights) const
AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const override
First-derivative hook for AD-based computations.
Array< TMOP_QualityMetric * > tmop_q_arr
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual void AddQualityMetric(TMOP_QualityMetric *tq, real_t wt=1.0)
void EvalPW(const DenseMatrix &Jpt, DenseMatrix &P) const override
Exponential limiter function in TMOP_Integrator.
virtual ~TMOP_ExponentialLimiter()
void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const override
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
real_t Eval(const Vector &x, const Vector &x0, real_t dist) const override
Returns the limiting function, f(x, x0, d).
void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const override
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
A TMOP integrator class based on any given TMOP_QualityMetric and TargetConstructor.
void AddMultGradPA(const Vector &, Vector &) const override
Method for partially assembled gradient action.
void SetExactActionFlag(bool flag_)
Flag to control if exact action of Integration is effected.
real_t ComputeUntanglerMaxMuBarrier(const Vector &x, const FiniteElementSpace &fes)
void UpdateAfterMeshPositionChange(const Vector &d, const FiniteElementSpace &d_fes)
void AssembleElemVecAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &mat)
void AssembleElemGradAdaptLim(const FiniteElement &el, IsoparametricTransformation &Tpr, const IntegrationRule &ir, const Vector &weights, DenseMatrix &m)
const DofToQuad * maps_lim
void GetNormalizationFactors(real_t &metric_normal, real_t &lim_normal, real_t &surf_fit_normal)
Get the normalization factors of the metric.
friend class TMOPAssembleGradPA2D
real_t GetLocalStateEnergyPA_C0_2D(const Vector &) const
TMOP_LimiterFunction * lim_func
void ComputeAllElementTargets(const Vector &xe=Vector()) const
void ParUpdateAfterMeshTopologyChange()
friend class TMOPEnergyPA2D
TMOP_QualityMetric * metric
const ParGridFunction * adapt_lim_pgf0
void SetFDhScale(real_t scale)
void AddMultPA_C0_3D(const Vector &, Vector &) const
void GetSurfaceFittingErrors(const Vector &d_loc, real_t &err_avg, real_t &err_max)
real_t ComputeMinDetT(const Vector &x, const FiniteElementSpace &fes)
AdaptivityEvaluator * surf_fit_eval
void EnableNormalization(const GridFunction &x)
Computes the normalization factors of the metric and limiting integrals using the mesh position given...
void ComputeMinJac(const Vector &x, const FiniteElementSpace &fes)
void AssembleElementVectorExact(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, Vector &elvect)
friend class TMOPAddMultPA2D
TMOP_QualityMetric * h_metric
void AssembleElementGradFD(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, DenseMatrix &elmat)
DiscreteAdaptTC * discr_tc
void AssembleDiagonalPA_2D(Vector &) const
friend class TMOPEnergyPA3D
GridFunction * surf_fit_gf
const GridFunction * lim_dist
void AssembleDiagonalPA_C0_3D(Vector &) const
Array< Vector * > ElemPertEnergy
const GridFunction * adapt_lim_gf0
void SetCoefficient(Coefficient &w1)
Sets a scaling Coefficient for the quality metric term of the integrator.
void AddMultGradPA_2D(const Vector &, Vector &) const
friend class TMOPAddMultPA3D
void ComputeUntangleMetricQuantiles(const Vector &d, const FiniteElementSpace &fes)
void AssembleGradPA_C0_2D(const Vector &) const
void EnableSurfaceFittingFromSource(const ParGridFunction &s_bg, ParGridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae, const ParGridFunction &s_bg_grad, ParGridFunction &s0_grad, AdaptivityEvaluator &age, const ParGridFunction &s_bg_hess, ParGridFunction &s0_hess, AdaptivityEvaluator &ahe)
Fitting of certain DOFs in the current mesh to the zero level set of a function defined on another (f...
const TargetConstructor * targetC
AdaptivityEvaluator * surf_fit_eval_grad
void GetLocalStateEnergyPA_2D(const Vector &x, real_t &energy) const
const GridFunction * lim_nodes0
const IntegrationRule * ir
TMOP_QuadraticLimiter * surf_fit_limiter
void EnableFiniteDifferences(const GridFunction &x)
Enables FD-based approximation and computes dx.
virtual real_t GetRefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun, const IntegrationRule &irule)
Computes the mean of the energies of the given element's children.
real_t GetSurfaceFittingWeight()
Get the surface fitting weight.
void SetInitialMeshPos(const GridFunction *x0)
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
bool IsSurfaceFittingEnabled()
const GridFunction * surf_fit_pos
Array< int > surf_fit_marker_dof_index
const GeometricFactors * geom
real_t GetLocalStateEnergyPA_C0_3D(const Vector &) const
void ParEnableNormalization(const ParGridFunction &x)
void AddMultGradPA_3D(const Vector &, Vector &) const
real_t GetElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &d_el) override
Computes the integral of W(Jacobian(Trt)) over a target zone.
Coefficient * adapt_lim_coeff
const FiniteElementSpace * fes
void AssemblePA_Limiting()
const IntegrationRule & EnergyIntegrationRule(const FiniteElement &el) const
GridFunction * surf_fit_grad
GridFunction * surf_fit_hess
friend class TMOPAssembleGradPA3D
void ReleasePADeviceMemory(bool copy_to_host=true)
void AddMultPA_2D(const Vector &, Vector &) const
virtual real_t GetDerefinementElementEnergy(const FiniteElement &el, ElementTransformation &T, const Vector &elfun)
TMOP_QualityMetric & GetAMRQualityMetric()
void AssembleElementGrad(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, DenseMatrix &elmat) override
Second derivative of GetElementEnergy() w.r.t. each local H1 DOF.
void AssembleElementVectorFD(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, Vector &elvect)
void AddMultPA_3D(const Vector &, Vector &) const
const IntegrationRule & GradientIntegrationRule(const FiniteElement &el) const
void EnableAdaptiveLimiting(const GridFunction &z0, Coefficient &coeff, AdaptivityEvaluator &ae)
Restriction of the node positions to certain regions.
void AssembleGradPA_C0_3D(const Vector &) const
void AssembleGradPA_2D(const Vector &) const
struct mfem::TMOP_Integrator::@26 PA
AdaptivityEvaluator * surf_fit_eval_hess
void SetLimitingNodes(const GridFunction &n0)
Update the original/reference nodes used for limiting.
Coefficient * metric_coeff
void SetIntegrationRules(IntegrationRules &irules, int order)
Prescribe a set of integration rules; relevant for mixed meshes.
void GetLocalNormalizationEnergiesPA_3D(const Vector &x, real_t &met_energy, real_t &lim_energy) const
void AddMultPA(const Vector &, Vector &) const override
Method for partially assembled action.
GridFunction * adapt_lim_gf
real_t GetFDDerivative(const FiniteElement &el, ElementTransformation &T, Vector &d_el, const int nodenum, const int idir, const real_t baseenergy, bool update_stored)
DiscreteAdaptTC * GetDiscreteAdaptTC() const
void UpdateAfterMeshTopologyChange()
void ComputeNormalizationEnergies(const GridFunction &x, real_t &metric_energy, real_t &lim_energy)
void AddMultGradPA_C0_2D(const Vector &, Vector &) const
IntegrationRules * IntegRules
void RemapSurfaceFittingLevelSetAtNodes(const Vector &new_x, int new_x_ordering)
void AssembleDiagonalPA_3D(Vector &) const
void UpdateCoefficientsPA(const Vector &d_loc)
void AssembleGradPA_3D(const Vector &) const
Coefficient * surf_fit_coeff
Array< int > surf_fit_dof_count
void GetLocalStateEnergyPA_3D(const Vector &, real_t &energy) const
void AssembleElementGradExact(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, DenseMatrix &elmat)
void EnableSurfaceFitting(const GridFunction &s0, const Array< bool > &smarker, Coefficient &coeff, AdaptivityEvaluator &ae)
Fitting of certain DOFs to the zero level set of a function.
void AssembleGradPA(const Vector &, const FiniteElementSpace &) override
Prepare the integrator for partial assembly (PA) gradient evaluations on the given FE space fes at th...
void AssembleElemGradSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
void AssembleElementVector(const FiniteElement &el, ElementTransformation &T, const Vector &d_el, Vector &elvect) override
First defivative of GetElementEnergy() w.r.t. each local H1 DOF.
TMOP_Integrator(TMOP_QualityMetric *m, TargetConstructor *tc)
void AddMultPA_C0_2D(const Vector &, Vector &) const
void UpdateSurfaceFittingWeight(real_t factor)
Update the surface fitting weight as surf_fit_coeff *= factor;.
Array< Vector * > ElemDer
void IntegrateOverTarget(bool integ_over_target_)
TMOP_Integrator(TMOP_QualityMetric *m, TargetConstructor *tc, TMOP_QualityMetric *hm)
const Array< bool > * surf_fit_marker
real_t GetLocalStateEnergyPA(const Vector &) const override
Compute the local (to the MPI rank) energy with partial assembly.
const IntegrationRule & ActionIntegrationRule(const FiniteElement &el) const
void AddMultGradPA_C0_3D(const Vector &, Vector &) const
AdaptivityEvaluator * adapt_lim_eval
void ComputeFDh(const Vector &d, const FiniteElementSpace &fes)
Determines the perturbation, h, for FD-based approximation.
void AssembleElemVecSurfFit(const FiniteElement &el_x, IsoparametricTransformation &Tpr, DenseMatrix &mat)
void EnableLimiting(const GridFunction &n0, const GridFunction &dist, Coefficient &w0, TMOP_LimiterFunction *lfunc=NULL)
Limiting of the mesh displacements (general version).
void GetLocalNormalizationEnergiesPA_2D(const Vector &x, real_t &met_energy, real_t &lim_energy) const
Base class for limiting functions to be used in class TMOP_Integrator.
virtual real_t Eval(const Vector &x, const Vector &x0, real_t d) const =0
Returns the limiting function, f(x, x0, d).
virtual void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const =0
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
virtual ~TMOP_LimiterFunction()
Virtual destructor.
virtual void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const =0
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
2D non-barrier metric without a type.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< real_t > ie
int Id() const override
Return the metric ID.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator2D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const override
First-derivative hook for AD-based computations.
AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const override
Second-derivative hook for AD-based computations.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
InvariantsEvaluator2D< real_t > ie
type EvalW_AD_impl(const std::vector< type > &T, const std::vector< type > &W) const
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
2D barrier Shape+Size (VS) metric (not polyconvex).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
2D barrier Shape+Size (VS) metric (not polyconvex).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
2D non-barrier Shape+Size+Orientation (VOS) metric (polyconvex).
AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const override
Second-derivative hook for AD-based computations.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
int Id() const override
Return the metric ID.
AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const override
First-derivative hook for AD-based computations.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
type EvalW_AD_impl(const std::vector< type > &T, const std::vector< type > &W) const
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
2D Shifted barrier form of shape metric (mu_2).
TMOP_Metric_022(real_t &t0)
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const override
Second-derivative hook for AD-based computations.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator2D< real_t > ie
type EvalW_AD_impl(const std::vector< type > &T, const std::vector< type > &W) const
AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const override
First-derivative hook for AD-based computations.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator2D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
int Id() const override
Return the metric ID.
2D barrier shape (S) metric (not polyconvex).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
TMOP_QualityMetric * sz_metric
TMOP_QualityMetric * sh_metric
virtual ~TMOP_Metric_066()
InvariantsEvaluator2D< real_t > ie
TMOP_Metric_066(real_t gamma)
int Id() const override
Return the metric ID.
InvariantsEvaluator2D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
TMOP_QualityMetric * sh_metric
InvariantsEvaluator2D< real_t > ie
virtual ~TMOP_Metric_080()
int Id() const override
Return the metric ID.
TMOP_Metric_080(real_t gamma)
TMOP_QualityMetric * sz_metric
2D barrier Shape+Orientation (OS) metric (polyconvex).
int Id() const override
Return the metric ID.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
2D compound barrier Shape+Size (VS) metric (balanced).
int Id() const override
Return the metric ID.
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sh_metric
virtual ~TMOP_Metric_090()
TMOP_QualityMetric * sz_metric
2D compound barrier Shape+Size (VS) metric (balanced).
TMOP_QualityMetric * sz_metric
TMOP_QualityMetric * sh_metric
InvariantsEvaluator2D< real_t > ie
int Id() const override
Return the metric ID.
virtual ~TMOP_Metric_094()
2D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
int Id() const override
Return the metric ID.
TMOP_Metric_211(real_t epsilon=1e-4)
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
InvariantsEvaluator2D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
Shifted barrier form of metric 56 (area, ideal barrier metric), 2D.
int Id() const override
Return the metric ID.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator2D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
TMOP_Metric_252(real_t &t0)
Note that t0 is stored by reference.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
int Id() const override
Return the metric ID.
InvariantsEvaluator3D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
int Id() const override
Return the metric ID.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator3D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
InvariantsEvaluator3D< real_t > ie
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
3D barrier Shape (S) metric, well-posed (polyconvex & invex).
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator3D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
3D Size (V) untangling metric.
TMOP_Metric_311(real_t epsilon=1e-4)
int Id() const override
Return the metric ID.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
InvariantsEvaluator3D< real_t > ie
3D Shape (S) metric, untangling version of 303.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
TMOP_Metric_313(real_t &mindet)
InvariantsEvaluator3D< real_t > ie
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
InvariantsEvaluator3D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator3D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
InvariantsEvaluator3D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
3D barrier Shape+Size (VS) metric, well-posed (invex).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
InvariantsEvaluator3D< real_t > ie
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
int Id() const override
Return the metric ID.
3D barrier Shape+Size (VS) metric, well-posed (invex).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
int Id() const override
Return the metric ID.
3D barrier Shape+Size (VS) metric, well-posed (invex).
int Id() const override
Return the metric ID.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
InvariantsEvaluator3D< real_t > ie
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
int Id() const override
Return the metric ID.
TMOP_QualityMetric * sz_metric
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sh_metric
virtual ~TMOP_Metric_328()
3D compound barrier Shape+Size (VS) metric (polyconvex).
TMOP_QualityMetric * sh_metric
int Id() const override
Return the metric ID.
TMOP_QualityMetric * sz_metric
TMOP_Metric_332(real_t gamma)
virtual ~TMOP_Metric_332()
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
int Id() const override
Return the metric ID.
virtual ~TMOP_Metric_333()
TMOP_QualityMetric * sh_metric
TMOP_Metric_333(real_t gamma)
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sz_metric
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sz_metric
virtual ~TMOP_Metric_334()
int Id() const override
Return the metric ID.
TMOP_Metric_334(real_t gamma)
TMOP_QualityMetric * sh_metric
3D compound barrier Shape+Size (VS) metric (polyconvex, balanced).
TMOP_QualityMetric * sh_metric
InvariantsEvaluator2D< real_t > ie
TMOP_QualityMetric * sz_metric
virtual ~TMOP_Metric_338()
int Id() const override
Return the metric ID.
3D barrier Shape+Size+Orientation (VOS) metric (polyconvex).
InvariantsEvaluator3D< real_t > ie
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
int Id() const override
Return the metric ID.
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
3D barrier Shape+Size (VS) metric, well-posed (polyconvex).
int Id() const override
Return the metric ID.
TMOP_QualityMetric * sz_metric
TMOP_QualityMetric * sh_metric
virtual ~TMOP_Metric_347()
TMOP_Metric_347(real_t gamma)
InvariantsEvaluator2D< real_t > ie
3D shifted barrier form of metric 316 (not typed).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
int Id() const override
Return the metric ID.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
TMOP_Metric_352(real_t &t0)
3D non-barrier Shape (S) metric.
real_t EvalWMatrixForm(const DenseMatrix &Jpt) const override
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
InvariantsEvaluator3D< real_t > ie
int Id() const override
Return the metric ID.
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
2D non-barrier Aspect ratio metric.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
3D non-barrier Aspect ratio metric.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
3D non-barrier Skew metric.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
Default limiter function in TMOP_Integrator.
void Eval_d1(const Vector &x, const Vector &x0, real_t dist, Vector &d1) const override
Returns the gradient of the limiting function f(x, x0, d) with respect to x.
void Eval_d2(const Vector &x, const Vector &x0, real_t dist, DenseMatrix &d2) const override
Returns the Hessian of the limiting function f(x, x0, d) with respect to x.
real_t Eval(const Vector &x, const Vector &x0, real_t dist) const override
Returns the limiting function, f(x, x0, d).
virtual ~TMOP_QuadraticLimiter()
Abstract class for local mesh quality metrics in the target-matrix optimization paradigm (TMOP) by P....
void DefaultAssembleH(const DenseTensor &H, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const
See AssembleH(). This is a default implementation for the case when the 2nd derivatives of the metric...
virtual real_t EvalWMatrixForm(const DenseMatrix &Jpt) const
Evaluates the metric in matrix form (opposed to invariant form). Used for validating the invariant ev...
virtual void SetTargetJacobian(const DenseMatrix &Jtr_)
Specify the reference-element -> target-element Jacobian matrix for the point of interest.
virtual AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const
First-derivative hook for AD-based computations.
void SetTransformation(ElementTransformation &)
The method HyperelasticModel::SetTransformation() is hidden for TMOP_QualityMetrics,...
virtual AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const
Second-derivative hook for AD-based computations.
virtual ~TMOP_QualityMetric()
virtual int Id() const
Return the metric ID.
virtual void EvalPW(const DenseMatrix &Jpt, DenseMatrix &PW) const
virtual void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const =0
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
virtual void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const =0
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
virtual real_t EvalW(const DenseMatrix &Jpt) const =0
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
real_t EvalW(const DenseMatrix &Jpt) const override
Evaluate the strain energy density function, W = W(Jpt), by using the 2D or 3D matrix invariants,...
AD1Type EvalW_AD1(const std::vector< AD1Type > &T, const std::vector< AD1Type > &W) const override
First-derivative hook for AD-based computations.
void EvalP(const DenseMatrix &Jpt, DenseMatrix &P) const override
Evaluate the 1st Piola-Kirchhoff stress tensor, P = P(Jpt).
BarrierType GetBarrierType()
TMOP_QualityMetric & tmop_metric
void SetMinDetT(real_t min_detT_)
WorstCaseType GetWorstCaseType()
TMOP_WorstCaseUntangleOptimizer_Metric(TMOP_QualityMetric &tmop_metric_, int exponent_=1, real_t alpha_=1.5, real_t detT_ep_=0.0001, real_t muT_ep_=0.0001, BarrierType btype_=BarrierType::None, WorstCaseType wctype_=WorstCaseType::None)
void AssembleH(const DenseMatrix &Jpt, const DenseMatrix &DS, const real_t weight, DenseMatrix &A) const override
Evaluate the derivative of the 1st Piola-Kirchhoff stress tensor and assemble its contribution to the...
void SetMaxMuT(real_t max_muT_)
real_t EvalWBarrier(const DenseMatrix &Jpt) const
AD2Type EvalW_AD2(const std::vector< AD2Type > &T, const std::vector< AD2Type > &W) const override
Second-derivative hook for AD-based computations.
Base class representing target-matrix construction algorithms for mesh optimization via the target-ma...
void SetVolumeScale(real_t vol_scale)
Used by target type IDEAL_SHAPE_EQUAL_SIZE. The default volume scale is 1.
const TargetType target_type
void SetNodes(const GridFunction &n)
Set the nodes to be used in the target-matrix construction.
Geometry::Type current_W_type
Geometry type of current W matrix (used for cache invalidation).
void ComputeAvgVolume() const
virtual void ComputeElementTargetsGradient(const IntegrationRule &ir, const Vector &elfun, IsoparametricTransformation &Tpr, DenseTensor &dJtr) const
virtual void ComputeElementTargets(int e_id, const FiniteElement &fe, const IntegrationRule &ir, const Vector &elfun, DenseTensor &Jtr) const
Given an element and quadrature rule, computes ref->target transformation Jacobians for each quadratu...
virtual ~TargetConstructor()
bool UsesPhysicalCoordinates() const
Return true if the methods ComputeElementTargets(), ComputeAllElementTargets(), and ComputeElementTar...
TargetType GetTargetType() const
const GridFunction * GetNodes() const
Get the nodes to be used in the target-matrix construction.
const GridFunction * nodes
virtual bool ContainsVolumeInfo() const
Checks if the target matrices contain non-trivial size specification.
TargetType
Target-matrix construction algorithms supported by this class.
TargetConstructor(TargetType ttype)
Constructor for use in serial.
DenseMatrix current_W
Cached copy of GeomToPerfGeomJac used on device.
void ComputeAllElementTargets_Fallback(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
TargetConstructor(TargetType ttype, MPI_Comm mpicomm)
Constructor for use in parallel.
bool ComputeAllElementTargets(const FiniteElementSpace &fes, const IntegrationRule &ir, const Vector &xe, DenseTensor &Jtr) const
Base class for vector Coefficients that optionally depend on time and space.
real_t DistanceSquaredTo(const real_t *p) const
Compute the square of the Euclidean distance to another vector.
void Destroy()
Destroy a vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
This file contains the declaration of a dual number class.
future::dual< AD1Type, AD1Type > AD2Type
MFEM native AD-type for second derivatives.
future::dual< real_t, real_t > AD1Type
MFEM native AD-type for first derivatives.
void InterpolateTMOP_QualityMetric(TMOP_QualityMetric &metric, const TargetConstructor &tc, const Mesh &mesh, GridFunction &metric_gf)
Interpolates the metric's values at the nodes of metric_gf.
void subtract(const Vector &x, const Vector &y, Vector &z)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
MFEM_HOST_DEVICE Complex exp(const Complex &q)
Dual number struct (value plus gradient)
std::array< int, NCMesh::MaxFaceNodes > nodes