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

Protected Member Functions

double GetNorm (const Vector &local_err, Mesh &mesh) const
 
virtual int ApplyImpl (Mesh &mesh)
 Apply the operator to the mesh. More...
 
- Protected Member Functions inherited from mfem::MeshOperator
 MeshOperator ()
 Constructor to be used by derived classes. More...
 

Protected Attributes

ErrorEstimatorestimator
 
AnisotropicErrorEstimatoraniso_estimator
 
double total_norm_p
 
double total_err_goal
 
double total_fraction
 
double local_err_goal
 
long long max_elements
 
double 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),

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()

double 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()

double 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 ( double  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 ( double  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 ( double  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 ( double  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

double 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

double mfem::ThresholdRefiner::threshold
protected

Definition at line 187 of file mesh_operators.hpp.

◆ total_err_goal

double mfem::ThresholdRefiner::total_err_goal
protected

Definition at line 182 of file mesh_operators.hpp.

◆ total_fraction

double mfem::ThresholdRefiner::total_fraction
protected

Definition at line 183 of file mesh_operators.hpp.

◆ total_norm_p

double 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: