$extrastylesheet
rb_parametrized.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_PARAMETRIZED_H
00021 #define LIBMESH_RB_PARAMETRIZED_H
00022 
00023 // rbOOmit includes
00024 #include "libmesh/rb_parameters.h"
00025 
00026 // libMesh includes
00027 #include "libmesh/reference_counted_object.h"
00028 
00029 // C++ includes
00030 #include <vector>
00031 
00032 namespace libMesh
00033 {
00034 
00043 // ------------------------------------------------------------
00044 // RBParametrized class definition
00045 class RBParametrized : public ReferenceCountedObject<RBParametrized>
00046 {
00047 public:
00048 
00052   RBParametrized ();
00053 
00057   virtual ~RBParametrized ();
00058 
00063   virtual void clear ();
00064 
00068   void initialize_parameters(const RBParameters& mu_min_in,
00069                              const RBParameters& mu_max_in,
00070                              const std::map< std::string, std::vector<Real> >& discrete_parameter_values);
00071 
00075   void initialize_parameters(const RBParametrized& rb_parametrized);
00076 
00080   unsigned int get_n_params() const;
00081 
00085   unsigned int get_n_continuous_params() const;
00086 
00090   unsigned int get_n_discrete_params() const;
00091 
00095   std::set<std::string> get_parameter_names() const;
00096 
00100   const RBParameters& get_parameters() const;
00101 
00105   void set_parameters(const RBParameters& params);
00106 
00111   const RBParameters& get_parameters_min() const;
00112 
00117   const RBParameters& get_parameters_max() const;
00118 
00122   Real get_parameter_min(const std::string& param_name) const;
00123 
00127   Real get_parameter_max(const std::string& param_name) const;
00128 
00132   void print_parameters() const;
00133 
00137   void write_parameter_data_to_files(const std::string& continuous_param_file_name,
00138                                      const std::string& discrete_param_file_name,
00139                                      const bool write_binary_data);
00140 
00144   void read_parameter_data_from_files(const std::string& continuous_param_file_name,
00145                                       const std::string& discrete_param_file_name,
00146                                       const bool read_binary_data);
00147 
00151   bool is_discrete_parameter(const std::string& mu_name) const;
00152 
00156   const std::map< std::string, std::vector<Real> >& get_discrete_parameter_values() const;
00157 
00161   void print_discrete_parameter_values() const;
00162 
00167   static Real get_closest_value(Real value, const std::vector<Real>& list_of_values);
00168 
00172   bool verbose_mode;
00173 
00174 private:
00175 
00179   void write_parameter_ranges_to_file(const std::string& file_name,
00180                                       const bool write_binary);
00181 
00185   void write_discrete_parameter_values_to_file(const std::string& file_name,
00186                                                const bool write_binary_data);
00187 
00192   void read_parameter_ranges_from_file(const std::string& file_name,
00193                                        const bool read_binary,
00194                                        RBParameters& param_min,
00195                                        RBParameters& param_max);
00196 
00200   void read_discrete_parameter_values_from_file(const std::string& file_name,
00201                                                 const bool read_binary_data,
00202                                                 std::map< std::string, std::vector<Real> >& discrete_parameter_values_in);
00203 
00207   bool valid_params(const RBParameters& params);
00208 
00214   static bool is_value_in_list(Real value, const std::vector<Real>& list_of_values, Real tol);
00215 
00216   //--------------- PRIVATE DATA MEMBERS ---------------//
00217 
00221   bool parameters_initialized;
00222 
00226   RBParameters parameters;
00227 
00231   RBParameters parameters_min;
00232   RBParameters parameters_max;
00233 
00237   std::map< std::string, std::vector<Real> > _discrete_parameter_values;
00238 
00239 };
00240 
00241 } // namespace libMesh
00242 
00243 
00244 #endif // LIBMESH_RB_PARAMETRIZED_H