MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
mfem::ThresholdRefiner Class Reference

Mesh refinement operator using an error threshold. More...

#include <mesh_operators.hpp>

Inheritance diagram for mfem::ThresholdRefiner:
[legend]
Collaboration diagram for mfem::ThresholdRefiner:
[legend]

Public Member Functions

 ThresholdRefiner (ErrorEstimator &est)
 Construct a ThresholdRefiner using the given ErrorEstimator.
 
void SetTotalErrorNormP (real_t norm_p=infinity())
 Set the exponent, p, of the discrete p-norm used to compute the total error from the local element errors.
 
void SetTotalErrorGoal (real_t err_goal)
 Set the total error stopping criterion: stop when total_err <= total_err_goal. The default value is zero.
 
void SetTotalErrorFraction (real_t fraction)
 Set the total fraction used in the computation of the threshold. The default value is 1/2.
 
void SetLocalErrorGoal (real_t err_goal)
 Set the local stopping criterion: stop when local_err_i <= local_err_goal. The default value is zero.
 
void SetMaxElements (long long max_elem)
 Set the maximum number of elements stopping criterion: stop when the input mesh has num_elements >= max_elem. The default value is LONG_MAX.
 
void PreferNonconformingRefinement ()
 Use nonconforming refinement, if possible (triangles, quads, hexes).
 
void PreferConformingRefinement ()
 Use conforming refinement, if possible (triangles, tetrahedra) – this is the default.
 
void SetNCLimit (int nc_limit_)
 Set the maximum ratio of refinement levels of adjacent elements (0 = unlimited).
 
long long GetNumMarkedElements () const
 Get the number of marked elements in the last Apply() call.
 
real_t GetThreshold () const
 Get the threshold used in the last Apply() call.
 
virtual void Reset ()
 Reset the associated estimator.
 
- Public Member Functions inherited from mfem::MeshOperator
bool Apply (Mesh &mesh)
 Perform the mesh operation.
 
bool Stop () const
 Check if STOP action is requested, e.g. stopping criterion is satisfied.
 
bool Repeat () const
 Check if REPEAT action is requested, i.e. FiniteElementSpaces and GridFunctions need to be updated, and Apply() must be called again.
 
bool Continue () const
 Check if CONTINUE action is requested, i.e. FiniteElementSpaces and GridFunctions need to be updated and computations should continue.
 
bool Refined () const
 Check if the mesh was refined.
 
bool Derefined () const
 Check if the mesh was de-refined.
 
bool Rebalanced () const
 Check if the mesh was rebalanced.
 
int GetActionInfo () const
 Get the full ActionInfo value generated by the last call to Apply().
 
virtual void Reset ()=0
 Reset the MeshOperator.
 
virtual ~MeshOperator ()
 The destructor is virtual.
 

Protected Member Functions

real_t GetNorm (const Vector &local_err, Mesh &mesh) const
 
virtual int ApplyImpl (Mesh &mesh)
 Apply the operator to the mesh.
 
- Protected Member Functions inherited from mfem::MeshOperator
virtual int ApplyImpl (Mesh &mesh)=0
 Implementation of the mesh operation. Invoked by the Apply() public method.
 
 MeshOperator ()
 Constructor to be used by derived classes.
 

Protected Attributes

ErrorEstimatorestimator
 
AnisotropicErrorEstimatoraniso_estimator
 
real_t total_norm_p
 
real_t total_err_goal
 
real_t total_fraction
 
real_t local_err_goal
 
long long max_elements
 
real_t threshold
 
long long num_marked_elements
 
Array< Refinementmarked_elements
 
long current_sequence
 
int non_conforming
 
int nc_limit
 

Additional Inherited Members

- Public Types inherited from mfem::MeshOperator
enum  Action {
  NONE = 0 , CONTINUE = 1 , STOP = 2 , REPEAT = 3 ,
  MASK_UPDATE = 1 , MASK_ACTION = 3
}
 Action and information constants and masks. More...
 
enum  Info { REFINED = 4*1 , DEREFINED = 4*2 , REBALANCED = 4*3 , MASK_INFO = ~3 }
 

Detailed Description

Mesh refinement operator using an error threshold.

This class uses the given ErrorEstimator to estimate local element errors and then marks for refinement all elements i such that loc_err_i > threshold. The threshold is computed as

