error_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 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/parallel.h"
26 #include "libmesh/system_norm.h"
27 
28 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
29 namespace libMesh
30 {
31 enum ErrorEstimatorType : int;
32 }
33 #else
35 #endif
36 
37 // C++ includes
38 #include <cstddef>
39 #include <map>
40 #include <string>
41 #include <vector>
42 
43 namespace libMesh
44 {
45 
46 // Forward Declarations
47 class ErrorVector;
48 class EquationSystems;
49 class System;
50 template <typename T> class NumericVector;
51 
65 {
66 public:
67 
72  ErrorEstimator() = default;
73 
78  ErrorEstimator (const ErrorEstimator &) = default;
79  ErrorEstimator (ErrorEstimator &&) = default;
80  ErrorEstimator & operator= (const ErrorEstimator &) = default;
82  virtual ~ErrorEstimator() = default;
83 
84 
98  virtual void estimate_error (const System & system,
99  ErrorVector & error_per_cell,
100  const NumericVector<Number> * solution_vector = nullptr,
101  bool estimate_parent_error = false) = 0;
102 
114  virtual void estimate_errors (const EquationSystems & equation_systems,
115  ErrorVector & error_per_cell,
116  const std::map<const System *, SystemNorm> & error_norms,
117  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
118  bool estimate_parent_error = false);
119 
124  typedef std::map<std::pair<const System *, unsigned int>, ErrorVector *> ErrorMap;
125 
138  virtual void estimate_errors (const EquationSystems & equation_systems,
139  ErrorMap & errors_per_cell,
140  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
141  bool estimate_parent_error = false);
142 
146  virtual ErrorEstimatorType type() const = 0;
147 
162 
163 protected:
164 
170  void reduce_error (std::vector<ErrorVectorReal> & error_per_cell,
171  const Parallel::Communicator & comm) const;
172 };
173 
174 
175 } // namespace libMesh
176 
177 #endif // LIBMESH_ERROR_ESTIMATOR_H
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)
Manages multiples systems of equations.
ErrorEstimator & operator=(const 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
virtual ErrorEstimatorType type() const =0
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:92
std::map< std::pair< const System *, unsigned int >, ErrorVector * > ErrorMap
void reduce_error(std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm) const
virtual ~ErrorEstimator()=default