exact_error_estimator.h
Go to the documentation of this file.00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2012 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_EXACT_ERROR_ESTIMATOR_H 00021 #define LIBMESH_EXACT_ERROR_ESTIMATOR_H 00022 00023 // Local Includes 00024 #include "libmesh/error_estimator.h" 00025 00026 // C++ includes 00027 #include <cstddef> 00028 #include <string> 00029 #include <vector> 00030 00031 namespace libMesh 00032 { 00033 00034 // Forward Declarations 00035 class Elem; 00036 template <typename T> class FEGenericBase; 00037 typedef FEGenericBase<Real> FEBase; 00038 class MeshFunction; 00039 class Point; 00040 class Parameters; 00041 00042 template <typename T> class DenseVector; 00043 00044 // Is there any way to simplify this? 00045 // All we need are Tensor and Gradient. - RHS 00046 template <typename T> class TensorValue; 00047 template <typename T> class VectorValue; 00048 typedef TensorValue<Number> NumberTensorValue; 00049 typedef NumberTensorValue Tensor; 00050 typedef VectorValue<Number> NumberVectorValue; 00051 typedef NumberVectorValue Gradient; 00052 00053 00054 00065 class ExactErrorEstimator : public ErrorEstimator 00066 { 00067 public: 00068 00073 ExactErrorEstimator() : _exact_value(NULL), 00074 _exact_deriv(NULL), 00075 _exact_hessian(NULL), 00076 _extra_order(0) 00077 { error_norm = H1; } 00078 00082 ~ExactErrorEstimator() {} 00083 00088 void attach_exact_values (std::vector<FunctionBase<Number> *> f); 00089 00094 void attach_exact_value (unsigned int sys_num, 00095 FunctionBase<Number>* f); 00096 00101 void attach_exact_value ( Number fptr(const Point& p, 00102 const Parameters& Parameters, 00103 const std::string& sys_name, 00104 const std::string& unknown_name)); 00105 00110 void attach_exact_derivs (std::vector<FunctionBase<Gradient> *> g); 00111 00116 void attach_exact_deriv (unsigned int sys_num, 00117 FunctionBase<Gradient>* g); 00118 00123 void attach_exact_deriv ( Gradient gptr(const Point& p, 00124 const Parameters& parameters, 00125 const std::string& sys_name, 00126 const std::string& unknown_name)); 00127 00132 void attach_exact_hessians (std::vector<FunctionBase<Tensor> *> h); 00133 00138 void attach_exact_hessian (unsigned int sys_num, 00139 FunctionBase<Tensor>* h); 00140 00145 void attach_exact_hessian ( Tensor hptr(const Point& p, 00146 const Parameters& parameters, 00147 const std::string& sys_name, 00148 const std::string& unknown_name)); 00149 00155 void attach_reference_solution (EquationSystems* es_fine); 00156 00157 00162 void extra_quadrature_order (const int extraorder) 00163 { _extra_order = extraorder; } 00164 00165 00166 // Bring the base class functionality into the name lookup 00167 // procedure. This allows for alternative calling formats 00168 // defined in the base class. Thanks Wolfgang. 00169 // GCC 2.95.3 cannot compile such code. Since it was not really 00170 // essential to the functioning of this class, it's been removed. 00171 // using ErrorEstimator::estimate_error; 00172 00179 virtual void estimate_error (const System& system, 00180 ErrorVector& error_per_cell, 00181 const NumericVector<Number>* solution_vector = NULL, 00182 bool estimate_parent_error = false); 00183 00184 private: 00185 00190 Number (* _exact_value) (const Point& p, 00191 const Parameters& parameters, 00192 const std::string& sys_name, 00193 const std::string& unknown_name); 00194 00199 Gradient (* _exact_deriv) (const Point& p, 00200 const Parameters& parameters, 00201 const std::string& sys_name, 00202 const std::string& unknown_name); 00203 00208 Tensor (* _exact_hessian) (const Point& p, 00209 const Parameters& parameters, 00210 const std::string& sys_name, 00211 const std::string& unknown_name); 00212 00217 std::vector<FunctionBase<Number> *> _exact_values; 00218 00223 std::vector<FunctionBase<Gradient> *> _exact_derivs; 00224 00229 std::vector<FunctionBase<Tensor> *> _exact_hessians; 00230 00235 EquationSystems* _equation_systems_fine; 00236 00240 Real find_squared_element_error (const System& system, 00241 const std::string& var_name, 00242 const Elem *elem, 00243 const DenseVector<Number> &Uelem, 00244 FEBase *fe, 00245 MeshFunction *fine_values) const; 00246 00250 void clear_functors (); 00251 00255 int _extra_order; 00256 }; 00257 00258 00259 } // namespace libMesh 00260 00261 #endif // LIBMESH_EXACT_ERROR_ESTIMATOR_H 00262
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:46 UTC
Hosted By: