libMesh
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
libMesh::ErrorEstimator Class Referenceabstract

This class holds functions that will estimate the error in a finite element solution on a given mesh. More...

#include <error_estimator.h>

Inheritance diagram for libMesh::ErrorEstimator:
[legend]

Public Types

typedef std::map< std::pair< const System *, unsigned int >, ErrorVector * > ErrorMap
 When calculating many error vectors at once, we need a data structure to hold them all. More...
 

Public Member Functions

 ErrorEstimator ()=default
 Constructor. More...
 
 ErrorEstimator (const ErrorEstimator &)=default
 Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this simple class. More...
 
 ErrorEstimator (ErrorEstimator &&)=default
 
ErrorEstimatoroperator= (const ErrorEstimator &)=default
 
ErrorEstimatoroperator= (ErrorEstimator &&)=default
 
virtual ~ErrorEstimator ()=default
 
virtual void estimate_error (const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false)=0
 This pure virtual function must be redefined in derived classes to compute the error for each active element and place it in the "error_per_cell" vector. More...
 
virtual void estimate_errors (const EquationSystems &equation_systems, ErrorVector &error_per_cell, const std::map< const System *, SystemNorm > &error_norms, const std::map< const System *, const NumericVector< Number > *> *solution_vectors=nullptr, bool estimate_parent_error=false)
 This virtual function can be redefined in derived classes, but by default computes the sum of the error_per_cell for each system in the equation_systems. More...
 
virtual void estimate_errors (const EquationSystems &equation_systems, ErrorMap &errors_per_cell, const std::map< const System *, const NumericVector< Number > *> *solution_vectors=nullptr, bool estimate_parent_error=false)
 This virtual function can be redefined in derived classes, but by default it calls estimate_error repeatedly to calculate the requested error vectors. More...
 
virtual ErrorEstimatorType type () const =0
 

Public Attributes

SystemNorm error_norm
 When estimating the error in a single system, the error_norm is used to control the scaling and norm choice for each variable. More...
 

Protected Member Functions

void reduce_error (std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const
 This method takes the local error contributions in error_per_cell from each processor and combines them to get the global error vector. More...
 

Detailed Description

This class holds functions that will estimate the error in a finite element solution on a given mesh.

These error estimates can be useful in their own right, or may be used to guide adaptive mesh refinement.

Note
The computed errors are stored as floats rather than doubles since the required precision is low.
Author
Benjamin S. Kirk
Date
2003

Definition at line 64 of file error_estimator.h.

Member Typedef Documentation

◆ ErrorMap

typedef std::map<std::pair<const System *, unsigned int>, ErrorVector *> libMesh::ErrorEstimator::ErrorMap

When calculating many error vectors at once, we need a data structure to hold them all.

Definition at line 124 of file error_estimator.h.

Constructor & Destructor Documentation

◆ ErrorEstimator() [1/3]

libMesh::ErrorEstimator::ErrorEstimator ( )
default

Constructor.

Empty. Derived classes should reset error_norm as appropriate.

◆ ErrorEstimator() [2/3]

libMesh::ErrorEstimator::ErrorEstimator ( const ErrorEstimator )
default

Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this simple class.

◆ ErrorEstimator() [3/3]

libMesh::ErrorEstimator::ErrorEstimator ( ErrorEstimator &&  )
default

◆ ~ErrorEstimator()

virtual libMesh::ErrorEstimator::~ErrorEstimator ( )
virtualdefault

Member Function Documentation

◆ estimate_error()

virtual void libMesh::ErrorEstimator::estimate_error ( const System system,
ErrorVector error_per_cell,
const NumericVector< Number > *  solution_vector = nullptr,
bool  estimate_parent_error = false 
)
pure virtual

This pure virtual function must be redefined in derived classes to compute the error for each active element and place it in the "error_per_cell" vector.

If solution_vector is not nullptr, the estimator will (if able) attempt to estimate an error in that field instead of in system.solution.

If estimate_parent_error is not false, the estimator will (if able) attempt to give a consistent estimate of errors in parent elements that would be generated by coarsening.

Implemented in libMesh::ExactErrorEstimator, libMesh::AdjointResidualErrorEstimator, libMesh::AdjointRefinementEstimator, libMesh::JumpErrorEstimator, libMesh::PatchRecoveryErrorEstimator, libMesh::UniformRefinementEstimator, and libMesh::WeightedPatchRecoveryErrorEstimator.

◆ estimate_errors() [1/2]

virtual void libMesh::ErrorEstimator::estimate_errors ( const EquationSystems equation_systems,
ErrorVector error_per_cell,
const std::map< const System *, SystemNorm > &  error_norms,
const std::map< const System *, const NumericVector< Number > *> *  solution_vectors = nullptr,
bool  estimate_parent_error = false 
)
virtual

This virtual function can be redefined in derived classes, but by default computes the sum of the error_per_cell for each system in the equation_systems.

Currently this function ignores the error_norm member variable, and uses the function argument error_norms instead.

This function is named estimate_errors instead of estimate_error because otherwise C++ can get confused.

Reimplemented in libMesh::UniformRefinementEstimator.

◆ estimate_errors() [2/2]

virtual void libMesh::ErrorEstimator::estimate_errors ( const EquationSystems equation_systems,
ErrorMap errors_per_cell,
const std::map< const System *, const NumericVector< Number > *> *  solution_vectors = nullptr,
bool  estimate_parent_error = false 
)
virtual

This virtual function can be redefined in derived classes, but by default it calls estimate_error repeatedly to calculate the requested error vectors.

Currently this function ignores the error_norm.weight() values because it calculates each variable's error individually, unscaled.

The user selects which errors get computed by filling a map with error vectors: If errors_per_cell[&system][v] exists, it will be filled with the error values in variable v of system

Reimplemented in libMesh::UniformRefinementEstimator.

◆ operator=() [1/2]

ErrorEstimator& libMesh::ErrorEstimator::operator= ( const ErrorEstimator )
default

◆ operator=() [2/2]

ErrorEstimator& libMesh::ErrorEstimator::operator= ( ErrorEstimator &&  )
default

◆ reduce_error()

void libMesh::ErrorEstimator::reduce_error ( std::vector< ErrorVectorReal > &  error_per_cell,
const Parallel::Communicator comm 
) const
protected

This method takes the local error contributions in error_per_cell from each processor and combines them to get the global error vector.

◆ type()

virtual ErrorEstimatorType libMesh::ErrorEstimator::type ( ) const
pure virtual

Member Data Documentation

◆ error_norm

SystemNorm libMesh::ErrorEstimator::error_norm

When estimating the error in a single system, the error_norm is used to control the scaling and norm choice for each variable.

Not all estimators will support all norm choices. The default scaling is for all variables to be weighted equally. The default norm choice depends on the error estimator.

Part of this functionality was supported via component_scale and sobolev_order in older libMesh versions, and a small part was supported via component_mask in even older versions. Hopefully the encapsulation here will allow us to avoid changing this API again.

Definition at line 161 of file error_estimator.h.


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