MFEM  v3.4
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 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 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 max_elements
 
double threshold
 
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 172 of file mesh_operators.hpp.

Constructor & Destructor Documentation

mfem::ThresholdRefiner::ThresholdRefiner ( ErrorEstimator est)

Construct a ThresholdRefiner using the given ErrorEstimator.

Definition at line 54 of file mesh_operators.cpp.

Member Function Documentation

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.

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

Definition at line 72 of file mesh_operators.cpp.

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

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

Definition at line 248 of file mesh_operators.hpp.

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

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

Definition at line 251 of file mesh_operators.hpp.

void mfem::ThresholdRefiner::PreferConformingRefinement ( )
inline

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

Definition at line 237 of file mesh_operators.hpp.

void mfem::ThresholdRefiner::PreferNonconformingRefinement ( )
inline

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

Definition at line 233 of file mesh_operators.hpp.

void mfem::ThresholdRefiner::Reset ( )
virtual

Reset the associated estimator.

Implements mfem::MeshOperator.

Definition at line 133 of file mesh_operators.cpp.

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 225 of file mesh_operators.hpp.

void mfem::ThresholdRefiner::SetMaxElements ( 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 230 of file mesh_operators.hpp.

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

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

Definition at line 241 of file mesh_operators.hpp.

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 219 of file mesh_operators.hpp.

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 213 of file mesh_operators.hpp.

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 208 of file mesh_operators.hpp.

Member Data Documentation

AnisotropicErrorEstimator* mfem::ThresholdRefiner::aniso_estimator
protected

Definition at line 176 of file mesh_operators.hpp.

long mfem::ThresholdRefiner::current_sequence
protected

Definition at line 188 of file mesh_operators.hpp.

ErrorEstimator& mfem::ThresholdRefiner::estimator
protected

Definition at line 175 of file mesh_operators.hpp.

double mfem::ThresholdRefiner::local_err_goal
protected

Definition at line 181 of file mesh_operators.hpp.

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

Definition at line 187 of file mesh_operators.hpp.

long mfem::ThresholdRefiner::max_elements
protected

Definition at line 182 of file mesh_operators.hpp.

int mfem::ThresholdRefiner::nc_limit
protected

Definition at line 191 of file mesh_operators.hpp.

int mfem::ThresholdRefiner::non_conforming
protected

Definition at line 190 of file mesh_operators.hpp.

long mfem::ThresholdRefiner::num_marked_elements
protected

Definition at line 185 of file mesh_operators.hpp.

double mfem::ThresholdRefiner::threshold
protected

Definition at line 184 of file mesh_operators.hpp.

double mfem::ThresholdRefiner::total_err_goal
protected

Definition at line 179 of file mesh_operators.hpp.

double mfem::ThresholdRefiner::total_fraction
protected

Definition at line 180 of file mesh_operators.hpp.

double mfem::ThresholdRefiner::total_norm_p
protected

Definition at line 178 of file mesh_operators.hpp.


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