libMesh
uniform_refinement_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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_UNIFORM_REFINEMENT_ESTIMATOR_H
21 #define LIBMESH_UNIFORM_REFINEMENT_ESTIMATOR_H
22 
23 // Local Includes
24 #include "libmesh/error_estimator.h"
25 #include "libmesh/libmesh.h"
26 
27 // C++ includes
28 #include <cstddef>
29 #include <vector>
30 
31 #ifdef LIBMESH_ENABLE_AMR
32 
33 namespace libMesh
34 {
35 
46 {
47 public:
48 
53 
62  virtual ~UniformRefinementEstimator() = default;
63 
80  virtual void estimate_error (const System & system,
81  ErrorVector & error_per_cell,
82  const NumericVector<Number> * solution_vector = nullptr,
83  bool estimate_parent_error = false) override;
84 
92  virtual void estimate_errors (const EquationSystems & equation_systems,
93  ErrorVector & error_per_cell,
94  const std::map<const System *, SystemNorm> & error_norms,
95  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
96  bool estimate_parent_error = false) override;
97 
106  virtual void estimate_errors (const EquationSystems & equation_systems,
107  ErrorMap & errors_per_cell,
108  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
109  bool estimate_parent_error = false) override;
110 
111  virtual ErrorEstimatorType type() const override;
112 
116  unsigned char number_h_refinements;
117 
121  unsigned char number_p_refinements;
122 
123 protected:
128  virtual void _estimate_error (const EquationSystems * equation_systems,
129  const System * system,
130  ErrorVector * error_per_cell,
131  std::map<std::pair<const System *, unsigned int>, ErrorVector *> * errors_per_cell,
132  const std::map<const System *, SystemNorm > * error_norms,
133  const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
134  bool estimate_parent_error = false);
135 };
136 
137 } // namespace libMesh
138 
139 #endif // #ifdef LIBMESH_ENABLE_AMR
140 
141 #endif // LIBMESH_UNIFORM_REFINEMENT_ESTIMATOR_H
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::UniformRefinementEstimator::number_p_refinements
unsigned char number_p_refinements
How many p refinements to perform to get the fine grid.
Definition: uniform_refinement_estimator.h:121
libMesh::ErrorEstimatorType
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.
Definition: enum_error_estimator_type.h:33
libMesh::ErrorEstimator
This class holds functions that will estimate the error in a finite element solution on a given mesh.
Definition: error_estimator.h:67
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::NumericVector< Number >
libMesh::UniformRefinementEstimator::type
virtual ErrorEstimatorType type() const override
Definition: uniform_refinement_estimator.C:63
libMesh::UniformRefinementEstimator::number_h_refinements
unsigned char number_h_refinements
How many h refinements to perform to get the fine grid.
Definition: uniform_refinement_estimator.h:116
libMesh::ErrorVector
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
libMesh::UniformRefinementEstimator
This class implements a `‘brute force’' error estimator which integrates differences between the curr...
Definition: uniform_refinement_estimator.h:45
libMesh::UniformRefinementEstimator::estimate_errors
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) override
Currently this function ignores the error_norm member variable, and uses the function argument error_...
Definition: uniform_refinement_estimator.C:86
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::UniformRefinementEstimator::~UniformRefinementEstimator
virtual ~UniformRefinementEstimator()=default
libMesh::ErrorEstimator::ErrorMap
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.
Definition: error_estimator.h:127
libMesh::UniformRefinementEstimator::operator=
UniformRefinementEstimator & operator=(const UniformRefinementEstimator &)=default
libMesh::UniformRefinementEstimator::_estimate_error
virtual void _estimate_error(const EquationSystems *equation_systems, const System *system, ErrorVector *error_per_cell, std::map< std::pair< const System *, unsigned int >, ErrorVector * > *errors_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)
The code for estimate_error and both estimate_errors versions is very similar, so we use the same fun...
Definition: uniform_refinement_estimator.C:117
libMesh::UniformRefinementEstimator::estimate_error
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
This function does uniform refinements and a solve to get an improved solution on each cell,...
Definition: uniform_refinement_estimator.C:69
libMesh::UniformRefinementEstimator::UniformRefinementEstimator
UniformRefinementEstimator()
Constructor.
Definition: uniform_refinement_estimator.C:53