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_theta_expansion.h"
26 #include "libmesh/rb_parametrized.h"
27 #include "libmesh/parallel_object.h"
28 #include "libmesh/dense_matrix.h"
29 #include "libmesh/dense_vector.h"
30 #include "libmesh/rb_parametrized_function.h"
31 #include "libmesh/fe_type.h"
32 
33 // C++ includes
34 #include <memory>
35 #include <map>
36 #include <vector>
37 #include <string>
38 
39 namespace libMesh
40 {
41 
42 class RBParameters;
43 class RBParametrizedFunction;
44 class RBTheta;
45 class System;
46 class EquationSystems;
47 class Elem;
48 
54 {
55 
62  :
64  n_eim_vars(0),
65  enforce_min_value(false),
66  enforce_max_value(false),
67  min_value(0.),
68  max_value(0.)
69  {
70  }
71 
75  unsigned int first_eim_var_index;
76 
81  unsigned int n_eim_vars;
82 
86  std::string eim_sys_name;
87 
97 
104 };
105 
112  public ParallelObject
113 {
114 public:
115 
120 
127  RBEIMEvaluation (RBEIMEvaluation &&) = default;
128  RBEIMEvaluation (const RBEIMEvaluation &) = delete;
129  RBEIMEvaluation & operator= (const RBEIMEvaluation &) = delete;
131  virtual ~RBEIMEvaluation ();
132 
136  typedef std::map<dof_id_type, std::vector<std::vector<Number>>> QpDataMap;
137 
141  typedef std::map<std::pair<dof_id_type,unsigned int>, std::vector<std::vector<Number>>> SideQpDataMap;
142 
146  typedef std::map<dof_id_type, std::vector<Number>> NodeDataMap;
147 
151  virtual void clear() override;
152 
157  void resize_data_structures(const unsigned int Nmax);
158 
164  void set_parametrized_function(std::unique_ptr<RBParametrizedFunction> pf);
165 
170 
175 
182 
187  void rb_eim_solves(const std::vector<RBParameters> & mus, unsigned int N);
188 
195 
203 
207  unsigned int get_n_basis_functions() const;
208 
214  unsigned int get_n_interpolation_points() const;
215 
219  unsigned int get_n_elems() const;
220 
224  unsigned int get_n_properties() const;
225 
230  void set_n_basis_functions(unsigned int n_bfs);
231 
235  void decrement_vector(QpDataMap & v,
236  const DenseVector<Number> & coeffs);
237 
242  const DenseVector<Number> & coeffs);
243 
248  const DenseVector<Number> & coeffs);
249 
256 
260  std::vector<std::unique_ptr<RBTheta>> & get_eim_theta_objects();
261 
267  virtual std::unique_ptr<RBTheta> build_eim_theta(unsigned int index);
268 
274  const QpDataMap & pf,
275  dof_id_type elem_id,
276  unsigned int comp,
277  std::vector<Number> & values);
278 
283  const SideQpDataMap & pf,
284  dof_id_type elem_id,
285  unsigned int side_index,
286  unsigned int comp,
287  std::vector<Number> & values);
288 
295  const NodeDataMap & pf,
296  dof_id_type node_id,
297  unsigned int comp);
298 
305  const QpDataMap & pf,
306  dof_id_type elem_id,
307  unsigned int comp,
308  unsigned int qp);
309 
315  const SideQpDataMap & pf,
316  dof_id_type elem_id,
317  unsigned int side_index,
318  unsigned int comp,
319  unsigned int qp);
320 
329  const NodeDataMap & pf,
330  dof_id_type node_id,
331  unsigned int comp);
332 
340  void get_eim_basis_function_values_at_qps(unsigned int basis_function_index,
341  dof_id_type elem_id,
342  unsigned int var,
343  std::vector<Number> & values) const;
344 
348  void get_eim_basis_function_side_values_at_qps(unsigned int basis_function_index,
349  dof_id_type elem_id,
350  unsigned int side_index,
351  unsigned int var,
352  std::vector<Number> & values) const;
353 
359  Number get_eim_basis_function_node_local_value(unsigned int basis_function_index,
360  dof_id_type node_id,
361  unsigned int var) const;
362 
367  Number get_eim_basis_function_value(unsigned int basis_function_index,
368  dof_id_type elem_id,
369  unsigned int comp,
370  unsigned int qp) const;
371 
375  Number get_eim_basis_function_side_value(unsigned int basis_function_index,
376  dof_id_type elem_id,
377  unsigned int side_index,
378  unsigned int comp,
379  unsigned int qp) const;
380 
387  Number get_eim_basis_function_node_value(unsigned int basis_function_index,
388  dof_id_type node_id,
389  unsigned int var) const;
390 
394  const QpDataMap & get_basis_function(unsigned int i) const;
395 
399  const SideQpDataMap & get_side_basis_function(unsigned int i) const;
400 
404  const NodeDataMap & get_node_basis_function(unsigned int i) const;
405 
411  void set_rb_eim_solutions(const std::vector<DenseVector<Number>> & rb_eim_solutions);
412 
416  const std::vector<DenseVector<Number>> & get_rb_eim_solutions() const;
417 
421  std::vector<Number> get_rb_eim_solutions_entries(unsigned int index) const;
422 
426  const std::vector<DenseVector<Number>> & get_eim_solutions_for_training_set() const;
427 
431  std::vector<DenseVector<Number>> & get_eim_solutions_for_training_set();
432 
438  const std::vector<std::pair<Real,Real>> & get_rb_eim_error_indicators() const;
439 
444  void add_interpolation_points_comp(unsigned int comp);
447  void add_interpolation_points_xyz_perturbations(const std::vector<Point> & perturbs);
449  void add_interpolation_points_side_index(unsigned int side_index);
451  void add_interpolation_points_qp(unsigned int qp);
453  void add_interpolation_points_phi_i_qp(const std::vector<Real> & phi_i_qp);
454  void add_interpolation_points_JxW_all_qp(const std::vector<Real> & JxW_all_qp);
455  void add_interpolation_points_phi_i_all_qp(const std::vector<std::vector<Real>> & phi_i_all_qp);
457  void add_elem_center_dxyzdxi(const Point & dxyzdxi);
458  void add_elem_center_dxyzdeta(const Point & dxyzdxi);
459  void add_interpolation_points_spatial_indices(const std::vector<unsigned int> & spatial_indices);
460  void add_elem_id_local_index_map_entry(dof_id_type elem_id, unsigned int local_index);
461  void add_rb_property_map_entry(std::string & property_name, std::set<dof_id_type> & entity_ids);
462 
466  Point get_interpolation_points_xyz(unsigned int index) const;
467  unsigned int get_interpolation_points_comp(unsigned int index) const;
469  boundary_id_type get_interpolation_points_boundary_id(unsigned int index) const;
470  const std::vector<Point> & get_interpolation_points_xyz_perturbations(unsigned int index) const;
471  dof_id_type get_interpolation_points_elem_id(unsigned int index) const;
472  unsigned int get_interpolation_points_side_index(unsigned int index) const;
473  dof_id_type get_interpolation_points_node_id(unsigned int index) const;
474  unsigned int get_interpolation_points_qp(unsigned int index) const;
475  ElemType get_interpolation_points_elem_type(unsigned int index) const;
476  const std::vector<Real> & get_interpolation_points_phi_i_qp(unsigned int index) const;
477  const std::vector<Real> & get_interpolation_points_JxW_all_qp(unsigned int index) const;
478  const std::vector<std::vector<Real>> & get_interpolation_points_phi_i_all_qp(unsigned int index) const;
479  Order get_interpolation_points_qrule_order(unsigned int index) const;
480  const Point & get_elem_center_dxyzdxi(unsigned int index) const;
481  const Point & get_elem_center_dxyzdeta(unsigned int index) const;
482  const std::vector<unsigned int> & get_interpolation_points_spatial_indices(unsigned int index) const;
483  const std::map<dof_id_type, unsigned int> & get_elem_id_to_local_index_map() const;
484  const std::unordered_map<std::string, std::set<dof_id_type>> & get_rb_property_map() const;
485 
491  unsigned int get_n_interpolation_points_spatial_indices() const;
492 
496  void set_interpolation_matrix_entry(unsigned int i, unsigned int j, Number value);
497 
502 
506  void add_basis_function(
507  const QpDataMap & bf);
508 
513  Point p,
514  unsigned int comp,
515  dof_id_type elem_id,
516  subdomain_id_type subdomain_id,
517  unsigned int qp,
518  const std::vector<Point> & perturbs,
519  const std::vector<Real> & phi_i_qp,
520  ElemType elem_type,
521  const std::vector<Real> & JxW_all_qp,
522  const std::vector<std::vector<Real>> & phi_i_all_qp,
523  Order qrule_order,
524  const Point & dxyz_dxi_elem_center,
525  const Point & dxyz_deta_elem_center);
526 
531  const SideQpDataMap & side_bf);
532 
537  Point p,
538  unsigned int comp,
539  dof_id_type elem_id,
540  unsigned int side_index,
541  subdomain_id_type subdomain_id,
542  boundary_id_type boundary_id,
543  unsigned int qp,
544  const std::vector<Point> & perturbs,
545  const std::vector<Real> & phi_i_qp);
546 
551  const NodeDataMap & node_bf);
552 
557  Point p,
558  unsigned int comp,
559  dof_id_type node_id,
560  boundary_id_type boundary_id);
561 
565  void set_preserve_rb_eim_solutions(bool preserve_rb_eim_solutions);
566 
570  bool get_preserve_rb_eim_solutions() const;
571 
582  void write_out_basis_functions(const std::string & directory_name = "offline_data",
583  bool write_binary_basis_functions = true);
584 
595  void read_in_basis_functions(const System & sys,
596  const std::string & directory_name = "offline_data",
597  bool read_binary_basis_functions = true);
598 
612  virtual void project_qp_data_vector_onto_system(System & sys,
613  const std::vector<Number> & bf_data,
614  const EIMVarGroupPlottingInfo & eim_vargroup,
615  const std::map<std::string,std::string> & extra_options);
616 
620  const std::vector<EIMVarGroupPlottingInfo> & get_eim_vars_to_project_and_write() const;
621 
625  const std::set<unsigned int> & scale_components_in_enrichment() const;
626 
636  virtual bool use_eim_error_indicator() const;
637 
643  void set_eim_error_indicator_active(bool is_active);
644 
649  void set_error_indicator_interpolation_row(const DenseVector<Number> & error_indicator_row);
650 
660  std::pair<Real,Real> get_eim_error_indicator(
661  Number error_indicator_rhs,
662  const DenseVector<Number> & eim_solution,
663  const DenseVector<Number> & eim_rhs);
664 
668  const VectorizedEvalInput & get_vec_eval_input() const;
669 
675 
687  std::vector<std::vector<std::vector<Number>>> get_interior_basis_functions_as_vecs();
688 
692  std::map<std::string,std::size_t>
693  get_interior_basis_function_sizes(std::vector<unsigned int> & n_qp_per_elem);
694 
716 
718 
726 
727 protected:
728 
740  std::vector<EIMVarGroupPlottingInfo> _eim_vars_to_project_and_write;
741 
751  std::set<unsigned int> _scale_components_in_enrichment;
752 
753 private:
754 
759  void write_out_interior_basis_functions(const std::string & directory_name,
760  bool write_binary_basis_functions);
761 
766  void write_out_side_basis_functions(const std::string & directory_name,
767  bool write_binary_basis_functions);
768 
773  void write_out_node_basis_functions(const std::string & directory_name,
774  bool write_binary_basis_functions);
775 
780  void read_in_interior_basis_functions(const System & sys,
781  const std::string & directory_name,
782  bool read_binary_basis_functions);
783 
788  void read_in_side_basis_functions(const System & sys,
789  const std::string & directory_name,
790  bool read_binary_basis_functions);
791 
796  void read_in_node_basis_functions(const System & sys,
797  const std::string & directory_name,
798  bool read_binary_basis_functions);
799 
804  std::vector<std::vector<Number>> get_interior_basis_function_as_vec_helper(
805  unsigned int n_vars,
806  unsigned int n_qp_data,
807  unsigned int bf_index);
808 
812  std::vector<DenseVector<Number>> _rb_eim_solutions;
813 
818  std::vector<std::pair<Real,Real>> _rb_eim_error_indicators;
819 
828  std::vector<DenseVector<Number>> _eim_solutions_for_training_set;
829 
836  std::vector<RBParameters> _rb_eim_solves_mus;
837  unsigned int _rb_eim_solves_N;
838 
844 
849 
854  std::vector<unsigned int> _interpolation_points_comp;
855 
862  std::vector<std::vector<unsigned int>> _interpolation_points_spatial_indices;
863 
870  std::unique_ptr<RBParametrizedFunction> _parametrized_function;
871 
876  std::vector<std::unique_ptr<RBTheta>> _rb_eim_theta_objects;
877 
886  std::vector<QpDataMap> _local_eim_basis_functions;
887 
896  std::vector<SideQpDataMap> _local_side_eim_basis_functions;
897 
906  std::vector<NodeDataMap> _local_node_eim_basis_functions;
907 
912  void print_local_eim_basis_functions() const;
913 
919  void gather_bfs();
920 
924  void side_gather_bfs();
925 
929  void node_gather_bfs();
930 
936  void distribute_bfs(const System & sys);
937 
941  void side_distribute_bfs(const System & sys);
942 
946  void node_distribute_bfs(const System & sys);
947 
954 
965 
972 
973 };
974 
975 }
976 
977 #endif // LIBMESH_RB_EIM_EVALUATION_H
void add_rb_property_map_entry(std::string &property_name, std::set< dof_id_type > &entity_ids)
void set_rb_eim_solutions(const std::vector< DenseVector< Number >> &rb_eim_solutions)
Set _rb_eim_solutions.
virtual void clear() override
Clear this object.
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
ElemType
Defines an enum for geometric element types.
void add_interpolation_points_boundary_id(boundary_id_type b_id)
void write_out_node_basis_functions(const std::string &directory_name, bool write_binary_basis_functions)
Method that writes out element node EIM basis functions.
std::map< std::pair< dof_id_type, unsigned int >, std::vector< std::vector< Number > > > SideQpDataMap
Type of the data structure used to map from (elem id, side index) -> [n_vars][n_qp] data...
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
EimErrorIndicatorNormalization
Here we store an enum that defines the type of EIM error indicator normalization that we use in get_e...
static Number get_parametrized_function_node_local_value(const NodeDataMap &pf, dof_id_type node_id, unsigned int comp)
Same as get_parametrized_function_values_at_qps() except for node data.
const SideQpDataMap & get_side_basis_function(unsigned int i) const
Get a reference to the i^th side basis function.
void set_eim_error_indicator_active(bool is_active)
Activate/decative the error indicator in EIM solves.
const DenseMatrix< Number > & get_interpolation_matrix() const
Get the EIM interpolation matrix.
void add_basis_function(const QpDataMap &bf)
Add bf to our EIM basis.
void set_interpolation_matrix_entry(unsigned int i, unsigned int j, Number value)
Set entry of the EIM interpolation matrix.
std::vector< RBParameters > _rb_eim_solves_mus
The parameters and the number of basis functions that were used in the most recent call to rb_eim_sol...
std::map< dof_id_type, std::vector< Number > > NodeDataMap
Type of the data structure used to map from (node id) -> [n_vars] data.
subdomain_id_type get_interpolation_points_subdomain_id(unsigned int index) const
void distribute_bfs(const System &sys)
Helper function that distributes the entries of _local_eim_basis_functions to their respective proces...
void get_eim_basis_function_side_values_at_qps(unsigned int basis_function_index, dof_id_type elem_id, unsigned int side_index, unsigned int var, std::vector< Number > &values) const
Same as get_eim_basis_function_values_at_qps() except for side data.
std::vector< std::vector< Number > > get_interior_basis_function_as_vec_helper(unsigned int n_vars, unsigned int n_qp_data, unsigned int bf_index)
Helper function called by write_out_interior_basis_functions() to get basis function bf_index stored ...
const std::set< unsigned int > & scale_components_in_enrichment() const
Get _scale_components_in_enrichment.
Order get_interpolation_points_qrule_order(unsigned int index) const
void get_eim_basis_function_values_at_qps(unsigned int basis_function_index, dof_id_type elem_id, unsigned int var, std::vector< Number > &values) const
Fill up values with the basis function values for basis function basis_function_index and variable va...
void rb_eim_solves(const std::vector< RBParameters > &mus, unsigned int N)
Perform rb_eim_solves at each mu in mus and store the results in _rb_eim_solutions.
std::map< std::string, std::size_t > get_interior_basis_function_sizes(std::vector< unsigned int > &n_qp_per_elem)
Get data that defines the sizes of interior EIM basis functions.
Number get_eim_basis_function_value(unsigned int basis_function_index, dof_id_type elem_id, unsigned int comp, unsigned int qp) const
Same as above, except that we just return the value at the qp^th quadrature point.
A simple functor class that provides a RBParameter-dependent function.
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
void add_node_basis_function(const NodeDataMap &node_bf)
Add node_bf to our EIM basis.
RBEIMEvaluation(const Parallel::Communicator &comm)
Constructor.
unsigned int get_n_interpolation_points_spatial_indices() const
_interpolation_points_spatial_indices is optional data, so we need to be able to check how many _inte...
void add_interpolation_points_elem_id(dof_id_type elem_id)
std::vector< Number > get_rb_eim_solutions_entries(unsigned int index) const
Return entry index for each solution in _rb_eim_solutions.
RBEIMEvaluation & operator=(const RBEIMEvaluation &)=delete
void read_in_node_basis_functions(const System &sys, const std::string &directory_name, bool read_binary_basis_functions)
Method that reads in element node EIM basis functions.
const std::vector< std::vector< Real > > & get_interpolation_points_phi_i_all_qp(unsigned int index) const
void add_interpolation_data(Point p, unsigned int comp, dof_id_type elem_id, subdomain_id_type subdomain_id, unsigned int qp, const std::vector< Point > &perturbs, const std::vector< Real > &phi_i_qp, ElemType elem_type, const std::vector< Real > &JxW_all_qp, const std::vector< std::vector< Real >> &phi_i_all_qp, Order qrule_order, const Point &dxyz_dxi_elem_center, const Point &dxyz_deta_elem_center)
Add interpolation data associated with a new basis function.
const std::vector< DenseVector< Number > > & get_rb_eim_solutions() const
Return the EIM solution coefficients from the most recent call to rb_eim_solves().
std::unique_ptr< RBParametrizedFunction > _parametrized_function
Store the parametrized function that will be approximated by this EIM system.
const Parallel::Communicator & comm() const
const std::vector< Point > & get_interpolation_points_xyz_perturbations(unsigned int index) const
unsigned int get_interpolation_points_side_index(unsigned int index) const
bool get_preserve_rb_eim_solutions() const
Get _preserve_rb_eim_solutions.
unsigned int get_n_interpolation_points() const
Return the number of interpolation points.
void decrement_vector(QpDataMap &v, const DenseVector< Number > &coeffs)
Subtract coeffs[i]*basis_function[i] from v.
const NodeDataMap & get_node_basis_function(unsigned int i) const
Get a reference to the i^th node basis function.
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int get_interpolation_points_comp(unsigned int index) const
const std::vector< DenseVector< Number > > & get_eim_solutions_for_training_set() const
Return a const reference to the EIM solutions for the parameters in the training set.
void initialize_param_fn_spatial_indices()
The Online counterpart of initialize_interpolation_points_spatial_indices().
void set_parametrized_function(std::unique_ptr< RBParametrizedFunction > pf)
Set the parametrized function that we will approximate using the Empirical Interpolation Method...
void add_interpolation_points_xyz_perturbations(const std::vector< Point > &perturbs)
bool _is_eim_error_indicator_active
Indicate if the EIM error indicator is active in RB EIM solves.
Define a struct for the input to the "vectorized evaluate" functions below.
unsigned int n_eim_vars
The number of EIM variables in the group.
void set_preserve_rb_eim_solutions(bool preserve_rb_eim_solutions)
Set _preserve_rb_eim_solutions.
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
void initialize_eim_theta_objects()
Build a vector of RBTheta objects that accesses the components of the RB_solution member variable of ...
void add_side_basis_function(const SideQpDataMap &side_bf)
Add side_bf to our EIM basis.
static Number get_parametrized_function_value(const Parallel::Communicator &comm, const QpDataMap &pf, dof_id_type elem_id, unsigned int comp, unsigned int qp)
Same as above, except that we just return the value at the qp^th quadrature point.
void side_decrement_vector(SideQpDataMap &v, const DenseVector< Number > &coeffs)
Same as decrement_vector() except for Side data.
void side_distribute_bfs(const System &sys)
Same as distribute_bfs() except for side data.
Number get_eim_basis_function_node_local_value(unsigned int basis_function_index, dof_id_type node_id, unsigned int var) const
Same as get_eim_basis_function_values_at_qps() except for node data.
std::vector< std::unique_ptr< RBTheta > > & get_eim_theta_objects()
const std::vector< Real > & get_interpolation_points_JxW_all_qp(unsigned int index) const
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
static void get_parametrized_function_values_at_qps(const QpDataMap &pf, dof_id_type elem_id, unsigned int comp, std::vector< Number > &values)
Fill up values by evaluating the parametrized function pf for all quadrature points on element elem_i...
const Point & get_elem_center_dxyzdeta(unsigned int index) const
void side_gather_bfs()
Same as gather_bfs() except for side data.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
bool enforce_min_value
These booleans indicate if we should clamp the resulting output to be above a min value or below a ma...
std::string eim_sys_name
The name of the System we use for plotting this EIM variable group.
const QpDataMap & get_basis_function(unsigned int i) const
Get a reference to the i^th basis function.
int8_t boundary_id_type
Definition: id_types.h:51
void read_in_basis_functions(const System &sys, const std::string &directory_name="offline_data", bool read_binary_basis_functions=true)
Read in all the basis functions from file.
boundary_id_type get_interpolation_points_boundary_id(unsigned int index) const
unsigned int n_vars
void print_local_eim_basis_functions() const
Print the contents of _local_eim_basis_functions to libMesh::out.
unsigned int get_n_properties() const
Return the number of properties stored in the rb_property_map.
void resize_data_structures(const unsigned int Nmax)
Resize the data structures for storing data associated with this object.
std::vector< std::vector< unsigned int > > _interpolation_points_spatial_indices
Here we store the spatial indices that were initialized by initialize_spatial_indices_at_interp_pts()...
void set_n_basis_functions(unsigned int n_bfs)
Set the number of basis functions.
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
const std::unordered_map< std::string, std::set< dof_id_type > > & get_rb_property_map() const
void node_distribute_bfs(const System &sys)
Same as distribute_bfs() except for node data.
void read_in_interior_basis_functions(const System &sys, const std::string &directory_name, bool read_binary_basis_functions)
Method that reads in element interior EIM basis functions.
void write_out_interior_basis_functions(const std::string &directory_name, bool write_binary_basis_functions)
Method that writes out element interior EIM basis functions.
std::map< dof_id_type, std::vector< std::vector< Number > > > QpDataMap
Type of the data structure used to map from (elem id) -> [n_vars][n_qp] data.
void add_elem_id_local_index_map_entry(dof_id_type elem_id, unsigned int local_index)
Number get_eim_basis_function_side_value(unsigned int basis_function_index, dof_id_type elem_id, unsigned int side_index, unsigned int comp, unsigned int qp) const
Same as get_eim_basis_function_value() except for side data.
const std::vector< unsigned int > & get_interpolation_points_spatial_indices(unsigned int index) const
const DenseVector< Number > & get_error_indicator_interpolation_row() const
Get/set _extra_points_interpolation_matrix.
ElemType get_interpolation_points_elem_type(unsigned int index) const
void add_side_interpolation_data(Point p, unsigned int comp, dof_id_type elem_id, unsigned int side_index, subdomain_id_type subdomain_id, boundary_id_type boundary_id, unsigned int qp, const std::vector< Point > &perturbs, const std::vector< Real > &phi_i_qp)
Add interpolation data associated with a new basis function.
void add_interpolation_points_side_index(unsigned int side_index)
void node_gather_bfs()
Same as gather_bfs() except for node data.
void add_node_interpolation_data(Point p, unsigned int comp, dof_id_type node_id, boundary_id_type boundary_id)
Add interpolation data associated with a new basis function.
void add_interpolation_points_phi_i_all_qp(const std::vector< std::vector< Real >> &phi_i_all_qp)
void node_decrement_vector(NodeDataMap &v, const DenseVector< Number > &coeffs)
Same as decrement_vector() except for node data.
void add_interpolation_points_phi_i_qp(const std::vector< Real > &phi_i_qp)
bool _preserve_rb_eim_solutions
Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves().
std::vector< DenseVector< Number > > _eim_solutions_for_training_set
Storage for EIM solutions from the training set.
void add_elem_center_dxyzdeta(const Point &dxyzdxi)
An object whose state is distributed along a set of processors.
bool limit_eim_error_indicator_to_one
If this boolean is true then we clamp EIM error indicator values to be at most 1. ...
static void get_parametrized_function_side_values_at_qps(const SideQpDataMap &pf, dof_id_type elem_id, unsigned int side_index, unsigned int comp, std::vector< Number > &values)
Same as get_parametrized_function_values_at_qps() except for side data.
std::vector< std::vector< std::vector< Number > > > get_interior_basis_functions_as_vecs()
Get all interior basis functions in the form of std::vectors.
EimErrorIndicatorNormalization eim_error_indicator_normalization
virtual std::unique_ptr< RBTheta > build_eim_theta(unsigned int index)
Build a theta object corresponding to EIM index index.
unsigned int first_eim_var_index
The index for the first EIM variable in this variable group.
Point get_interpolation_points_xyz(unsigned int index) const
Get the data associated with EIM interpolation points.
dof_id_type get_interpolation_points_node_id(unsigned int index) const
virtual bool use_eim_error_indicator() const
Virtual function to indicate if we use the EIM error indicator in this case.
void add_interpolation_points_subdomain_id(subdomain_id_type sbd_id)
DenseVector< Number > rb_eim_solve(DenseVector< Number > &EIM_rhs)
Calculate the EIM approximation for the given right-hand side vector EIM_rhs.
void add_interpolation_points_node_id(dof_id_type node_id)
void add_interpolation_points_xyz(Point p)
Set the data associated with EIM interpolation points.
std::pair< Real, Real > get_eim_error_indicator(Number error_indicator_rhs, const DenseVector< Number > &eim_solution, const DenseVector< Number > &eim_rhs)
Evaluates the EIM error indicator based on error_indicator_rhs, eim_solution, and _error_indicator_in...
void read_in_side_basis_functions(const System &sys, const std::string &directory_name, bool read_binary_basis_functions)
Method that reads in element side EIM basis functions.
void add_interpolation_points_qrule_order(Order qrule_order)
Number get_eim_basis_function_node_value(unsigned int basis_function_index, dof_id_type node_id, unsigned int var) const
Same as get_eim_basis_function_value() except for node data.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void initialize_rb_property_map()
Initialize the rb_property_map of RBEIMEvaluation (this) from the rb_property_map stored in RBParamet...
const VectorizedEvalInput & get_vec_eval_input() const
Get the VectorizedEvalInput data.
const std::map< dof_id_type, unsigned int > & get_elem_id_to_local_index_map() const
void add_interpolation_points_JxW_all_qp(const std::vector< Real > &JxW_all_qp)
virtual void project_qp_data_vector_onto_system(System &sys, const std::vector< Number > &bf_data, const EIMVarGroupPlottingInfo &eim_vargroup, const std::map< std::string, std::string > &extra_options)
Project the EIM basis function data stored in bf_data onto sys.solution.
static Number get_parametrized_function_side_value(const Parallel::Communicator &comm, const SideQpDataMap &pf, dof_id_type elem_id, unsigned int side_index, unsigned int comp, unsigned int qp)
Same as get_parametrized_function_value() except for side data.
This class is part of the rbOOmit framework.
std::vector< DenseVector< Number > > _rb_eim_solutions
The EIM solution coefficients from the most recent call to rb_eim_solves().
void set_error_indicator_interpolation_row(const DenseVector< Number > &error_indicator_row)
static const bool value
Definition: xdr_io.C:54
std::vector< unsigned int > _interpolation_points_comp
In the case of a "vector-valued" EIM, this vector determines which component of the parameterized fun...
std::set< unsigned int > _scale_components_in_enrichment
This set that specifies which EIM variables will be scaled during EIM enrichment so that their maximu...
dof_id_type get_interpolation_points_elem_id(unsigned int index) const
void add_interpolation_points_comp(unsigned int comp)
unsigned int get_n_elems() const
Return the number of unique elements containing interpolation points.
std::vector< EIMVarGroupPlottingInfo > _eim_vars_to_project_and_write
This vector specifies which EIM variables we want to write to disk and/or project to nodes for plotti...
void add_interpolation_points_qp(unsigned int qp)
std::vector< std::pair< Real, Real > > _rb_eim_error_indicators
If we&#39;re using the EIM error indicator, then we store the error indicator values corresponding to _rb...
EIMVarGroupPlottingInfo()
Default constructor.
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.
void add_interpolation_points_spatial_indices(const std::vector< unsigned int > &spatial_indices)
const std::vector< Real > & get_interpolation_points_phi_i_qp(unsigned int index) const
This struct encapsulates data that specifies how we will perform plotting for EIM variable groups...
This class enables evaluation of an Empirical Interpolation Method (EIM) approximation.
void write_out_basis_functions(const std::string &directory_name="offline_data", bool write_binary_basis_functions=true)
Write out all the basis functions to file.
const Point & get_elem_center_dxyzdxi(unsigned int index) const
void initialize_interpolation_points_spatial_indices()
Initialize _interpolation_points_spatial_indices.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
void add_elem_center_dxyzdxi(const Point &dxyzdxi)
unsigned int get_interpolation_points_qp(unsigned int index) const
void write_out_side_basis_functions(const std::string &directory_name, bool write_binary_basis_functions)
Method that writes out element side EIM basis functions.
DenseVector< Number > _error_indicator_interpolation_row
Here we store an extra row of the interpolation matrix which is used to compute the EIM error indicat...
void add_interpolation_points_elem_type(ElemType elem_type)
const std::vector< EIMVarGroupPlottingInfo > & get_eim_vars_to_project_and_write() const
Get _eim_vars_to_project_and_write.
uint8_t dof_id_type
Definition: id_types.h:67
void gather_bfs()
Helper function that gathers the contents of _local_eim_basis_functions to processor 0 in preparation...
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
static Number get_parametrized_function_node_value(const Parallel::Communicator &comm, const NodeDataMap &pf, dof_id_type node_id, unsigned int comp)
Same as get_parametrized_function_value() except for node data.
const std::vector< std::pair< Real, Real > > & get_rb_eim_error_indicators() const
Return the EIM error indicator values from the most recent call to rb_eim_solves().