MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
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.
 
virtual int PreprocessMesh (Mesh &mesh, int max_it)
 Apply the operator to the mesh max_it times or until tolerance achieved.
 
int PreprocessMesh (Mesh &mesh)
 
void SetThreshold (real_t threshold_)
 Set the refinement threshold. The default value is 1.0e-2.
 
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.
 
void ResetCoefficient (Coefficient &coeff_)
 Reset the function f.
 
void SetOrder (int order_)
 Reset the oscillation order.
 
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.

 
void SetIntRule (const IntegrationRule *irs_[])
 
void PrintWarnings ()
 
real_t GetOsc () const
 
const VectorGetLocalOscs () const
 
virtual void Reset ()
 Reset.
 
- 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 ~MeshOperator ()
 The destructor is virtual.
 

Protected Member Functions

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

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()
 
real_t threshold = 1.0e-2
 
real_t 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),
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30

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

◆ CoefficientRefiner()

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

Constructor.

Definition at line 354 of file mesh_operators.hpp.

Member Function Documentation

◆ ApplyImpl()

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.

◆ GetLocalOscs()

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

Definition at line 414 of file mesh_operators.hpp.

◆ GetOsc()

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

Definition at line 411 of file mesh_operators.hpp.

◆ PreprocessMesh() [1/2]

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

Definition at line 369 of file mesh_operators.hpp.

◆ PreprocessMesh() [2/2]

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.

◆ PrintWarnings()

void mfem::CoefficientRefiner::PrintWarnings ( )
inline

Definition at line 408 of file mesh_operators.hpp.

◆ Reset()

void mfem::CoefficientRefiner::Reset ( )
virtual

Reset.

Implements mfem::MeshOperator.

Definition at line 288 of file mesh_operators.cpp.

◆ ResetCoefficient()

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

Reset the function f.

Definition at line 384 of file mesh_operators.hpp.

◆ SetIntRule()

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

Definition at line 405 of file mesh_operators.hpp.

◆ SetMaxElements()

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.

◆ SetNCLimit()

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.

◆ SetOrder()

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

Reset the oscillation order.

Definition at line 392 of file mesh_operators.hpp.

◆ SetThreshold()

void mfem::CoefficientRefiner::SetThreshold ( real_t 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

◆ coeff

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

Definition at line 343 of file mesh_operators.hpp.

◆ element_oscs

Vector mfem::CoefficientRefiner::element_oscs
protected

Definition at line 342 of file mesh_operators.hpp.

◆ global_osc

real_t mfem::CoefficientRefiner::global_osc = NAN
protected

Definition at line 340 of file mesh_operators.hpp.

◆ ir_default

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

Definition at line 344 of file mesh_operators.hpp.

◆ irs

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

Definition at line 345 of file mesh_operators.hpp.

◆ max_elements

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

Definition at line 338 of file mesh_operators.hpp.

◆ mesh_refinements

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

Definition at line 341 of file mesh_operators.hpp.

◆ nc_limit

int mfem::CoefficientRefiner::nc_limit = 1
protected

Definition at line 335 of file mesh_operators.hpp.

◆ nonconforming

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

Definition at line 336 of file mesh_operators.hpp.

◆ order

int mfem::CoefficientRefiner::order
protected

Definition at line 337 of file mesh_operators.hpp.

◆ print_level

bool mfem::CoefficientRefiner::print_level = false
protected

Definition at line 334 of file mesh_operators.hpp.

◆ threshold

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