$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H 00021 #define LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H 00022 00023 // Local Includes 00024 #include "libmesh/error_estimator.h" 00025 #include "libmesh/enum_order.h" 00026 #include "libmesh/patch.h" 00027 #include "libmesh/point.h" 00028 #include "libmesh/elem_range.h" 00029 00030 // C++ includes 00031 #include <cstddef> 00032 #include <vector> 00033 00034 namespace libMesh 00035 { 00036 00037 // Forward Declarations 00038 class Elem; 00039 00040 00047 class PatchRecoveryErrorEstimator : public ErrorEstimator 00048 { 00049 public: 00050 00056 PatchRecoveryErrorEstimator() : 00057 ErrorEstimator(), 00058 target_patch_size(20), 00059 patch_growth_strategy(&Patch::add_local_face_neighbors), 00060 patch_reuse(true) 00061 { error_norm = H1_SEMINORM; } 00062 00066 ~PatchRecoveryErrorEstimator() {} 00067 00068 00075 virtual void estimate_error (const System& system, 00076 ErrorVector& error_per_cell, 00077 const NumericVector<Number>* solution_vector = NULL, 00078 bool estimate_parent_error = false); 00079 00084 unsigned int target_patch_size; 00085 00092 Patch::PMF patch_growth_strategy; 00093 00094 void set_patch_reuse (bool ); 00095 00096 protected: 00097 00102 static std::vector<Real> specpoly(const unsigned int dim, 00103 const Order order, 00104 const Point p, 00105 const unsigned int matsize); 00106 00107 bool patch_reuse ; 00108 00109 private: 00110 00115 class EstimateError 00116 { 00117 public: 00118 EstimateError (const System& sys, 00119 const PatchRecoveryErrorEstimator &ee, 00120 ErrorVector& epc) : 00121 system(sys), 00122 error_estimator(ee), 00123 error_per_cell(epc) 00124 {} 00125 00126 void operator()(const ConstElemRange &range) const; 00127 00133 private: 00134 00135 const System &system; 00136 const PatchRecoveryErrorEstimator &error_estimator; 00137 ErrorVector &error_per_cell; 00138 }; 00139 00140 friend class EstimateError; 00141 }; 00142 00143 00144 } // namespace libMesh 00145 00146 00147 #endif // LIBMESH_PATCH_RECOVERY_ERROR_ESTIMATOR_H