threshold = max(total_err * total_fraction * pow(num_elements,-1.0/p),
real_t p(const Vector &x, real_t t)
Definition: navier_mms.cpp:53

where p (=total_norm_p), total_fraction, and local_err_goal are settable parameters, total_err = (sum_i local_err_i^p)^{1/p}, when p < inf, or total_err = max_i local_err_i, when p = inf.

Definition at line 175 of file mesh_operators.hpp.

Constructor & Destructor Documentation

◆ ThresholdRefiner()

mfem::ThresholdRefiner::ThresholdRefiner ( ErrorEstimator est)

Construct a ThresholdRefiner using the given ErrorEstimator.

Definition at line 54 of file mesh_operators.cpp.

Member Function Documentation

◆ ApplyImpl()

int mfem::ThresholdRefiner::ApplyImpl ( Mesh mesh)
protectedvirtual

Apply the operator to the mesh.

Returns
STOP if a stopping criterion is satisfied or no elements were marked for refinement; REFINED + CONTINUE otherwise.

Implements mfem::MeshOperator.

Definition at line 84 of file mesh_operators.cpp.

◆ GetNorm()

real_t mfem::ThresholdRefiner::GetNorm ( const Vector local_err,
Mesh mesh 
) const
protected

Definition at line 72 of file mesh_operators.cpp.

◆ GetNumMarkedElements()

long long mfem::ThresholdRefiner::GetNumMarkedElements ( ) const
inline

Get the number of marked elements in the last Apply() call.

Definition at line 251 of file mesh_operators.hpp.

◆ GetThreshold()

real_t mfem::ThresholdRefiner::GetThreshold ( ) const
inline

Get the threshold used in the last Apply() call.

Definition at line 254 of file mesh_operators.hpp.

◆ PreferConformingRefinement()

void mfem::ThresholdRefiner::PreferConformingRefinement ( )
inline

Use conforming refinement, if possible (triangles, tetrahedra) – this is the default.

Definition at line 240 of file mesh_operators.hpp.

◆ PreferNonconformingRefinement()

void mfem::ThresholdRefiner::PreferNonconformingRefinement ( )
inline

Use nonconforming refinement, if possible (triangles, quads, hexes).

Definition at line 236 of file mesh_operators.hpp.

◆ Reset()

void mfem::ThresholdRefiner::Reset ( )
virtual

Reset the associated estimator.

Implements mfem::MeshOperator.

Definition at line 140 of file mesh_operators.cpp.

◆ SetLocalErrorGoal()

void mfem::ThresholdRefiner::SetLocalErrorGoal ( real_t  err_goal)
inline

Set the local stopping criterion: stop when local_err_i <= local_err_goal. The default value is zero.

Note
If local_err_goal == 0, it is essentially ignored in the threshold computation.

Definition at line 228 of file mesh_operators.hpp.

◆ SetMaxElements()

void mfem::ThresholdRefiner::SetMaxElements ( long long  max_elem)
inline

Set the maximum number of elements stopping criterion: stop when the input mesh has num_elements >= max_elem. The default value is LONG_MAX.

Definition at line 233 of file mesh_operators.hpp.

◆ SetNCLimit()

void mfem::ThresholdRefiner::SetNCLimit ( int  nc_limit_)
inline

Set the maximum ratio of refinement levels of adjacent elements (0 = unlimited).

Definition at line 244 of file mesh_operators.hpp.

◆ SetTotalErrorFraction()

void mfem::ThresholdRefiner::SetTotalErrorFraction ( real_t  fraction)
inline

Set the total fraction used in the computation of the threshold. The default value is 1/2.

Note
If fraction == 0, total_err is essentially ignored in the threshold computation, i.e. threshold = local error goal.

Definition at line 222 of file mesh_operators.hpp.

◆ SetTotalErrorGoal()

void mfem::ThresholdRefiner::SetTotalErrorGoal ( real_t  err_goal)
inline

Set the total error stopping criterion: stop when total_err <= total_err_goal. The default value is zero.

Definition at line 216 of file mesh_operators.hpp.

◆ SetTotalErrorNormP()

void mfem::ThresholdRefiner::SetTotalErrorNormP ( real_t  norm_p = infinity())
inline

Set the exponent, p, of the discrete p-norm used to compute the total error from the local element errors.

Definition at line 211 of file mesh_operators.hpp.

Member Data Documentation

◆ aniso_estimator

AnisotropicErrorEstimator* mfem::ThresholdRefiner::aniso_estimator
protected

Definition at line 179 of file mesh_operators.hpp.

◆ current_sequence

long mfem::ThresholdRefiner::current_sequence
protected

Definition at line 191 of file mesh_operators.hpp.

◆ estimator

ErrorEstimator& mfem::ThresholdRefiner::estimator
protected

Definition at line 178 of file mesh_operators.hpp.

◆ local_err_goal

real_t mfem::ThresholdRefiner::local_err_goal
protected

Definition at line 184 of file mesh_operators.hpp.

◆ marked_elements

Array<Refinement> mfem::ThresholdRefiner::marked_elements
protected

Definition at line 190 of file mesh_operators.hpp.

◆ max_elements

long long mfem::ThresholdRefiner::max_elements
protected

Definition at line 185 of file mesh_operators.hpp.

◆ nc_limit

int mfem::ThresholdRefiner::nc_limit
protected

Definition at line 194 of file mesh_operators.hpp.

◆ non_conforming

int mfem::ThresholdRefiner::non_conforming
protected

Definition at line 193 of file mesh_operators.hpp.

◆ num_marked_elements

long long mfem::ThresholdRefiner::num_marked_elements
protected

Definition at line 188 of file mesh_operators.hpp.

◆ threshold

real_t mfem::ThresholdRefiner::threshold
protected

Definition at line 187 of file mesh_operators.hpp.

◆ total_err_goal

real_t mfem::ThresholdRefiner::total_err_goal
protected

Definition at line 182 of file mesh_operators.hpp.

◆ total_fraction

real_t mfem::ThresholdRefiner::total_fraction
protected

Definition at line 183 of file mesh_operators.hpp.

◆ total_norm_p

real_t mfem::ThresholdRefiner::total_norm_p
protected

Definition at line 181 of file mesh_operators.hpp.


The documentation for this class was generated from the following files: