libMesh
patch_recovery_error_estimator.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 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_PATCH_RECOVERY_ERROR_ESTIMATOR_H
21 #define LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H
22 
23 // Local Includes
24 #include "libmesh/error_estimator.h"
25 #include "libmesh/patch.h"
26 #include "libmesh/point.h"
27 #include "libmesh/elem_range.h"
28 
29 // C++ includes
30 #include <cstddef>
31 #include <vector>
32 
33 namespace libMesh
34 {
35 
36 // Forward Declarations
37 class Elem;
38 enum Order : int;
39 
48 {
49 public:
50 
57 
66  virtual ~PatchRecoveryErrorEstimator() = default;
67 
74  virtual void estimate_error (const System & system,
75  ErrorVector & error_per_cell,
76  const NumericVector<Number> * solution_vector = nullptr,
77  bool estimate_parent_error = false) override;
78 
83  unsigned int target_patch_size;
84 
92 
93  void set_patch_reuse (bool);
94 
102  void extra_quadrature_order (const int extraorder)
103  { _extra_order = extraorder; }
104 
105  virtual ErrorEstimatorType type() const override;
106 
107 protected:
108 
112  static std::vector<Real> specpoly(const unsigned int dim,
113  const Order order,
114  const Point p,
115  const unsigned int matsize);
116 
118 
123 
124 private:
125 
131  {
132  public:
133  EstimateError (const System & sys,
134  const PatchRecoveryErrorEstimator & ee,
135  ErrorVector & epc) :
136  system(sys),
137  error_estimator(ee),
138  error_per_cell(epc)
139  {}
140 
141  void operator()(const ConstElemRange & range) const;
142 
143  private:
144  const System & system;
147  };
148 
149  friend class EstimateError;
150 };
151 
152 
153 } // namespace libMesh
154 
155 
156 #endif // LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
Patch::PMF patch_growth_strategy
The PatchErrorEstimator will use this pointer to a Patch member function when growing patches...
Class to compute the error contribution for a range of elements.
unsigned int dim
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
ErrorEstimatorType
Defines an enum for the different types of error estimators which are available.
The StoredRange class defines a contiguous, divisible set of objects.
Definition: stored_range.h:54
The libMesh namespace provides an interface to certain functionality in the library.
EstimateError(const System &sys, const PatchRecoveryErrorEstimator &ee, ErrorVector &epc)
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
void extra_quadrature_order(const int extraorder)
Increases or decreases the order of the quadrature rule used for numerical integration.
This class holds functions that will estimate the error in a finite element solution on a given mesh...
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 uses the Patch Recovery error estimate to estimate the error on each cell...
unsigned int target_patch_size
The PatchErrorEstimator will build patches of at least this many elements to perform estimates...
static std::vector< Real > specpoly(const unsigned int dim, const Order order, const Point p, const unsigned int matsize)
void(Patch::* PMF)()
Pointer to Member Function typedef.
Definition: patch.h:104
This class implements the Patch Recovery error indicator.
int _extra_order
Extra order to use for quadrature rule.
virtual ErrorEstimatorType type() const override
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
virtual ~PatchRecoveryErrorEstimator()=default
PatchRecoveryErrorEstimator & operator=(const PatchRecoveryErrorEstimator &)=default