|
Hermes2D
3.0
|
Evaluation of an error between a (coarse) solution and a reference solution. More...
#include <error_calculator.h>
Inheritance diagram for Hermes::Hermes2D::ErrorCalculator< Scalar >:Classes | |
| struct | ElementReference |
| A reference to an element. More... | |
Public Member Functions | |
| ErrorCalculator (CalculatedErrorType errorType) | |
| void | calculate_errors (std::vector< MeshFunctionSharedPtr< Scalar > > coarse_solutions, std::vector< MeshFunctionSharedPtr< Scalar > > fine_solutions, bool sort_and_store=true) |
| void | calculate_errors (MeshFunctionSharedPtr< Scalar > coarse_solution, MeshFunctionSharedPtr< Scalar > fine_solution, bool sort_and_store=true) |
| virtual | ~ErrorCalculator () |
| Destructor. Deallocates allocated private data. | |
| void | add_error_form (NormFormVol< Scalar > *form) |
| void | add_error_form (NormFormSurf< Scalar > *form) |
| void | add_error_form (NormFormDG< Scalar > *form) |
| double | get_element_error_squared (int component, int element_id) const |
| Returns a squared error of an element. More... | |
| double | get_element_norm_squared (int component, int element_id) const |
| double | get_error_squared (int component) const |
| double | get_norm_squared (int component) const |
| double | get_total_error_squared () const |
| double | get_total_norm_squared () const |
| int | get_component_count () const |
| const ElementReference & | get_element_reference (unsigned int id) const |
| A queue of elements which should be processes. The queue had to be filled by the method fill_regular_queue(). | |
| MeshFunctionSharedPtr< double > | get_errorMeshFunction (int component=0) |
| void | free () |
| Frees the data. | |
Protected Member Functions | |
| virtual bool | isOkay () const |
| State querying helpers. | |
| std::string | getClassName () const |
| bool | data_prepared_for_querying () const |
| Common check for data querying. | |
| void | init_data_storage () |
| Initialize the data storage. | |
| void | postprocess_error () |
Static Protected Member Functions | |
| static int | compareElementReference (const void *a, const void *b) |
Protected Attributes | |
|
std::vector < MeshFunctionSharedPtr < Scalar > > | coarse_solutions |
| Data. | |
|
std::vector < MeshFunctionSharedPtr < Scalar > > | fine_solutions |
| CalculatedErrorType | errorType |
| Absolute / Relative error. | |
| ElementReference * | element_references |
| A queue of elements which should be processes. The queue had to be filled by the method fill_regular_queue(). | |
| int | component_count |
| Number of solution components. | |
| int | num_act_elems |
| A total number of active elements across all provided meshes. | |
| double * | errors [H2D_MAX_COMPONENTS] |
| Errors of elements. Meaning of the error depeds on the errorType. | |
| double * | norms [H2D_MAX_COMPONENTS] |
| double | component_errors [H2D_MAX_COMPONENTS] |
| double | component_norms [H2D_MAX_COMPONENTS] |
| int | element_count [H2D_MAX_COMPONENTS] |
| double | errors_squared_sum |
| double | norms_squared_sum |
| MeshFunctionSharedPtr< double > | errorMeshFunction [H2D_MAX_COMPONENTS] |
| Error mesh function - for visualization and other postprocessing of the element-wise error. | |
|
std::vector< NormFormVol < Scalar > * > | mfvol |
| Holds volumetric matrix forms. | |
|
std::vector< NormFormSurf < Scalar > * > | mfsurf |
| Holds surface matrix forms. | |
|
std::vector< NormFormDG < Scalar > * > | mfDG |
| Holds DG matrix forms. | |
| bool | elements_stored |
| This is for adaptivity, saying that the errors are the correct ones. | |
Protected Attributes inherited from Hermes::Hermes2D::Mixins::Parallel | |
| unsigned char | num_threads_used |
| std::string | exceptionMessageCaughtInParallelBlock |
Friends | |
| class | Adapt< Scalar > |
| class | ErrorThreadCalculator< Scalar > |
Evaluation of an error between a (coarse) solution and a reference solution.
The class calculates error estimates and it acts as a container for the calculated errors.
| Hermes::Hermes2D::ErrorCalculator< Scalar >::ErrorCalculator | ( | CalculatedErrorType | errorType | ) |
Constructor. Suitable for problems where various solution components belong to different spaces (L2, H1, Hcurl, Hdiv). If proj_norms are not specified, they are defined according to the spaces.
Definition at line 26 of file error_calculator.cpp.
| void Hermes::Hermes2D::ErrorCalculator< Scalar >::add_error_form | ( | NormFormVol< Scalar > * | form | ) |
Adds user defined norm form which is used to calculate error. If the errorType is CalculatedErrorType::RelativeError, this form is also used as a "norm" form to divide the absolute error by the norm of the "fine" solution(s).
Definition at line 283 of file error_calculator.cpp.
| void Hermes::Hermes2D::ErrorCalculator< Scalar >::calculate_errors | ( | std::vector< MeshFunctionSharedPtr< Scalar > > | coarse_solutions, |
| std::vector< MeshFunctionSharedPtr< Scalar > > | fine_solutions, | ||
| bool | sort_and_store = true |
||
| ) |
Calculates the errors between coarse_solutions and fine_solutions.
| [in] | sort_and_store | If true, these errors are going to be sorted, stored and used for the purposes of adaptivity. IMPORTANT: if the parameter is passed as false, this, and also any previous error calculations are lost and it is not possible to get back to them. |
Definition at line 154 of file error_calculator.cpp.
| void Hermes::Hermes2D::ErrorCalculator< Scalar >::calculate_errors | ( | MeshFunctionSharedPtr< Scalar > | coarse_solution, |
| MeshFunctionSharedPtr< Scalar > | fine_solution, | ||
| bool | sort_and_store = true |
||
| ) |
Calculates the errors between coarse_solutions and fine_solutions.
| [in] | sort_and_store | If true, these errors are going to be sorted, stored and used for the purposes of adaptivity. |
Definition at line 120 of file error_calculator.cpp.
| double Hermes::Hermes2D::ErrorCalculator< Scalar >::get_element_error_squared | ( | int | component, |
| int | element_id | ||
| ) | const |
Returns a squared error of an element.
| [in] | component | A component index. |
| [in] | element_id | An element index. |
Definition at line 319 of file error_calculator.cpp.
| MeshFunctionSharedPtr< double > Hermes::Hermes2D::ErrorCalculator< Scalar >::get_errorMeshFunction | ( | int | component = 0 | ) |
Return the error mesh function - for visualization and other postprocessing of the element-wise error.
| component | The component. |
Definition at line 44 of file error_calculator.cpp.
|
protected |
Sums calculation & error postprocessing (make it relative). Called at the end of error_calculation.
Definition at line 235 of file error_calculator.cpp.