libMesh
patch_recovery_error_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_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 #ifdef LIBMESH_FORWARD_DECLARE_ENUMS
30 namespace libMesh
31 {
32 enum Order : int;
33 }
34 #else
35 #include "libmesh/enum_order.h"
36 #endif
37 
38 // C++ includes
39 #include <cstddef>
40 #include <vector>
41 
42 namespace libMesh
43 {
44 
45 // Forward Declarations
46 class Elem;
47 
56 {
57 public:
58 
65 
74  virtual ~PatchRecoveryErrorEstimator() = default;
75 
82  virtual void estimate_error (const System & system,
83  ErrorVector & error_per_cell,
84  const NumericVector<Number> * solution_vector = nullptr,
85  bool estimate_parent_error = false) override;
86 
91  unsigned int target_patch_size;
92 
100 
101  void set_patch_reuse (bool);
102 
103  virtual ErrorEstimatorType type() const override;
104 
105 protected:
106 
110  static std::vector<Real> specpoly(const unsigned int dim,
111  const Order order,
112  const Point p,
113  const unsigned int matsize);
114 
116 
117 private:
118 
124  {
125  public:
126  EstimateError (const System & sys,
127  const PatchRecoveryErrorEstimator & ee,
128  ErrorVector & epc) :
129  system(sys),
130  error_estimator(ee),
131  error_per_cell(epc)
132  {}
133 
134  void operator()(const ConstElemRange & range) const;
135 
136  private:
137  const System & system;
140  };
141 
142  friend class EstimateError;
143 };
144 
145 
146 } // namespace libMesh
147 
148 
149 #endif // LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::PatchRecoveryErrorEstimator::patch_growth_strategy
Patch::PMF patch_growth_strategy
The PatchErrorEstimator will use this pointer to a Patch member function when growing patches.
Definition: patch_recovery_error_estimator.h:99
libMesh::PatchRecoveryErrorEstimator
This class implements the Patch Recovery error indicator.
Definition: patch_recovery_error_estimator.h:55
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::Order
Order
Definition: enum_order.h:40
libMesh::PatchRecoveryErrorEstimator::EstimateError::EstimateError
EstimateError(const System &sys, const PatchRecoveryErrorEstimator &ee, ErrorVector &epc)
Definition: patch_recovery_error_estimator.h:126
libMesh::PatchRecoveryErrorEstimator::EstimateError
Class to compute the error contribution for a range of elements.
Definition: patch_recovery_error_estimator.h:123
libMesh::PatchRecoveryErrorEstimator::EstimateError::error_estimator
const PatchRecoveryErrorEstimator & error_estimator
Definition: patch_recovery_error_estimator.h:138
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::Patch::PMF
void(Patch::* PMF)()
Pointer to Member Function typedef.
Definition: patch.h:104
libMesh::NumericVector< Number >
libMesh::PatchRecoveryErrorEstimator::EstimateError::error_per_cell
ErrorVector & error_per_cell
Definition: patch_recovery_error_estimator.h:139
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::ErrorVector
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
libMesh::PatchRecoveryErrorEstimator::target_patch_size
unsigned int target_patch_size
The PatchErrorEstimator will build patches of at least this many elements to perform estimates.
Definition: patch_recovery_error_estimator.h:91
libMesh::PatchRecoveryErrorEstimator::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 uses the Patch Recovery error estimate to estimate the error on each cell.
Definition: patch_recovery_error_estimator.C:153
libMesh::PatchRecoveryErrorEstimator::set_patch_reuse
void set_patch_reuse(bool)
Definition: patch_recovery_error_estimator.C:58
libMesh::PatchRecoveryErrorEstimator::patch_reuse
bool patch_reuse
Definition: patch_recovery_error_estimator.h:115
libMesh::PatchRecoveryErrorEstimator::specpoly
static std::vector< Real > specpoly(const unsigned int dim, const Order order, const Point p, const unsigned int matsize)
Definition: patch_recovery_error_estimator.C:76
libMesh::StoredRange
The StoredRange class defines a contiguous, divisible set of objects.
Definition: stored_range.h:52
libMesh::PatchRecoveryErrorEstimator::operator=
PatchRecoveryErrorEstimator & operator=(const PatchRecoveryErrorEstimator &)=default
libMesh::PatchRecoveryErrorEstimator::PatchRecoveryErrorEstimator
PatchRecoveryErrorEstimator()
Constructor.
Definition: patch_recovery_error_estimator.C:65
libMesh::PatchRecoveryErrorEstimator::type
virtual ErrorEstimatorType type() const override
Definition: patch_recovery_error_estimator.C:50
libMesh::PatchRecoveryErrorEstimator::~PatchRecoveryErrorEstimator
virtual ~PatchRecoveryErrorEstimator()=default
libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()
void operator()(const ConstElemRange &range) const
Definition: patch_recovery_error_estimator.C:210
int
void ErrorVector unsigned int
Definition: adjoints_ex3.C:360
libMesh::PatchRecoveryErrorEstimator::EstimateError::system
const System & system
Definition: patch_recovery_error_estimator.h:137