libMesh
rb_eim_evaluation.C
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 // C++ includes
21 #include <sstream>
22 #include <fstream>
23 
24 // rbOOmit includes
25 #include "libmesh/rb_eim_evaluation.h"
26 #include "libmesh/rb_eim_theta.h"
27 #include "libmesh/rb_parametrized_function.h"
28 
29 // libMesh includes
30 #include "libmesh/xdr_cxx.h"
31 #include "libmesh/libmesh_logging.h"
32 #include "libmesh/replicated_mesh.h"
33 #include "libmesh/elem.h"
34 #include "libmesh/auto_ptr.h" // libmesh_make_unique
35 
36 namespace libMesh
37 {
38 
39 RBEIMEvaluation::RBEIMEvaluation(const libMesh::Parallel::Communicator & comm_in)
40  :
41  RBEvaluation(comm_in),
42  _previous_N(0),
43  _previous_error_bound(-1),
44  _interpolation_points_mesh(comm_in)
45 {
46  // Indicate that we need to compute the RB
47  // inner product matrix in this case
49 
50  // initialize to the empty RBThetaExpansion object
52 
53  // Let's not renumber the _interpolation_points_mesh
55 }
56 
58 {
59  this->clear();
60 }
61 
63 {
64  Parent::clear();
65 
66  interpolation_points.clear();
70 
71  // Delete any RBTheta objects that were created
72  _rb_eim_theta_objects.clear();
73 }
74 
75 void RBEIMEvaluation::resize_data_structures(const unsigned int Nmax,
76  bool resize_error_bound_data)
77 {
78  Parent::resize_data_structures(Nmax, resize_error_bound_data);
79 
80  // Resize the data structures relevant to the EIM system
81  interpolation_points.clear();
84  interpolation_matrix.resize(Nmax,Nmax);
85 }
86 
88 {
89  _parametrized_functions.push_back(pf);
90 }
91 
93 {
94  return cast_int<unsigned int>
95  (_parametrized_functions.size());
96 }
97 
99 {
101 }
102 
104  const Point & p,
105  const Elem & elem)
106 {
107  if (var_index >= get_n_parametrized_functions())
108  libmesh_error_msg("Error: We must have var_index < get_n_parametrized_functions() in evaluate_parametrized_function.");
109 
110  return _parametrized_functions[var_index]->evaluate(get_parameters(), p, elem);
111 }
112 
114 {
115  // Short-circuit if we are using the same parameters and value of N
116  if ((_previous_parameters == get_parameters()) && (_previous_N == N))
117  {
118  return _previous_error_bound;
119  }
120 
121  // Otherwise, update _previous parameters, _previous_N
123  _previous_N = N;
124 
125  LOG_SCOPE("rb_solve()", "RBEIMEvaluation");
126 
127  if (N > get_n_basis_functions())
128  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
129 
130  if (N==0)
131  libmesh_error_msg("ERROR: N must be greater than 0 in rb_solve");
132 
133  // Get the rhs by sampling parametrized_function
134  // at the first N interpolation_points
135  DenseVector<Number> EIM_rhs(N);
136  for (unsigned int i=0; i<N; i++)
137  {
141  }
142 
143 
144 
145  DenseMatrix<Number> interpolation_matrix_N;
146  interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
147 
148  interpolation_matrix_N.lu_solve(EIM_rhs, RB_solution);
149 
150  // Optionally evaluate an a posteriori error bound. The EIM error estimate
151  // recommended in the literature is based on using "next" EIM point, so
152  // we skip this if N == get_n_basis_functions()
154  {
155  // Compute the a posteriori error bound
156  // First, sample the parametrized function at x_{N+1}
160 
161  // Next, evaluate the EIM approximation at x_{N+1}
162  Number EIM_approx_at_next_x = 0.;
163  for (unsigned int j=0; j<N; j++)
164  {
165  EIM_approx_at_next_x += RB_solution(j) * interpolation_matrix(N,j);
166  }
167 
168  Real error_estimate = std::abs(g_at_next_x - EIM_approx_at_next_x);
169 
170  _previous_error_bound = error_estimate;
171  return error_estimate;
172  }
173  else // Don't evaluate an error bound
174  {
175  _previous_error_bound = -1.;
176  return -1.;
177  }
178 
179 }
180 
182 {
183  LOG_SCOPE("rb_solve()", "RBEIMEvaluation");
184 
185  if (EIM_rhs.size() > get_n_basis_functions())
186  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
187 
188  if (EIM_rhs.size()==0)
189  libmesh_error_msg("ERROR: N must be greater than 0 in rb_solve");
190 
191  const unsigned int N = EIM_rhs.size();
192  DenseMatrix<Number> interpolation_matrix_N;
193  interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
194 
195  interpolation_matrix_N.lu_solve(EIM_rhs, RB_solution);
196 }
197 
199 {
200  // Just set the normalization factor to 1 in this case.
201  // Users can override this method if specific behavior
202  // is required.
203 
204  return 1.;
205 }
206 
208 {
209  // Initialize the rb_theta objects that access the solution from this rb_eim_evaluation
210  _rb_eim_theta_objects.clear();
211  for (unsigned int i=0; i<get_n_basis_functions(); i++)
212  _rb_eim_theta_objects.emplace_back(build_eim_theta(i));
213 }
214 
215 std::vector<std::unique_ptr<RBTheta>> & RBEIMEvaluation::get_eim_theta_objects()
216 {
217  return _rb_eim_theta_objects;
218 }
219 
220 std::unique_ptr<RBTheta> RBEIMEvaluation::build_eim_theta(unsigned int index)
221 {
222  return libmesh_make_unique<RBEIMTheta>(*this, index);
223 }
224 
225 void RBEIMEvaluation::legacy_write_offline_data_to_files(const std::string & directory_name,
226  const bool read_binary_data)
227 {
228  LOG_SCOPE("legacy_write_offline_data_to_files()", "RBEIMEvaluation");
229 
231 
232  // Get the number of basis functions
233  unsigned int n_bfs = get_n_basis_functions();
234 
235  // The writing mode: ENCODE for binary, WRITE for ASCII
236  XdrMODE mode = read_binary_data ? ENCODE : WRITE;
237 
238  // The suffix to use for all the files that are written out
239  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
240 
241  if (this->processor_id() == 0)
242  {
243  std::ostringstream file_name;
244 
245  // Next write out the interpolation_matrix
246  file_name.str("");
247  file_name << directory_name << "/interpolation_matrix" << suffix;
248  Xdr interpolation_matrix_out(file_name.str(), mode);
249 
250  for (unsigned int i=0; i<n_bfs; i++)
251  {
252  for (unsigned int j=0; j<=i; j++)
253  {
254  interpolation_matrix_out << interpolation_matrix(i,j);
255  }
256  }
257 
258  // Next write out interpolation_points
259  file_name.str("");
260  file_name << directory_name << "/interpolation_points" << suffix;
261  Xdr interpolation_points_out(file_name.str(), mode);
262 
263  for (unsigned int i=0; i<n_bfs; i++)
264  {
265  interpolation_points_out << interpolation_points[i](0);
266 
267  if (LIBMESH_DIM >= 2)
268  interpolation_points_out << interpolation_points[i](1);
269 
270  if (LIBMESH_DIM >= 3)
271  interpolation_points_out << interpolation_points[i](2);
272  }
273  interpolation_points_out.close();
274 
275  // Next write out interpolation_points_var
276  file_name.str("");
277  file_name << directory_name << "/interpolation_points_var" << suffix;
278  Xdr interpolation_points_var_out(file_name.str(), mode);
279 
280  for (unsigned int i=0; i<n_bfs; i++)
281  {
282  interpolation_points_var_out << interpolation_points_var[i];
283  }
284  interpolation_points_var_out.close();
285  }
286 
287  // Write out the elements associated with the interpolation points.
288  // This uses mesh I/O, hence we have to do it on all processors.
290 }
291 
292 void RBEIMEvaluation::legacy_write_out_interpolation_points_elem(const std::string & directory_name)
293 {
295 
296  // Maintain a set of node IDs to make sure we don't insert
297  // the same node into _interpolation_points_mesh more than once
298  std::set<dof_id_type> node_ids;
299  std::map<dof_id_type, dof_id_type> node_id_map;
300 
301  unsigned int new_node_id = 0;
302  for (const auto & old_elem : interpolation_points_elem)
303  for (unsigned int n=0; n<old_elem->n_nodes(); n++)
304  {
305  Node & node_ref = old_elem->node_ref(n);
306  dof_id_type old_node_id = node_ref.id();
307 
308  // Check if this node has already been added. This
309  // could happen if some of the elements are neighbors.
310  if (node_ids.find(old_node_id) == node_ids.end())
311  {
312  node_ids.insert(old_node_id);
313  _interpolation_points_mesh.add_point(node_ref, new_node_id, /* proc_id */ 0);
314 
315  node_id_map[old_node_id] = new_node_id;
316 
317  new_node_id++;
318  }
319  }
320 
321  // Maintain a map of elem IDs to make sure we don't insert
322  // the same elem into _interpolation_points_mesh more than once
323  std::map<dof_id_type,dof_id_type> elem_id_map;
324  std::vector<dof_id_type> interpolation_elem_ids(interpolation_points_elem.size());
325  dof_id_type new_elem_id = 0;
326  for (auto i : index_range(interpolation_elem_ids))
327  {
328  Elem * old_elem = interpolation_points_elem[i];
329 
330  dof_id_type old_elem_id = old_elem->id();
331 
332  // Only insert the element into the mesh if it hasn't already been inserted
333  std::map<dof_id_type,dof_id_type>::iterator id_it = elem_id_map.find(old_elem_id);
334  if (id_it == elem_id_map.end())
335  {
336  Elem * new_elem = Elem::build(old_elem->type(), /*parent*/ nullptr).release();
337  new_elem->subdomain_id() = old_elem->subdomain_id();
338 
339  // Assign all the nodes
340  for (unsigned int n=0; n<new_elem->n_nodes(); n++)
341  {
342  dof_id_type old_node_id = old_elem->node_id(n);
343  new_elem->set_node(n) =
344  _interpolation_points_mesh.node_ptr( node_id_map[old_node_id] );
345  }
346 
347  // Just set all proc_ids to 0
348  new_elem->processor_id() = 0;
349 
350  // Add the element to the mesh
352 
353  // Set the id of new_elem appropriately
354  new_elem->set_id(new_elem_id);
355  interpolation_elem_ids[i] = new_elem->id();
356  elem_id_map[old_elem_id] = new_elem->id();
357 
358  new_elem_id++;
359  }
360  else
361  {
362  interpolation_elem_ids[i] = id_it->second;
363  }
364 
365  }
366 
368 
369  _interpolation_points_mesh.write(directory_name + "/interpolation_points_mesh.xda");
370 
371  // Also, write out the vector that tells us which element each entry
372  // of interpolation_points_elem corresponds to. This allows us to handle
373  // the case in which elements are repeated in interpolation_points_elem.
374  if (processor_id() == 0)
375  {
376  // These are just integers, so no need for a binary format here
377  std::ofstream interpolation_elem_ids_out
378  ((directory_name + "/interpolation_elem_ids.dat").c_str(), std::ofstream::out);
379 
380  for (const auto & id : interpolation_elem_ids)
381  interpolation_elem_ids_out << id << std::endl;
382 
383  interpolation_elem_ids_out.close();
384  }
385 }
386 
387 void RBEIMEvaluation::legacy_read_offline_data_from_files(const std::string & directory_name,
388  bool read_error_bound_data,
389  const bool read_binary_data)
390 {
391  LOG_SCOPE("legacy_read_offline_data_from_files()", "RBEIMEvaluation");
392 
393  Parent::legacy_read_offline_data_from_files(directory_name, read_error_bound_data);
394 
395  // First, find out how many basis functions we had when Greedy terminated
396  // This was set in RBSystem::read_offline_data_from_files
397  unsigned int n_bfs = this->get_n_basis_functions();
398 
399  // The writing mode: DECODE for binary, READ for ASCII
400  XdrMODE mode = read_binary_data ? DECODE : READ;
401 
402  // The suffix to use for all the files that are written out
403  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
404 
405  // Stream for creating file names
406  std::ostringstream file_name;
407 
408  // Read in the interpolation matrix
409  file_name.str("");
410  file_name << directory_name << "/interpolation_matrix" << suffix;
411  assert_file_exists(file_name.str());
412 
413  Xdr interpolation_matrix_in(file_name.str(), mode);
414 
415  for (unsigned int i=0; i<n_bfs; i++)
416  {
417  for (unsigned int j=0; j<=i; j++)
418  {
419  Number value;
420  interpolation_matrix_in >> value;
422  }
423  }
424  interpolation_matrix_in.close();
425 
426  // Next read in interpolation_points
427  file_name.str("");
428  file_name << directory_name << "/interpolation_points" << suffix;
429  assert_file_exists(file_name.str());
430 
431  Xdr interpolation_points_in(file_name.str(), mode);
432 
433  for (unsigned int i=0; i<n_bfs; i++)
434  {
435  Real x_val, y_val, z_val = 0.;
436  interpolation_points_in >> x_val;
437 
438  if (LIBMESH_DIM >= 2)
439  interpolation_points_in >> y_val;
440 
441  if (LIBMESH_DIM >= 3)
442  interpolation_points_in >> z_val;
443 
444  Point p(x_val, y_val, z_val);
445  interpolation_points.push_back(p);
446  }
447  interpolation_points_in.close();
448 
449  // Next read in interpolation_points_var
450  file_name.str("");
451  file_name << directory_name << "/interpolation_points_var" << suffix;
452  assert_file_exists(file_name.str());
453 
454  Xdr interpolation_points_var_in(file_name.str(), mode);
455 
456  for (unsigned int i=0; i<n_bfs; i++)
457  {
458  unsigned int var;
459  interpolation_points_var_in >> var;
460  interpolation_points_var.push_back(var);
461  }
462  interpolation_points_var_in.close();
463 
464  // Read in the elements corresponding to the interpolation points
466 }
467 
468 void RBEIMEvaluation::legacy_read_in_interpolation_points_elem(const std::string & directory_name)
469 {
470  _interpolation_points_mesh.read(directory_name + "/interpolation_points_mesh.xda");
471 
472  // We have an element for each EIM basis function
473  unsigned int n_bfs = this->get_n_basis_functions();
474 
475  std::vector<dof_id_type> interpolation_elem_ids;
476  {
477  // These are just integers, so no need for a binary format here
478  std::ifstream interpolation_elem_ids_in
479  ((directory_name + "/interpolation_elem_ids.dat").c_str(), std::ifstream::in);
480 
481  if (!interpolation_elem_ids_in)
482  libmesh_error_msg("RB data missing: " + directory_name + "/interpolation_elem_ids.dat");
483 
484  for (unsigned int i=0; i<n_bfs; i++)
485  {
486  dof_id_type elem_id;
487  interpolation_elem_ids_in >> elem_id;
488  interpolation_elem_ids.push_back(elem_id);
489  }
490  interpolation_elem_ids_in.close();
491  }
492 
493  interpolation_points_elem.resize(n_bfs);
494  for (unsigned int i=0; i<n_bfs; i++)
495  {
497  _interpolation_points_mesh.elem_ptr(interpolation_elem_ids[i]);
498  }
499 }
500 
501 }
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::RBEvaluation::get_n_basis_functions
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
Definition: rb_evaluation.h:145
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
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::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::Elem::n_nodes
virtual unsigned int n_nodes() const =0
libMesh::ReplicatedMesh::node_ptr
virtual const Node * node_ptr(const dof_id_type i) const override
Definition: replicated_mesh.C:182
libMesh::DofObject::set_id
dof_id_type & set_id()
Definition: dof_object.h:776
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::Xdr
This class implements a C++ interface to the XDR (eXternal Data Representation) format.
Definition: xdr_cxx.h:65
libMesh::RBEIMEvaluation::clear
virtual void clear() override
Clear this object.
Definition: rb_eim_evaluation.C:62
libMesh::ReplicatedMesh::add_elem
virtual Elem * add_elem(Elem *e) override
Add elem e to the end of the element array.
Definition: replicated_mesh.C:282
libMesh::DenseMatrix< Number >
libMesh::WRITE
Definition: enum_xdr_mode.h:40
libMesh::RBEvaluation::clear
virtual void clear() override
Clear this RBEvaluation object.
Definition: rb_evaluation.C:62
libMesh::RBEvaluation::set_rb_theta_expansion
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:83
libMesh::ReplicatedMesh::clear
virtual void clear() override
Clear all internal data.
Definition: replicated_mesh.C:593
libMesh::DofObject::processor_id
processor_id_type processor_id() const
Definition: dof_object.h:829
libMesh::RBEvaluation::assert_file_exists
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
Definition: rb_evaluation.C:874
libMesh::RBEIMEvaluation::~RBEIMEvaluation
virtual ~RBEIMEvaluation()
Destructor.
Definition: rb_eim_evaluation.C:57
libMesh::RBParametrized::get_parameters
const RBParameters & get_parameters() const
Get the current parameters.
Definition: rb_parametrized.C:166
libMesh::DenseMatrix::resize
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:822
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::UnstructuredMesh::write
virtual void write(const std::string &name) override
Write the file specified by name.
Definition: unstructured_mesh.C:650
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::libmesh_assert
libmesh_assert(ctx)
libMesh::RBEvaluation::evaluate_RB_error_bound
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called.
Definition: rb_evaluation.h:322
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
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::RBEvaluation::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)
Read in the saved Offline reduced basis data to initialize the system for Online solves.
Definition: rb_evaluation.C:641
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::XdrMODE
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:35
libMesh::DECODE
Definition: enum_xdr_mode.h:39
libMesh::RBEvaluation::RB_solution
DenseVector< Number > RB_solution
The RB solution vector.
Definition: rb_evaluation.h:270
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::UnstructuredMesh::read
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) override
Reads the file specified by name.
Definition: unstructured_mesh.C:620
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::Node
A Node is like a Point, but with more information.
Definition: node.h:52
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::DenseVector::size
virtual unsigned int size() const override
Definition: dense_vector.h:92
libMesh::READ
Definition: enum_xdr_mode.h:41
libMesh::Elem::set_node
virtual Node *& set_node(const unsigned int i)
Definition: elem.h:2059
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::RBEvaluation::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)
Write out all the data to text files in order to segregate the Offline stage from the Online stage.
Definition: rb_evaluation.C:416
libMesh::ENCODE
Definition: enum_xdr_mode.h:38
libMesh::ReplicatedMesh::n_elem
virtual dof_id_type n_elem() const override
Definition: replicated_mesh.h:116
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::RBEvaluation::compute_RB_inner_product
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
Definition: rb_evaluation.h:327
value
static const bool value
Definition: xdr_io.C:56
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::Elem::subdomain_id
subdomain_id_type subdomain_id() const
Definition: elem.h:2069
libMesh::RBEvaluation
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
libMesh::DofObject::id
dof_id_type id() const
Definition: dof_object.h:767
libMesh::ReplicatedMesh::elem_ptr
virtual const Elem * elem_ptr(const dof_id_type i) const override
Definition: replicated_mesh.C:232
libMesh::DenseMatrix::get_principal_submatrix
void get_principal_submatrix(unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const
Put the sub_m x sub_n principal submatrix into dest.
Definition: dense_matrix_impl.h:574
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::RBEvaluation::resize_data_structures
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true)
Resize and clear the data vectors corresponding to the value of Nmax.
Definition: rb_evaluation.C:108
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::DenseMatrix::lu_solve
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)
Solve the system Ax=b given the input vector b.
Definition: dense_matrix_impl.h:625
libMesh::RBEIMEvaluation::get_error_bound_normalization
virtual Real get_error_bound_normalization() override
Definition: rb_eim_evaluation.C:198
libMesh::MeshBase::allow_renumbering
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use.
Definition: mesh_base.h:1025
libMesh::Elem::node_id
dof_id_type node_id(const unsigned int i) const
Definition: elem.h:1977
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::Elem::build
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
Definition: elem.C:246
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::out
OStreamProxy out
libMesh::Elem::type
virtual ElemType type() const =0
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::ReplicatedMesh::add_point
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id) override
functions for adding /deleting nodes elements.
Definition: replicated_mesh.C:417
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