MFEM  v4.5.1
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::CoefficientRefiner Class Reference

Refinement operator to control data oscillation. More...

#include <mesh_operators.hpp>

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

Public Member Functions

 CoefficientRefiner (Coefficient &coeff_, int order_)
 Constructor. More...
 
virtual int PreprocessMesh (Mesh &mesh, int max_it)
 Apply the operator to the mesh max_it times or until tolerance achieved. More...
 
int PreprocessMesh (Mesh &mesh)
 
void SetThreshold (double threshold_)
 Set the refinement threshold. The default value is 1.0e-2. More...
 
void SetMaxElements (long long max_elements_)
 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 ResetCoefficient (Coefficient &coeff_)
 Reset the function f. More...
 
void SetOrder (int order_)
 Reset the oscillation order. More...
 
void SetNCLimit (int nc_limit_)
 Set the maximum ratio of refinement levels of adjacent elements (0 = unlimited). The default value is 1, which helps ensure appropriate refinements in pathological situations where the default quadrature order is too low. More...
 
void SetIntRule (const IntegrationRule *irs_[])
 
void PrintWarnings ()
 
double GetOsc () const
 
const VectorGetLocalOscs () const
 
virtual void Reset ()
 Reset. 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

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

Protected Attributes

bool print_level = false
 
int nc_limit = 1
 
int nonconforming = -1
 
int order
 
long long max_elements = std::numeric_limits<long long>::max()
 
double threshold = 1.0e-2
 
double global_osc = NAN
 
Array< int > mesh_refinements
 
Vector element_oscs
 
Coefficientcoeff = NULL
 
const IntegrationRuleir_default [Geometry::NumGeom]
 
const IntegrationRule ** irs = NULL
 

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

Refinement operator to control data oscillation.

This class computes osc_K(f) := || h ⋅ (I - Π) f ||_K at each element K. Here, Π is the L2-projection and ||⋅||_K is the L2-norm, restricted to the element K. All elements satisfying the inequality

osc_K(f) > threshold ⋅ ||f|| / sqrt(n_el),

are refined. Here, threshold is a positive parameter, ||⋅|| is the L2-norm over the entire domain Ω, and n_el is the number of elements in the mesh.

Note that if osc(f) = threshold ⋅ ||f|| / sqrt(n_el) for each K, then

osc(f) = sqrt(sum_K osc_K^2(f)) = threshold ⋅ ||f||.

This is the reason for the 1/sqrt(n_el) factor.

Definition at line 331 of file mesh_operators.hpp.

Constructor & Destructor Documentation

mfem::CoefficientRefiner::CoefficientRefiner ( Coefficient coeff_,
int  order_ 
)
inline

Constructor.

Definition at line 354 of file mesh_operators.hpp.

Member Function Documentation

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

Apply the operator to the mesh once.

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

Implements mfem::MeshOperator.

Definition at line 160 of file mesh_operators.cpp.

const Vector& mfem::CoefficientRefiner::GetLocalOscs ( ) const
inline

Definition at line 414 of file mesh_operators.hpp.

double mfem::CoefficientRefiner::GetOsc ( ) const
inline

Definition at line 411 of file mesh_operators.hpp.

int mfem::CoefficientRefiner::PreprocessMesh ( Mesh mesh,
int  max_it 
)
virtual

Apply the operator to the mesh max_it times or until tolerance achieved.

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

Definition at line 166 of file mesh_operators.cpp.

int mfem::CoefficientRefiner::PreprocessMesh ( Mesh mesh)
inline

Definition at line 369 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::PrintWarnings ( )
inline

Definition at line 408 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::Reset ( )
virtual

Reset.

Implements mfem::MeshOperator.

Definition at line 287 of file mesh_operators.cpp.

void mfem::CoefficientRefiner::ResetCoefficient ( Coefficient coeff_)
inline

Reset the function f.

Definition at line 384 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::SetIntRule ( const IntegrationRule irs_[])
inline

Definition at line 405 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::SetMaxElements ( long long  max_elements_)
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 381 of file mesh_operators.hpp.

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

Set the maximum ratio of refinement levels of adjacent elements (0 = unlimited). The default value is 1, which helps ensure appropriate refinements in pathological situations where the default quadrature order is too low.

Definition at line 398 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::SetOrder ( int  order_)
inline

Reset the oscillation order.

Definition at line 392 of file mesh_operators.hpp.

void mfem::CoefficientRefiner::SetThreshold ( double  threshold_)
inline

Set the refinement threshold. The default value is 1.0e-2.

Definition at line 376 of file mesh_operators.hpp.

Member Data Documentation

Coefficient* mfem::CoefficientRefiner::coeff = NULL
protected

Definition at line 343 of file mesh_operators.hpp.

Vector mfem::CoefficientRefiner::element_oscs
protected

Definition at line 342 of file mesh_operators.hpp.

double mfem::CoefficientRefiner::global_osc = NAN
protected

Definition at line 340 of file mesh_operators.hpp.

const IntegrationRule* mfem::CoefficientRefiner::ir_default[Geometry::NumGeom]
protected

Definition at line 344 of file mesh_operators.hpp.

const IntegrationRule** mfem::CoefficientRefiner::irs = NULL
protected

Definition at line 345 of file mesh_operators.hpp.

long long mfem::CoefficientRefiner::max_elements = std::numeric_limits<long long>::max()
protected

Definition at line 338 of file mesh_operators.hpp.

Array<int> mfem::CoefficientRefiner::mesh_refinements
protected

Definition at line 341 of file mesh_operators.hpp.

int mfem::CoefficientRefiner::nc_limit = 1
protected

Definition at line 335 of file mesh_operators.hpp.

int mfem::CoefficientRefiner::nonconforming = -1
protected

Definition at line 336 of file mesh_operators.hpp.

int mfem::CoefficientRefiner::order
protected

Definition at line 337 of file mesh_operators.hpp.

bool mfem::CoefficientRefiner::print_level = false
protected

Definition at line 334 of file mesh_operators.hpp.

double mfem::CoefficientRefiner::threshold = 1.0e-2
protected

Definition at line 339 of file mesh_operators.hpp.


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