$extrastylesheet
rb_eim_evaluation.h
Go to the documentation of this file.
00001 // rbOOmit: An implementation of the Certified Reduced Basis method.
00002 // Copyright (C) 2009, 2010 David J. Knezevic
00003 
00004 // This file is part of rbOOmit.
00005 
00006 // rbOOmit is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 
00011 // rbOOmit is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 #ifndef LIBMESH_RB_EIM_EVALUATION_H
00021 #define LIBMESH_RB_EIM_EVALUATION_H
00022 
00023 // libMesh includes
00024 #include "libmesh/auto_ptr.h"
00025 #include "libmesh/point.h"
00026 #include "libmesh/rb_evaluation.h"
00027 #include "libmesh/elem.h"
00028 #include "libmesh/serial_mesh.h"
00029 
00030 // C++ includes
00031 
00032 namespace libMesh
00033 {
00034 
00035 class RBParameters;
00036 class RBParametrizedFunction;
00037 
00049 // ------------------------------------------------------------
00050 // RBEIMEvaluation class definition
00051 
00052 class RBEIMEvaluation : public RBEvaluation
00053 {
00054 public:
00055 
00059   RBEIMEvaluation (const libMesh::Parallel::Communicator &comm_in
00060                    LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
00061 
00065   virtual ~RBEIMEvaluation ();
00066 
00070   typedef RBEvaluation Parent;
00071 
00075   virtual void clear();
00076 
00081   virtual void resize_data_structures(const unsigned int Nmax,
00082                                       bool resize_error_bound_data=true);
00083 
00088   void attach_parametrized_function(RBParametrizedFunction* pf);
00089 
00090 
00095   unsigned int get_n_parametrized_functions() const;
00096 
00100   SerialMesh& get_interpolation_points_mesh();
00101 
00109   Number evaluate_parametrized_function(unsigned int var_index,
00110                                         const Point& p,
00111                                         const Elem& elem);
00112 
00119   virtual Real rb_solve(unsigned int N);
00120 
00126   void rb_solve(DenseVector<Number>& EIM_rhs);
00127 
00133   void initialize_eim_theta_objects();
00134 
00138   std::vector<RBTheta*> get_eim_theta_objects();
00139 
00145   virtual UniquePtr<RBTheta> build_eim_theta(unsigned int index);
00146 
00151   virtual void write_offline_data_to_files(const std::string& directory_name = "offline_data",
00152                                            const bool write_binary_data=true);
00153 
00158   virtual void read_offline_data_from_files(const std::string& directory_name = "offline_data",
00159                                             bool read_error_bound_data=true,
00160                                             const bool read_binary_data=true);
00161 
00162   //----------- PUBLIC DATA MEMBERS -----------//
00163 
00168   DenseMatrix<Number> interpolation_matrix;
00169 
00174   std::vector<Point> interpolation_points;
00175 
00180   std::vector<unsigned int> interpolation_points_var;
00181 
00186   std::vector<Elem*> interpolation_points_elem;
00187 
00193   Point extra_interpolation_point;
00194   unsigned int extra_interpolation_point_var;
00195   Elem* extra_interpolation_point_elem;
00196 
00201   DenseVector<Number> extra_interpolation_matrix_row;
00202 
00203 private:
00204 
00209   void write_out_interpolation_points_elem(const std::string& directory_name);
00210 
00214   void read_in_interpolation_points_elem(const std::string& directory_name);
00215 
00220   std::vector<RBParametrizedFunction*> _parametrized_functions;
00221 
00226   std::vector<RBTheta*> _rb_eim_theta_objects;
00227 
00232   RBThetaExpansion _empty_rb_theta_expansion;
00233 
00238   RBParameters _previous_parameters;
00239 
00244   unsigned int _previous_N;
00245 
00250   Real _previous_error_bound;
00251 
00256   SerialMesh _interpolation_points_mesh;
00257 
00258 };
00259 
00260 }
00261 
00262 #endif // LIBMESH_RB_EIM_EVALUATION_H