libMesh
rb_eim_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_EIM_EVALUATION_H
21 #define LIBMESH_RB_EIM_EVALUATION_H
22 
23 // libMesh includes
24 #include "libmesh/point.h"
25 #include "libmesh/rb_evaluation.h"
26 #include "libmesh/replicated_mesh.h"
27 #include "libmesh/rb_theta_expansion.h"
28 
29 // C++ includes
30 #include <memory>
31 
32 namespace libMesh
33 {
34 
35 class RBParameters;
36 class RBParametrizedFunction;
37 class Elem;
38 class RBTheta;
39 
52 {
53 public:
54 
58  RBEIMEvaluation (const libMesh::Parallel::Communicator & comm_in);
59 
63  virtual ~RBEIMEvaluation ();
64 
69 
73  virtual void clear() override;
74 
79  virtual void resize_data_structures(const unsigned int Nmax,
80  bool resize_error_bound_data=true) override;
81 
87 
88 
93  unsigned int get_n_parametrized_functions() const;
94 
99 
107  Number evaluate_parametrized_function(unsigned int var_index,
108  const Point & p,
109  const Elem & elem);
110 
117  virtual Real rb_solve(unsigned int N) override;
118 
124  void rb_solve(DenseVector<Number> & EIM_rhs);
125 
130  virtual Real get_error_bound_normalization() override;
131 
138 
142  std::vector<std::unique_ptr<RBTheta>> & get_eim_theta_objects();
143 
149  virtual std::unique_ptr<RBTheta> build_eim_theta(unsigned int index);
150 
157  virtual void legacy_write_offline_data_to_files(const std::string & directory_name = "offline_data",
158  const bool write_binary_data=true) override;
159 
166  virtual void legacy_read_offline_data_from_files(const std::string & directory_name = "offline_data",
167  bool read_error_bound_data=true,
168  const bool read_binary_data=true) override;
169 
170  //----------- PUBLIC DATA MEMBERS -----------//
171 
177 
182  std::vector<Point> interpolation_points;
183 
188  std::vector<unsigned int> interpolation_points_var;
189 
194  std::vector<Elem *> interpolation_points_elem;
195 
196 private:
197 
202  void legacy_write_out_interpolation_points_elem(const std::string & directory_name);
203 
207  void legacy_read_in_interpolation_points_elem(const std::string & directory_name);
208 
213  std::vector<RBParametrizedFunction *> _parametrized_functions;
214 
219  std::vector<std::unique_ptr<RBTheta>> _rb_eim_theta_objects;
220 
226 
232 
237  unsigned int _previous_N;
238 
244 
250 
251 };
252 
253 }
254 
255 #endif // LIBMESH_RB_EIM_EVALUATION_H
libMesh::RBEIMEvaluation::_parametrized_functions
std::vector< RBParametrizedFunction * > _parametrized_functions
This vector stores the parametrized functions that will be approximated in this EIM system.
Definition: rb_eim_evaluation.h:213
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::RBEIMEvaluation::_previous_N
unsigned int _previous_N
Store the number of basis functions used for the previous solve (so we can avoid an unnecessary repea...
Definition: rb_eim_evaluation.h:237
libMesh::RBEIMEvaluation::Parent
RBEvaluation Parent
The type of the parent.
Definition: rb_eim_evaluation.h:68
libMesh::RBEIMEvaluation::rb_solve
virtual Real rb_solve(unsigned int N) override
Calculate the EIM approximation to parametrized_function using the first N EIM basis functions.
Definition: rb_eim_evaluation.C:113
libMesh::RBEIMEvaluation::legacy_read_in_interpolation_points_elem
void legacy_read_in_interpolation_points_elem(const std::string &directory_name)
Read int interpolation_points_elem from a mesh.
Definition: rb_eim_evaluation.C:468
libMesh::RBEIMEvaluation::legacy_write_out_interpolation_points_elem
void legacy_write_out_interpolation_points_elem(const std::string &directory_name)
Write out interpolation_points_elem by putting the elements into a mesh and writing out the mesh.
Definition: rb_eim_evaluation.C:292
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::RBEIMEvaluation::clear
virtual void clear() override
Clear this object.
Definition: rb_eim_evaluation.C:62
libMesh::DenseMatrix< Number >
libMesh::RBParameters
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
libMesh::RBEIMEvaluation::~RBEIMEvaluation
virtual ~RBEIMEvaluation()
Destructor.
Definition: rb_eim_evaluation.C:57
libMesh::RBEIMEvaluation::interpolation_points_var
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:188
libMesh::ReplicatedMesh
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
Definition: replicated_mesh.h:47
libMesh::RBEIMEvaluation::get_interpolation_points_mesh
ReplicatedMesh & get_interpolation_points_mesh()
Get a writable reference to the interpolation points mesh.
Definition: rb_eim_evaluation.C:98
libMesh::RBEIMEvaluation::resize_data_structures
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true) override
Resize the data structures for storing data associated with this object.
Definition: rb_eim_evaluation.C:75
libMesh::RBEIMEvaluation::initialize_eim_theta_objects
void initialize_eim_theta_objects()
Build a vector of RBTheta objects that accesses the components of the RB_solution member variable of ...
Definition: rb_eim_evaluation.C:207
libMesh::RBEIMEvaluation::legacy_write_offline_data_to_files
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true) override
Write out all the data to text files in order to segregate the Offline stage from the Online stage.
Definition: rb_eim_evaluation.C:225
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::RBParametrizedFunction
A simple functor class that provides a RBParameter-dependent function.
Definition: rb_parametrized_function.h:42
libMesh::RBEIMEvaluation::_previous_parameters
RBParameters _previous_parameters
Store the parameters at which the previous solve was performed (so we can avoid an unnecessary repeat...
Definition: rb_eim_evaluation.h:231
libMesh::RBEIMEvaluation::_interpolation_points_mesh
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points.
Definition: rb_eim_evaluation.h:249
libMesh::RBEIMEvaluation::get_eim_theta_objects
std::vector< std::unique_ptr< RBTheta > > & get_eim_theta_objects()
Definition: rb_eim_evaluation.C:215
libMesh::RBEIMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_eim_evaluation.h:51
libMesh::RBEIMEvaluation::_rb_eim_theta_objects
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
Definition: rb_eim_evaluation.h:219
libMesh::RBEIMEvaluation::get_n_parametrized_functions
unsigned int get_n_parametrized_functions() const
Get the number of parametrized functions that have been attached to this system.
Definition: rb_eim_evaluation.C:92
libMesh::RBEIMEvaluation::build_eim_theta
virtual std::unique_ptr< RBTheta > build_eim_theta(unsigned int index)
Build a theta object corresponding to EIM index index.
Definition: rb_eim_evaluation.C:220
libMesh::RBEvaluation
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
libMesh::RBEIMEvaluation::_empty_rb_theta_expansion
RBThetaExpansion _empty_rb_theta_expansion
We initialize RBEIMEvaluation so that it has an "empty" RBThetaExpansion, because this isn't used at ...
Definition: rb_eim_evaluation.h:225
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::RBEIMEvaluation::interpolation_points
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
Definition: rb_eim_evaluation.h:182
libMesh::RBEIMEvaluation::_previous_error_bound
Real _previous_error_bound
Store the previous error bound returned by rb_solve (so we can return it if we are avoiding an unnece...
Definition: rb_eim_evaluation.h:243
libMesh::RBEIMEvaluation::interpolation_points_elem
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:194
libMesh::RBEIMEvaluation::get_error_bound_normalization
virtual Real get_error_bound_normalization() override
Definition: rb_eim_evaluation.C:198
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBEIMEvaluation::interpolation_matrix
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
Definition: rb_eim_evaluation.h:176
libMesh::RBThetaExpansion
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
Definition: rb_theta_expansion.h:44
libMesh::RBEIMEvaluation::RBEIMEvaluation
RBEIMEvaluation(const libMesh::Parallel::Communicator &comm_in)
Constructor.
Definition: rb_eim_evaluation.C:39
libMesh::DenseVector< Number >
libMesh::RBEIMEvaluation::legacy_read_offline_data_from_files
virtual void legacy_read_offline_data_from_files(const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true) override
Read in the saved Offline reduced basis data to initialize the system for Online solves.
Definition: rb_eim_evaluation.C:387
libMesh::RBEIMEvaluation::evaluate_parametrized_function
Number evaluate_parametrized_function(unsigned int var_index, const Point &p, const Elem &elem)
Definition: rb_eim_evaluation.C:103
libMesh::RBEIMEvaluation::attach_parametrized_function
void attach_parametrized_function(RBParametrizedFunction *pf)
Attach the parametrized function that we will approximate using the Empirical Interpolation Method.
Definition: rb_eim_evaluation.C:87