$extrastylesheet
error_estimator.h
Go to the documentation of this file.
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_ERROR_ESTIMATOR_H
00021 #define LIBMESH_ERROR_ESTIMATOR_H
00022 
00023 // Local Includes
00024 #include "libmesh/libmesh_common.h"
00025 #include "libmesh/parallel.h"
00026 #include "libmesh/system_norm.h"
00027 
00028 // C++ includes
00029 #include <cstddef>
00030 #include <map>
00031 #include <string>
00032 #include <vector>
00033 
00034 namespace libMesh
00035 {
00036 
00037 // Forward Declarations
00038 class ErrorVector;
00039 class EquationSystems;
00040 class System;
00041 template <typename T> class NumericVector;
00042 
00053 class ErrorEstimator
00054 {
00055 public:
00056 
00061   ErrorEstimator() :
00062     error_norm()
00063   {}
00064 
00068   virtual ~ErrorEstimator() {}
00069 
00070 
00084   virtual void estimate_error (const System& system,
00085                                ErrorVector& error_per_cell,
00086                                const NumericVector<Number>* solution_vector = NULL,
00087                                bool estimate_parent_error = false) = 0;
00088 
00100   virtual void estimate_errors (const EquationSystems& equation_systems,
00101                                 ErrorVector& error_per_cell,
00102                                 const std::map<const System*, SystemNorm>& error_norms,
00103                                 const std::map<const System*, const NumericVector<Number>* >* solution_vectors = NULL,
00104                                 bool estimate_parent_error = false);
00105 
00110   typedef std::map<std::pair<const System*, unsigned int>, ErrorVector*> ErrorMap;
00111 
00124   virtual void estimate_errors (const EquationSystems& equation_systems,
00125                                 ErrorMap& errors_per_cell,
00126                                 const std::map<const System*, const NumericVector<Number>* >* solution_vectors = NULL,
00127                                 bool estimate_parent_error = false);
00128 
00142   SystemNorm error_norm;
00143 
00144 protected:
00145 
00151   void reduce_error (std::vector<float>& error_per_cell,
00152                      const Parallel::Communicator &comm
00153                      LIBMESH_CAN_DEFAULT_TO_COMMWORLD) const;
00154 };
00155 
00156 
00157 } // namespace libMesh
00158 
00159 #endif // LIBMESH_ERROR_ESTIMATOR_H