libMesh
error_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 #include "libmesh/enum_error_estimator_type.h"
28 
29 // C++ includes
30 #include <cstddef>
31 #include <map>
32 #include <string>
33 #include <vector>
34 
35 namespace libMesh
36 {
37 
38 // Forward Declarations
39 class ErrorVector;
40 class EquationSystems;
41 class System;
42 template <typename T> class NumericVector;
43 
57 {
58 public:
59 
65  error_norm()
66  {}
67 
71  virtual ~ErrorEstimator() {}
72 
73 
87  virtual void estimate_error (const System & system,
88  ErrorVector & error_per_cell,
89  const NumericVector<Number> * solution_vector = libmesh_nullptr,
90  bool estimate_parent_error = false) = 0;
91 
103  virtual void estimate_errors (const EquationSystems & equation_systems,
104  ErrorVector & error_per_cell,
105  const std::map<const System *, SystemNorm> & error_norms,
106  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = libmesh_nullptr,
107  bool estimate_parent_error = false);
108 
113  typedef std::map<std::pair<const System *, unsigned int>, ErrorVector *> ErrorMap;
114 
127  virtual void estimate_errors (const EquationSystems & equation_systems,
128  ErrorMap & errors_per_cell,
129  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = libmesh_nullptr,
130  bool estimate_parent_error = false);
131 
135  virtual ErrorEstimatorType type() const = 0;
136 
151 
152 protected:
153 
159  void reduce_error (std::vector<ErrorVectorReal> & error_per_cell,
160  const Parallel::Communicator & comm
161  LIBMESH_CAN_DEFAULT_TO_COMMWORLD) const;
162 };
163 
164 
165 } // namespace libMesh
166 
167 #endif // LIBMESH_ERROR_ESTIMATOR_H
This is the EquationSystems class.
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
SystemNorm error_norm
When estimating the error in a single system, the error_norm is used to control the scaling and norm ...
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
ErrorEstimator()
Constructor.
const class libmesh_nullptr_t libmesh_nullptr
This class defines a norm/seminorm to be applied to a NumericVector which contains coefficients in a ...
Definition: system_norm.h:43
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=libmesh_nullptr, bool estimate_parent_error=false)
This virtual function can be redefined in derived classes, but by default computes the sum of the err...
The libMesh namespace provides an interface to certain functionality in the library.
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
This class holds functions that will estimate the error in a finite element solution on a given mesh...
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...
void reduce_error(std::vector< ErrorVectorReal > &error_per_cell, const Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD) const
This method takes the local error contributions in error_per_cell from each processor and combines th...
virtual ~ErrorEstimator()
Destructor.
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=libmesh_nullptr, bool estimate_parent_error=false)=0
This pure virtual function must be redefined in derived classes to compute the error for each active ...
virtual ErrorEstimatorType type() const =0