$extrastylesheet
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_CONSTRUCTION_H 00021 #define LIBMESH_RB_EIM_CONSTRUCTION_H 00022 00023 // rbOOmit includes 00024 #include "libmesh/rb_construction.h" 00025 #include "libmesh/rb_assembly_expansion.h" 00026 #include "libmesh/rb_eim_assembly.h" 00027 00028 // libMesh includes 00029 #include "libmesh/mesh_function.h" 00030 #include "libmesh/coupling_matrix.h" 00031 00032 // C++ includes 00033 00034 namespace libMesh 00035 { 00036 00048 // ------------------------------------------------------------ 00049 // RBEIMConstruction class definition 00050 00051 class RBEIMConstruction : public RBConstruction 00052 { 00053 public: 00054 00055 enum BEST_FIT_TYPE { PROJECTION_BEST_FIT, EIM_BEST_FIT }; 00056 00061 RBEIMConstruction (EquationSystems& es, 00062 const std::string& name, 00063 const unsigned int number); 00064 00068 virtual ~RBEIMConstruction (); 00069 00073 typedef RBEIMConstruction sys_type; 00074 00078 typedef RBConstruction Parent; 00079 00083 virtual void clear(); 00084 00089 virtual void process_parameters_file (const std::string& parameters_filename); 00090 00095 void set_best_fit_type_flag (const std::string& best_fit_type_string); 00096 00100 virtual void print_info(); 00101 00106 virtual void initialize_rb_construction(bool skip_matrix_assembly=false, 00107 bool skip_vector_assembly=false); 00108 00112 virtual Real train_reduced_basis(const std::string& directory_name = "offline_data", 00113 const bool resize_rb_eval_data=true); 00114 00123 virtual Real truth_solve(int plot_solution); 00124 00132 virtual Real compute_best_fit_error(); 00133 00139 virtual void init_context(FEMContext &c); 00140 00144 Number evaluate_mesh_function(unsigned int var_number, 00145 Point p); 00146 00153 virtual void initialize_eim_assembly_objects(); 00154 00158 std::vector<ElemAssembly*> get_eim_assembly_objects(); 00159 00166 virtual UniquePtr<ElemAssembly> build_eim_assembly(unsigned int bf_index) = 0; 00167 00168 //----------- PUBLIC DATA MEMBERS -----------// 00169 00179 BEST_FIT_TYPE best_fit_type_flag; 00180 00181 00187 CouplingMatrix _coupling_matrix; 00188 00189 protected: 00190 00194 virtual void init_data(); 00195 00200 virtual void enrich_RB_space(); 00201 00206 virtual void update_system(); 00207 00213 virtual void update_RB_system_matrices(); 00214 00219 virtual Real get_RB_error_bound(); 00220 00225 virtual bool greedy_termination_test(Real training_greedy_error, int count); 00226 00231 void initialize_parametrized_functions_in_training_set(); 00232 00237 bool _parametrized_functions_in_training_set_initialized; 00238 00243 std::vector< NumericVector<Number>* > _parametrized_functions_in_training_set; 00244 00245 private: 00246 00250 MeshFunction* _mesh_function; 00251 00258 bool _performing_extra_greedy_step; 00259 00264 UniquePtr< NumericVector<Number> > _ghosted_meshfunction_vector; 00265 00270 RBAssemblyExpansion _empty_rb_assembly_expansion; 00271 00276 std::vector<ElemAssembly*> _rb_eim_assembly_objects; 00277 00278 }; 00279 00280 } // namespace libMesh 00281 00282 #endif // LIBMESH_RB_EIM_CONSTRUCTION_H