libMesh
rb_scm_evaluation.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_SCM_EVALUATION_H
21 #define LIBMESH_RB_SCM_EVALUATION_H
22 
23 // RBSCMEvaluation should only be available
24 // if SLEPc and GLPK support is enabled.
25 #include "libmesh/libmesh_config.h"
26 #if defined(LIBMESH_HAVE_SLEPC) && (LIBMESH_HAVE_GLPK)
27 
28 // rbOOmit includes
29 #include "libmesh/rb_parametrized.h"
30 
31 // libMesh includes
32 #include "libmesh/parallel_object.h"
33 
34 // C++ includes
35 
36 namespace libMesh
37 {
38 
39 // Forward declarations
40 class RBThetaExpansion;
41 
53  public ParallelObject
54 {
55 public:
56 
61  LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
62 
66  virtual ~RBSCMEvaluation ();
67 
71  void set_rb_theta_expansion(RBThetaExpansion & rb_theta_expansion_in);
72 
77 
81  virtual Real get_SCM_LB();
82 
86  virtual Real get_SCM_UB();
87 
94  Real get_C_J_stability_constraint(unsigned int j) const;
95 
102  void set_C_J_stability_constraint(unsigned int j, Real stability_constraint_in);
103 
109  Real get_SCM_UB_vector(unsigned int j, unsigned int q);
110 
116  void set_SCM_UB_vector(unsigned int j, unsigned int q, Real y_q);
117 
121  unsigned int get_C_J_size()
122  { return cast_int<unsigned int>(C_J.size()); }
123 
127  const RBParameters & get_C_J_entry(unsigned int j);
128 
132  Real get_C_J_stability_value(unsigned int j) { return C_J_stability_vector[j]; }
133 
137  Real get_B_min(unsigned int i) const;
138  Real get_B_max(unsigned int i) const;
139 
143  void set_B_min(unsigned int i, Real B_min_val);
144  void set_B_max(unsigned int i, Real B_max_val);
145 
150  virtual void save_current_parameters();
151 
156  virtual void reload_current_parameters();
157 
161  virtual void set_current_parameters_from_C_J(unsigned int C_J_index);
162 
169  virtual void legacy_write_offline_data_to_files(const std::string & directory_name = "offline_data",
170  const bool write_binary_data = true);
171 
178  virtual void legacy_read_offline_data_from_files(const std::string & directory_name = "offline_data",
179  const bool read_binary_data = true);
180 
181  //----------- PUBLIC DATA MEMBERS -----------//
182 
186  std::vector<Real> B_min;
187  std::vector<Real> B_max;
188 
193  std::vector<RBParameters > C_J;
194 
199  std::vector<Real> C_J_stability_vector;
200 
207  std::vector<std::vector<Real>> SCM_UB_vectors;
208 
209 private:
210 
216 
224 
225 };
226 
227 }
228 
229 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK
230 
231 #endif // LIBMESH_RB_SCM_EVALUATION_H
std::vector< Real > B_min
B_min, B_max define the bounding box.
virtual Real get_SCM_UB()
Evaluate single SCM upper bound.
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
Real get_B_min(unsigned int i) const
Get B_min and B_max.
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Real get_C_J_stability_value(unsigned int j)
Get entry of C_J_stability_vector.
void set_SCM_UB_vector(unsigned int j, unsigned int q, Real y_q)
Set entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors...
virtual void save_current_parameters()
Helper function to save current_parameters in saved_parameters.
The libMesh namespace provides an interface to certain functionality in the library.
Real get_B_max(unsigned int i) const
RBThetaExpansion & get_rb_theta_expansion()
Get a reference to the rb_theta_expansion.
std::vector< Real > B_max
virtual void legacy_read_offline_data_from_files(const std::string &directory_name="offline_data", const bool read_binary_data=true)
Read in the saved Offline reduced basis data to initialize the system for Online solves.
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
std::vector< std::vector< Real > > SCM_UB_vectors
This matrix stores the infimizing vectors y_1( ),...,y_Q_a( ), for each in C_J, which are used in co...
std::vector< Real > C_J_stability_vector
Vector storing the (truth) stability values at the parameters in C_J.
virtual Real get_SCM_LB()
Evaluate single SCM lower bound.
const RBParameters & get_C_J_entry(unsigned int j)
Get entry of C_J.
Real get_C_J_stability_constraint(unsigned int j) const
Get stability constraints (i.e.
virtual void reload_current_parameters()
Helper function to (re)load current_parameters from saved_parameters.
std::vector< RBParameters > C_J
Vector storing the greedily selected parameters during SCM training.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void set_B_min(unsigned int i, Real B_min_val)
Set B_min and B_max.
void set_C_J_stability_constraint(unsigned int j, Real stability_constraint_in)
Set stability constraints (i.e.
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true)
Write out all the data to text files in order to segregate the Offline stage from the Online stage...
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
This class forms the base class for all other classes that are expected to be implemented in parallel...
virtual void set_current_parameters_from_C_J(unsigned int C_J_index)
Set parameters based on values saved in "C_J".
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_B_max(unsigned int i, Real B_max_val)
This class is part of the rbOOmit framework.
const Parallel::Communicator & comm() const
virtual ~RBSCMEvaluation()
Destructor.
RBSCMEvaluation(const Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Constructor.
RBParameters saved_parameters
Vector in which to save a parameter set.
Real get_SCM_UB_vector(unsigned int j, unsigned int q)
Get entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors...
This class is part of the rbOOmit framework.
unsigned int get_C_J_size()
Get size of the set C_J.