$extrastylesheet
adjoint_refinement_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_ADJOINT_REFINEMENT_ESTIMATOR_H
00021 #define LIBMESH_ADJOINT_REFINEMENT_ESTIMATOR_H
00022 
00023 // Local Includes
00024 #include "libmesh/error_estimator.h"
00025 #include "libmesh/libmesh.h"
00026 #include "libmesh/qoi_set.h"
00027 
00028 // C++ includes
00029 #include <cstddef>
00030 #include <vector>
00031 
00032 #ifdef LIBMESH_ENABLE_AMR
00033 
00034 namespace libMesh
00035 {
00036 
00046 class AdjointRefinementEstimator : public ErrorEstimator
00047 {
00048 public:
00049 
00053   AdjointRefinementEstimator() :
00054     ErrorEstimator(),
00055     number_h_refinements(1),
00056     number_p_refinements(0),
00057     _qoi_set(QoISet())
00058   {
00059     // We're not actually going to use error_norm; our norms are
00060     // absolute values of QoI error.
00061     error_norm = INVALID_NORM;
00062   }
00063 
00067   ~AdjointRefinementEstimator() {}
00068 
00073   QoISet &qoi_set() { return _qoi_set; }
00074 
00079   const QoISet &qoi_set() const { return _qoi_set; }
00080 
00097   virtual void estimate_error (const System& system,
00098                                ErrorVector& error_per_cell,
00099                                const NumericVector<Number>* solution_vector = NULL,
00100                                bool estimate_parent_error = false);
00101 
00106   Number &get_global_QoI_error_estimate(unsigned int qoi_index)
00107   {
00108     return computed_global_QoI_errors[qoi_index];
00109   }
00110 
00114   unsigned char number_h_refinements;
00115 
00119   unsigned char number_p_refinements;
00120 
00121 protected:
00122 
00123   /* A vector to hold the computed global QoI error estimate */
00124   std::vector<Number> computed_global_QoI_errors;
00125 
00126   /* /\** */
00127   /*  * The code for estimate_error and both estimate_errors versions is very */
00128   /*  * similar, so we use the same function for all three */
00129   /*  *\/ */
00130   /* virtual void _estimate_error (const EquationSystems *equation_systems, */
00131   /*                               const System* system, */
00132   /* ErrorVector* error_per_cell, */
00133   /*         std::map<std::pair<const System*, unsigned int>, ErrorVector*>* errors_per_cell, */
00134   /*         const std::map<const System*, const NumericVector<Number>* >* solution_vectors = NULL, */
00135   /* bool estimate_parent_error = false); */
00136 
00140   QoISet _qoi_set;
00141 };
00142 
00143 } // namespace libMesh
00144 
00145 #endif // #ifdef LIBMESH_ENABLE_AMR
00146 
00147 #endif // LIBMESH_ADJOINT_REFINEMENT_ESTIMATOR_H