rb_parametrized.h
Go to the documentation of this file.
1 // rbOOmit: An implementation of the Certified Reduced Basis method.
2 // Copyright (C) 2009, 2010 David J. Knezevic
3 
4 // This file is part of rbOOmit.
5 
6 // rbOOmit is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 
11 // rbOOmit is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 #ifndef LIBMESH_RB_PARAMETRIZED_H
21 #define LIBMESH_RB_PARAMETRIZED_H
22 
23 // rbOOmit includes
24 #include "libmesh/rb_parameters.h"
25 
26 // libMesh includes
28 
29 // C++ includes
30 #include <vector>
31 
32 namespace libMesh
33 {
34 
44 class RBParametrized : public ReferenceCountedObject<RBParametrized>
45 {
46 public:
47 
51  RBParametrized ();
52 
56  virtual ~RBParametrized ();
57 
62  virtual void clear ();
63 
67  void initialize_parameters(const RBParameters & mu_min_in,
68  const RBParameters & mu_max_in,
69  const std::map<std::string, std::vector<Real>> & discrete_parameter_values);
70 
74  void initialize_parameters(const RBParametrized & rb_parametrized);
75 
79  unsigned int get_n_params() const;
80 
84  unsigned int get_n_continuous_params() const;
85 
89  unsigned int get_n_discrete_params() const;
90 
94  std::set<std::string> get_parameter_names() const;
95 
99  const RBParameters & get_parameters() const;
100 
104  void set_parameters(const RBParameters & params);
105 
110  const RBParameters & get_parameters_min() const;
111 
116  const RBParameters & get_parameters_max() const;
117 
121  Real get_parameter_min(const std::string & param_name) const;
122 
126  Real get_parameter_max(const std::string & param_name) const;
127 
131  void print_parameters() const;
132 
136  void write_parameter_data_to_files(const std::string & continuous_param_file_name,
137  const std::string & discrete_param_file_name,
138  const bool write_binary_data);
139 
143  void read_parameter_data_from_files(const std::string & continuous_param_file_name,
144  const std::string & discrete_param_file_name,
145  const bool read_binary_data);
146 
150  bool is_discrete_parameter(const std::string & mu_name) const;
151 
155  const std::map<std::string, std::vector<Real>> & get_discrete_parameter_values() const;
156 
160  void print_discrete_parameter_values() const;
161 
165  static Real get_closest_value(Real value, const std::vector<Real> & list_of_values);
166 
171 
172 private:
173 
177  void write_parameter_ranges_to_file(const std::string & file_name,
178  const bool write_binary);
179 
183  void write_discrete_parameter_values_to_file(const std::string & file_name,
184  const bool write_binary_data);
185 
190  void read_parameter_ranges_from_file(const std::string & file_name,
191  const bool read_binary,
192  RBParameters & param_min,
193  RBParameters & param_max);
194 
198  void read_discrete_parameter_values_from_file(const std::string & file_name,
199  const bool read_binary_data,
200  std::map<std::string, std::vector<Real>> & discrete_parameter_values_in);
201 
205  bool valid_params(const RBParameters & params);
206 
212  static bool is_value_in_list(Real value, const std::vector<Real> & list_of_values, Real tol);
213 
214  //--------------- PRIVATE DATA MEMBERS ---------------//
215 
220 
225 
231 
235  std::map<std::string, std::vector<Real>> _discrete_parameter_values;
236 
237 };
238 
239 } // namespace libMesh
240 
241 
242 #endif // LIBMESH_RB_PARAMETRIZED_H
bool valid_params(const RBParameters &params)
std::set< std::string > get_parameter_names() const
void write_parameter_data_to_files(const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool write_binary_data)
void read_parameter_ranges_from_file(const std::string &file_name, const bool read_binary, RBParameters &param_min, RBParameters &param_max)
Real get_parameter_min(const std::string &param_name) const
static Real get_closest_value(Real value, const std::vector< Real > &list_of_values)
Real get_parameter_max(const std::string &param_name) const
void write_discrete_parameter_values_to_file(const std::string &file_name, const bool write_binary_data)
void read_discrete_parameter_values_from_file(const std::string &file_name, const bool read_binary_data, std::map< std::string, std::vector< Real >> &discrete_parameter_values_in)
void read_parameter_data_from_files(const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool read_binary_data)
unsigned int get_n_discrete_params() const
void set_parameters(const RBParameters &params)
void write_parameter_ranges_to_file(const std::string &file_name, const bool write_binary)
static bool is_value_in_list(Real value, const std::vector< Real > &list_of_values, Real tol)
void print_parameters() const
std::map< std::string, std::vector< Real > > _discrete_parameter_values
unsigned int get_n_continuous_params() const
const RBParameters & get_parameters_min() const
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
const RBParameters & get_parameters_max() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition: xdr_io.C:109
const RBParameters & get_parameters() const
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
virtual void clear()
unsigned int get_n_params() const
bool is_discrete_parameter(const std::string &mu_name) const
void print_discrete_parameter_values() const