libMesh
Loading...
Searching...
No Matches
error_estimator.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20#ifndef LIBMESH_ERROR_ESTIMATOR_H
21#define LIBMESH_ERROR_ESTIMATOR_H
22
23// Local Includes
24#include "libmesh/libmesh_common.h"
25#include "libmesh/system_norm.h"
26
27// C++ includes
28#include <cstddef>
29#include <map>
30#include <string>
31#include <vector>
32#include <memory>
33
34namespace libMesh
35{
36
37// Forward Declarations
38class ErrorVector;
39class EquationSystems;
40class System;
41template <typename T> class NumericVector;
42
43namespace Parallel {
44 class Communicator;
45}
46
48
62{
63public:
64
69 ErrorEstimator() = default;
70
75 ErrorEstimator (const ErrorEstimator &) = default;
79 virtual ~ErrorEstimator() = default;
80
81
95 virtual void estimate_error (const System & system,
96 ErrorVector & error_per_cell,
97 const NumericVector<Number> * solution_vector = nullptr,
98 bool estimate_parent_error = false) = 0;
99
111 virtual void estimate_errors (const EquationSystems & equation_systems,
112 ErrorVector & error_per_cell,
113 const std::map<const System *, SystemNorm> & error_norms,
114 const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
115 bool estimate_parent_error = false);
116
121 typedef std::map<std::pair<const System *, unsigned int>, std::unique_ptr<ErrorVector>> ErrorMap;
122
135 virtual void estimate_errors (const EquationSystems & equation_systems,
136 ErrorMap & errors_per_cell,
137 const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
138 bool estimate_parent_error = false);
139
143 virtual ErrorEstimatorType type() const = 0;
144
159
160protected:
161
167 void reduce_error (std::vector<ErrorVectorReal> & error_per_cell,
168 const Parallel::Communicator & comm) const;
169};
170
171
172} // namespace libMesh
173
174#endif // LIBMESH_ERROR_ESTIMATOR_H
void ErrorVector unsigned int
This is the EquationSystems class.
This class holds functions that will estimate the error in a finite element solution on a given mesh.
ErrorEstimator & operator=(const ErrorEstimator &)=default
virtual ~ErrorEstimator()=default
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 th...
ErrorEstimator(const ErrorEstimator &)=default
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this s...
virtual ErrorEstimatorType type() const =0
SystemNorm error_norm
When estimating the error in a single system, the error_norm is used to control the scaling and norm ...
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 err...
std::map< std::pair< const System *, unsigned int >, std::unique_ptr< ErrorVector > > ErrorMap
When calculating many error vectors at once, we need a data structure to hold them all.
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 ...
ErrorEstimator()=default
Constructor.
ErrorEstimator(ErrorEstimator &&)=default
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
Definition system_norm.h:50
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition system.h:100
The libMesh namespace provides an interface to certain functionality in the library.
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.