libMesh
Loading...
Searching...
No Matches
uniform_refinement_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_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
33namespace libMesh
34{
35
46{
47public:
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
118 void extra_quadrature_order (const int extraorder)
119 { _extra_order = extraorder; }
120
121 virtual ErrorEstimatorType type() const override;
122
126 unsigned char number_h_refinements;
127
131 unsigned char number_p_refinements;
132
133protected:
134
139
144 virtual void _estimate_error (const EquationSystems * equation_systems,
145 const System * system,
146 ErrorVector * error_per_cell,
147 ErrorMap * errors_per_cell,
148 const std::map<const System *, SystemNorm > * error_norms,
149 const std::map<const System *, const NumericVector<Number> *> * solution_vectors = nullptr,
150 bool estimate_parent_error = false);
151};
152
153} // namespace libMesh
154
155#endif // #ifdef LIBMESH_ENABLE_AMR
156
157#endif // LIBMESH_UNIFORM_REFINEMENT_ESTIMATOR_H
This is the EquationSystems class.
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 >, std::unique_ptr< ErrorVector > > ErrorMap
When calculating many error vectors at once, we need a data structure to hold them all.
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.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition system.h:100
This class implements a `‘brute force’' error estimator which integrates differences between the curr...
UniformRefinementEstimator(const UniformRefinementEstimator &)=default
Copy/move ctor, copy/move assignment operator, and destructor are all explicitly defaulted for this s...
virtual void _estimate_error(const EquationSystems *equation_systems, const System *system, ErrorVector *error_per_cell, ErrorMap *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...
UniformRefinementEstimator & operator=(const UniformRefinementEstimator &)=default
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_...
void extra_quadrature_order(const int extraorder)
Increases or decreases the order of the quadrature rule used for numerical integration.
unsigned char number_h_refinements
How many h refinements to perform to get the fine grid.
virtual ErrorEstimatorType type() const override
UniformRefinementEstimator(UniformRefinementEstimator &&)=default
virtual ~UniformRefinementEstimator()=default
unsigned char number_p_refinements
How many p refinements to perform to get the fine grid.
int _extra_order
Extra order to use for quadrature rule.
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,...
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.