libMesh
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
libMesh::RBEIMEvaluation Class Reference

This class enables evaluation of an Empirical Interpolation Method (EIM) approximation. More...

#include <rb_eim_evaluation.h>

Inheritance diagram for libMesh::RBEIMEvaluation:
[legend]

Public Types

enum  EimErrorIndicatorNormalization { RESIDUAL_TERMS, MAX_RHS }
 Here we store an enum that defines the type of EIM error indicator normalization that we use in get_eim_error_indicator(). More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef std::map< dof_id_type, std::vector< Number > > NodeDataMap
 Type of the data structure used to map from (node id) -> [n_vars] data. More...
 

Public Member Functions

 RBEIMEvaluation (const Parallel::Communicator &comm)
 Constructor. More...
 
 RBEIMEvaluation (RBEIMEvaluation &&)=default
 Special functions. More...
 
 RBEIMEvaluation (const RBEIMEvaluation &)=delete
 
RBEIMEvaluationoperator= (const RBEIMEvaluation &)=delete
 
RBEIMEvaluationoperator= (RBEIMEvaluation &&)=default
 
virtual ~RBEIMEvaluation ()
 
virtual void clear () override
 Clear this object. More...
 
void resize_data_structures (const unsigned int Nmax)
 Resize the data structures for storing data associated with this object. More...
 
void set_parametrized_function (std::unique_ptr< RBParametrizedFunction > pf)
 Set the parametrized function that we will approximate using the Empirical Interpolation Method. More...
 
RBParametrizedFunctionget_parametrized_function ()
 Get a reference to the parametrized function. More...
 
const RBParametrizedFunctionget_parametrized_function () const
 Get a const reference to the parametrized function. More...
 
DenseVector< Numberrb_eim_solve (DenseVector< Number > &EIM_rhs)
 Calculate the EIM approximation for the given right-hand side vector EIM_rhs. More...
 
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. More...
 
void initialize_interpolation_points_spatial_indices ()
 Initialize _interpolation_points_spatial_indices. More...
 
void initialize_param_fn_spatial_indices ()
 The Online counterpart of initialize_interpolation_points_spatial_indices(). More...
 
unsigned int get_n_basis_functions () const
 Return the current number of EIM basis functions. More...
 
unsigned int get_n_interpolation_points () const
 Return the number of interpolation points. More...
 
void set_n_basis_functions (unsigned int n_bfs)
 Set the number of basis functions. More...
 
void decrement_vector (QpDataMap &v, const DenseVector< Number > &coeffs)
 Subtract coeffs[i]*basis_function[i] from v. More...
 
void side_decrement_vector (SideQpDataMap &v, const DenseVector< Number > &coeffs)
 Same as decrement_vector() except for Side data. More...
 
void node_decrement_vector (NodeDataMap &v, const DenseVector< Number > &coeffs)
 Same as decrement_vector() except for node data. More...
 
void initialize_eim_theta_objects ()
 Build a vector of RBTheta objects that accesses the components of the RB_solution member variable of this RBEvaluation. More...
 
std::vector< std::unique_ptr< RBTheta > > & get_eim_theta_objects ()
 
virtual std::unique_ptr< RBThetabuild_eim_theta (unsigned int index)
 Build a theta object corresponding to EIM index index. More...
 
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 var, at all quadrature points on element elem_id. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
const QpDataMapget_basis_function (unsigned int i) const
 Get a reference to the i^th basis function. More...
 
const SideQpDataMapget_side_basis_function (unsigned int i) const
 Get a reference to the i^th side basis function. More...
 
const NodeDataMapget_node_basis_function (unsigned int i) const
 Get a reference to the i^th node basis function. More...
 
void set_rb_eim_solutions (const std::vector< DenseVector< Number >> &rb_eim_solutions)
 Set _rb_eim_solutions. More...
 
const std::vector< DenseVector< Number > > & get_rb_eim_solutions () const
 Return the EIM solution coefficients from the most recent call to rb_eim_solves(). More...
 
std::vector< Numberget_rb_eim_solutions_entries (unsigned int index) const
 Return entry index for each solution in _rb_eim_solutions. More...
 
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. More...
 
std::vector< DenseVector< Number > > & get_eim_solutions_for_training_set ()
 Return a writeable reference to the EIM solutions for the parameters in the training set. More...
 
const std::vector< Real > & get_rb_eim_error_indicators () const
 Return the EIM error indicator values from the most recent call to rb_eim_solves(). More...
 
void add_interpolation_points_xyz (Point p)
 Set the data associated with EIM interpolation points. More...
 
void add_interpolation_points_comp (unsigned int comp)
 
void add_interpolation_points_subdomain_id (subdomain_id_type sbd_id)
 
void add_interpolation_points_boundary_id (boundary_id_type b_id)
 
void add_interpolation_points_xyz_perturbations (const std::vector< Point > &perturbs)
 
void add_interpolation_points_elem_id (dof_id_type elem_id)
 
void add_interpolation_points_side_index (unsigned int side_index)
 
void add_interpolation_points_node_id (dof_id_type node_id)
 
void add_interpolation_points_qp (unsigned int qp)
 
void add_interpolation_points_elem_type (ElemType elem_type)
 
void add_interpolation_points_phi_i_qp (const std::vector< Real > &phi_i_qp)
 
void add_interpolation_points_JxW_all_qp (const std::vector< Real > &JxW_all_qp)
 
void add_interpolation_points_phi_i_all_qp (const std::vector< std::vector< Real >> &phi_i_all_qp)
 
void add_interpolation_points_spatial_indices (const std::vector< unsigned int > &spatial_indices)
 
Point get_interpolation_points_xyz (unsigned int index) const
 Get the data associated with EIM interpolation points. More...
 
unsigned int get_interpolation_points_comp (unsigned int index) const
 
subdomain_id_type get_interpolation_points_subdomain_id (unsigned int index) const
 
boundary_id_type get_interpolation_points_boundary_id (unsigned int index) const
 
const std::vector< Point > & get_interpolation_points_xyz_perturbations (unsigned int index) const
 
dof_id_type get_interpolation_points_elem_id (unsigned int index) const
 
unsigned int get_interpolation_points_side_index (unsigned int index) const
 
dof_id_type get_interpolation_points_node_id (unsigned int index) const
 
unsigned int get_interpolation_points_qp (unsigned int index) const
 
ElemType get_interpolation_points_elem_type (unsigned int index) const
 
const std::vector< Real > & get_interpolation_points_phi_i_qp (unsigned int index) const
 
const std::vector< Real > & get_interpolation_points_JxW_all_qp (unsigned int index) const
 
const std::vector< std::vector< Real > > & get_interpolation_points_phi_i_all_qp (unsigned int index) const
 
const std::vector< unsigned int > & get_interpolation_points_spatial_indices (unsigned int index) const
 
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 _interpolation_points_spatial_indices values have actually been set since it may not match the number of interpolation points. More...
 
void set_interpolation_matrix_entry (unsigned int i, unsigned int j, Number value)
 Set entry of the EIM interpolation matrix. More...
 
const DenseMatrix< Number > & get_interpolation_matrix () const
 Get the EIM interpolation matrix. More...
 
void add_basis_function (const QpDataMap &bf)
 Add bf to our EIM basis. More...
 
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)
 Add interpolation data associated with a new basis function. More...
 
void add_side_basis_function (const SideQpDataMap &side_bf)
 Add side_bf to our EIM basis. More...
 
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. More...
 
void add_node_basis_function (const NodeDataMap &node_bf)
 Add node_bf to our EIM basis. More...
 
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. More...
 
void set_preserve_rb_eim_solutions (bool preserve_rb_eim_solutions)
 Set _preserve_rb_eim_solutions. More...
 
bool get_preserve_rb_eim_solutions () const
 Get _preserve_rb_eim_solutions. More...
 
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. More...
 
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. More...
 
virtual void project_qp_data_map_onto_system (System &sys, const QpDataMap &bf_data, const EIMVarGroupPlottingInfo &eim_vargroup)
 Project the specified variable of bf_data into the solution vector of System. More...
 
const std::vector< EIMVarGroupPlottingInfo > & get_eim_vars_to_project_and_write () const
 Get _eim_vars_to_project_and_write. More...
 
void write_out_projected_basis_functions (EquationSystems &es, const std::string &directory_name="offline_data")
 Project all basis functions using project_qp_data_map_onto_system() and then write out the resulting vectors. More...
 
const std::set< unsigned int > & scale_components_in_enrichment () const
 Get _scale_components_in_enrichment. More...
 
virtual bool use_eim_error_indicator () const
 Virtual function to indicate if we use the EIM error indicator in this case. More...
 
void set_eim_error_indicator_active (bool is_active)
 Activate/decative the error indicator in EIM solves. More...
 
const DenseVector< Number > & get_error_indicator_interpolation_row () const
 Get/set _extra_points_interpolation_matrix. More...
 
void set_error_indicator_interpolation_row (const DenseVector< Number > &error_indicator_row)
 
std::pair< Real, Realget_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_interpolation_row. More...
 
const VectorizedEvalInputget_vec_eval_input () const
 Get the VectorizedEvalInput data. More...
 
void initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
 Initialize the parameter ranges and set current_parameters. More...
 
void initialize_parameters (const RBParametrized &rb_parametrized)
 Initialize the parameter ranges and set current_parameters. More...
 
unsigned int get_n_params () const
 Get the number of parameters. More...
 
unsigned int get_n_continuous_params () const
 Get the number of continuous parameters. More...
 
unsigned int get_n_discrete_params () const
 Get the number of discrete parameters. More...
 
std::set< std::string > get_parameter_names () const
 Get a set that stores the parameter names. More...
 
const RBParametersget_parameters () const
 Get the current parameters. More...
 
bool set_parameters (const RBParameters &params)
 Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected. More...
 
const RBParametersget_parameters_min () const
 Get an RBParameters object that specifies the minimum allowable value for each parameter. More...
 
const RBParametersget_parameters_max () const
 Get an RBParameters object that specifies the maximum allowable value for each parameter. More...
 
Real get_parameter_min (const std::string &param_name) const
 Get minimum allowable value of parameter param_name. More...
 
Real get_parameter_max (const std::string &param_name) const
 Get maximum allowable value of parameter param_name. More...
 
void print_parameters () const
 Print the current parameters. More...
 
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)
 Write out the parameter ranges to files. More...
 
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)
 Read in the parameter ranges from files. More...
 
bool is_discrete_parameter (const std::string &mu_name) const
 Is parameter mu_name discrete? More...
 
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values () const
 Get a const reference to the discrete parameter values. More...
 
void print_discrete_parameter_values () const
 Print out all the discrete parameter values. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

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_id and component comp. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static Real get_closest_value (Real value, const std::vector< Real > &list_of_values)
 
static std::string get_info ()
 Gets a string containing the reference information. More...
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out. More...
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects. More...
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info() More...
 
static void disable_print_counter_info ()
 

Public Attributes

EimErrorIndicatorNormalization eim_error_indicator_normalization
 
bool verbose_mode
 Public boolean to toggle verbose mode. More...
 

Protected Types

typedef std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
 Data structure to log the information. More...
 

Protected Member Functions

void increment_constructor_count (const std::string &name) noexcept
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name) noexcept
 Increments the destruction counter. More...
 

Protected Attributes

std::vector< EIMVarGroupPlottingInfo_eim_vars_to_project_and_write
 This vector specifies which EIM variables will be projected and written out in write_out_projected_basis_functions(). More...
 
std::set< unsigned int_scale_components_in_enrichment
 This set that specifies which EIM variables will be scaled during EIM enrichment so that their maximum value matches the maximum value across all variables. More...
 
const Parallel::Communicator_communicator
 

Static Protected Attributes

static Counts _counts
 Actually holds the data. More...
 
static Threads::atomic< unsigned int_n_objects
 The number of objects. More...
 
static Threads::spin_mutex _mutex
 Mutual exclusion object to enable thread-safe reference counting. More...
 
static bool _enable_print_counter = true
 Flag to control whether reference count information is printed when print_info is called. More...
 

Private Member 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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void print_local_eim_basis_functions () const
 Print the contents of _local_eim_basis_functions to libMesh::out. More...
 
void gather_bfs ()
 Helper function that gathers the contents of _local_eim_basis_functions to processor 0 in preparation for printing to file. More...
 
void side_gather_bfs ()
 Same as gather_bfs() except for side data. More...
 
void node_gather_bfs ()
 Same as gather_bfs() except for node data. More...
 
void distribute_bfs (const System &sys)
 Helper function that distributes the entries of _local_eim_basis_functions to their respective processors after they are read in on processor 0. More...
 
void side_distribute_bfs (const System &sys)
 Same as distribute_bfs() except for side data. More...
 
void node_distribute_bfs (const System &sys)
 Same as distribute_bfs() except for node data. More...
 

Private Attributes

std::vector< DenseVector< Number > > _rb_eim_solutions
 The EIM solution coefficients from the most recent call to rb_eim_solves(). More...
 
std::vector< Real_rb_eim_error_indicators
 If we're using the EIM error indicator, then we store the error indicator values corresponding to _rb_eim_solutions here. More...
 
std::vector< DenseVector< Number > > _eim_solutions_for_training_set
 Storage for EIM solutions from the training set. More...
 
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_solves(). More...
 
unsigned int _rb_eim_solves_N
 
DenseMatrix< Number_interpolation_matrix
 Dense matrix that stores the lower triangular interpolation matrix that can be used. More...
 
VectorizedEvalInput _vec_eval_input
 We store the EIM interpolation point data in this object. More...
 
std::vector< unsigned int_interpolation_points_comp
 In the case of a "vector-valued" EIM, this vector determines which component of the parameterized function we sample at each EIM point. More...
 
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(). More...
 
std::unique_ptr< RBParametrizedFunction_parametrized_function
 Store the parametrized function that will be approximated by this EIM system. More...
 
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
 The vector of RBTheta objects that are created to point to this RBEIMEvaluation. More...
 
std::vector< QpDataMap_local_eim_basis_functions
 The EIM basis functions. More...
 
std::vector< SideQpDataMap_local_side_eim_basis_functions
 The EIM basis functions on element sides. More...
 
std::vector< NodeDataMap_local_node_eim_basis_functions
 The EIM basis functions on element nodes (e.g. More...
 
bool _preserve_rb_eim_solutions
 Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves(). More...
 
bool _is_eim_error_indicator_active
 Indicate if the EIM error indicator is active in RB EIM solves. More...
 
DenseVector< Number_error_indicator_interpolation_row
 Here we store an extra row of the interpolation matrix which is used to compute the EIM error indicator. More...
 

Detailed Description

This class enables evaluation of an Empirical Interpolation Method (EIM) approximation.

RBEvaluation plays an analogous role in the context of the regular reduced basis method.

Definition at line 90 of file rb_eim_evaluation.h.

Member Typedef Documentation

◆ Counts

typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts
protectedinherited

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

◆ NodeDataMap

typedef std::map<dof_id_type, std::vector<Number> > libMesh::RBEIMEvaluation::NodeDataMap

Type of the data structure used to map from (node id) -> [n_vars] data.

Definition at line 125 of file rb_eim_evaluation.h.

◆ QpDataMap

typedef std::map<dof_id_type, std::vector<std::vector<Number> > > libMesh::RBEIMEvaluation::QpDataMap

Type of the data structure used to map from (elem id) -> [n_vars][n_qp] data.

Definition at line 115 of file rb_eim_evaluation.h.

◆ SideQpDataMap

typedef std::map<std::pair<dof_id_type,unsigned int>, std::vector<std::vector<Number> > > libMesh::RBEIMEvaluation::SideQpDataMap

Type of the data structure used to map from (elem id, side index) -> [n_vars][n_qp] data.

Definition at line 120 of file rb_eim_evaluation.h.

Member Enumeration Documentation

◆ EimErrorIndicatorNormalization

Here we store an enum that defines the type of EIM error indicator normalization that we use in get_eim_error_indicator().

The enum is public so that it can be set in user code.

RESIDUAL_TERMS: Use the terms in the EIM residual to determine the error indicator normalization (default).

MAX_RHS: Use the maximum value in the EIM RHS vector to determine the error indicator normalization.

Enumerator
RESIDUAL_TERMS 
MAX_RHS 

Definition at line 634 of file rb_eim_evaluation.h.

Constructor & Destructor Documentation

◆ RBEIMEvaluation() [1/3]

RBEIMEvaluation::RBEIMEvaluation ( const Parallel::Communicator comm)

Constructor.

Definition at line 48 of file rb_eim_evaluation.C.

49 :
55 {
56 }
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
const Parallel::Communicator & comm() const
bool _is_eim_error_indicator_active
Indicate if the EIM error indicator is active in RB EIM solves.
bool _preserve_rb_eim_solutions
Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves().
EimErrorIndicatorNormalization eim_error_indicator_normalization

◆ RBEIMEvaluation() [2/3]

libMesh::RBEIMEvaluation::RBEIMEvaluation ( RBEIMEvaluation &&  )
default

Special functions.

  • This class contains unique_ptrs, so it can't be default copy constructed/assigned.
  • The destructor is defaulted out of line.

◆ RBEIMEvaluation() [3/3]

libMesh::RBEIMEvaluation::RBEIMEvaluation ( const RBEIMEvaluation )
delete

◆ ~RBEIMEvaluation()

RBEIMEvaluation::~RBEIMEvaluation ( )
virtualdefault

Member Function Documentation

◆ add_basis_function()

void RBEIMEvaluation::add_basis_function ( const QpDataMap bf)

Add bf to our EIM basis.

Definition at line 893 of file rb_eim_evaluation.C.

References _local_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors().

895 {
896  _local_eim_basis_functions.emplace_back(bf);
897 }
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.

◆ add_interpolation_data()

void RBEIMEvaluation::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 
)

Add interpolation data associated with a new basis function.

Definition at line 899 of file rb_eim_evaluation.C.

References _interpolation_points_comp, _vec_eval_input, libMesh::VectorizedEvalInput::all_xyz, libMesh::VectorizedEvalInput::all_xyz_perturb, libMesh::VectorizedEvalInput::elem_ids, libMesh::VectorizedEvalInput::elem_types, libMesh::VectorizedEvalInput::JxW_all_qp, libMesh::VectorizedEvalInput::phi_i_all_qp, libMesh::VectorizedEvalInput::phi_i_qp, libMesh::VectorizedEvalInput::qps, and libMesh::VectorizedEvalInput::sbd_ids.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors().

910 {
911  _vec_eval_input.all_xyz.emplace_back(p);
912  _interpolation_points_comp.emplace_back(comp);
913  _vec_eval_input.elem_ids.emplace_back(elem_id);
914  _vec_eval_input.sbd_ids.emplace_back(subdomain_id);
915  _vec_eval_input.qps.emplace_back(qp);
916  _vec_eval_input.all_xyz_perturb.emplace_back(perturbs);
917  _vec_eval_input.phi_i_qp.emplace_back(phi_i_qp);
918  _vec_eval_input.elem_types.emplace_back(elem_type);
919  _vec_eval_input.JxW_all_qp.emplace_back(JxW_all_qp);
920  _vec_eval_input.phi_i_all_qp.emplace_back(phi_i_all_qp);
921 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< ElemType > elem_types
std::vector< std::vector< Real > > JxW_all_qp
std::vector< unsigned int > qps
std::vector< std::vector< Real > > phi_i_qp
std::vector< dof_id_type > elem_ids
std::vector< subdomain_id_type > sbd_ids
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.
std::vector< std::vector< std::vector< Real > > > phi_i_all_qp
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::vector< std::vector< Point > > all_xyz_perturb

◆ add_interpolation_points_boundary_id()

void RBEIMEvaluation::add_interpolation_points_boundary_id ( boundary_id_type  b_id)

Definition at line 712 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::boundary_ids.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

713 {
714  _vec_eval_input.boundary_ids.emplace_back(b_id);
715 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< boundary_id_type > boundary_ids

◆ add_interpolation_points_comp()

void RBEIMEvaluation::add_interpolation_points_comp ( unsigned int  comp)

Definition at line 702 of file rb_eim_evaluation.C.

References _interpolation_points_comp.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

703 {
704  _interpolation_points_comp.emplace_back(comp);
705 }
std::vector< unsigned int > _interpolation_points_comp
In the case of a "vector-valued" EIM, this vector determines which component of the parameterized fun...

◆ add_interpolation_points_elem_id()

void RBEIMEvaluation::add_interpolation_points_elem_id ( dof_id_type  elem_id)

Definition at line 722 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::elem_ids.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

723 {
724  _vec_eval_input.elem_ids.emplace_back(elem_id);
725 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< dof_id_type > elem_ids

◆ add_interpolation_points_elem_type()

void RBEIMEvaluation::add_interpolation_points_elem_type ( ElemType  elem_type)

Definition at line 742 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::elem_types.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

743 {
744  _vec_eval_input.elem_types.emplace_back(elem_type);
745 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< ElemType > elem_types

◆ add_interpolation_points_JxW_all_qp()

void RBEIMEvaluation::add_interpolation_points_JxW_all_qp ( const std::vector< Real > &  JxW_all_qp)

Definition at line 747 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::JxW_all_qp.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

748 {
749  _vec_eval_input.JxW_all_qp.emplace_back(JxW_all_qp);
750 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Real > > JxW_all_qp

◆ add_interpolation_points_node_id()

void RBEIMEvaluation::add_interpolation_points_node_id ( dof_id_type  node_id)

Definition at line 732 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::node_ids.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

733 {
734  _vec_eval_input.node_ids.emplace_back(node_id);
735 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< dof_id_type > node_ids

◆ add_interpolation_points_phi_i_all_qp()

void RBEIMEvaluation::add_interpolation_points_phi_i_all_qp ( const std::vector< std::vector< Real >> &  phi_i_all_qp)

Definition at line 752 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::phi_i_all_qp.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

753 {
754  _vec_eval_input.phi_i_all_qp.emplace_back(phi_i_all_qp);
755 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< std::vector< Real > > > phi_i_all_qp

◆ add_interpolation_points_phi_i_qp()

void RBEIMEvaluation::add_interpolation_points_phi_i_qp ( const std::vector< Real > &  phi_i_qp)

Definition at line 757 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::phi_i_qp.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

758 {
759  _vec_eval_input.phi_i_qp.emplace_back(phi_i_qp);
760 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Real > > phi_i_qp

◆ add_interpolation_points_qp()

void RBEIMEvaluation::add_interpolation_points_qp ( unsigned int  qp)

Definition at line 737 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::qps.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

738 {
739  _vec_eval_input.qps.emplace_back(qp);
740 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< unsigned int > qps

◆ add_interpolation_points_side_index()

void RBEIMEvaluation::add_interpolation_points_side_index ( unsigned int  side_index)

Definition at line 727 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::side_indices.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

728 {
729  _vec_eval_input.side_indices.emplace_back(side_index);
730 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< unsigned int > side_indices

◆ add_interpolation_points_spatial_indices()

void RBEIMEvaluation::add_interpolation_points_spatial_indices ( const std::vector< unsigned int > &  spatial_indices)

Definition at line 762 of file rb_eim_evaluation.C.

References _interpolation_points_spatial_indices.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

763 {
764  _interpolation_points_spatial_indices.emplace_back(spatial_indices);
765 }
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()...

◆ add_interpolation_points_subdomain_id()

void RBEIMEvaluation::add_interpolation_points_subdomain_id ( subdomain_id_type  sbd_id)

Definition at line 707 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::sbd_ids.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

708 {
709  _vec_eval_input.sbd_ids.emplace_back(sbd_id);
710 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< subdomain_id_type > sbd_ids

◆ add_interpolation_points_xyz()

void RBEIMEvaluation::add_interpolation_points_xyz ( Point  p)

Set the data associated with EIM interpolation points.

Definition at line 697 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::all_xyz.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

698 {
699  _vec_eval_input.all_xyz.emplace_back(p);
700 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.

◆ add_interpolation_points_xyz_perturbations()

void RBEIMEvaluation::add_interpolation_points_xyz_perturbations ( const std::vector< Point > &  perturbs)

Definition at line 717 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::all_xyz_perturb.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

718 {
719  _vec_eval_input.all_xyz_perturb.emplace_back(perturbs);
720 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Point > > all_xyz_perturb

◆ add_node_basis_function()

void RBEIMEvaluation::add_node_basis_function ( const NodeDataMap node_bf)

Add node_bf to our EIM basis.

Definition at line 957 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes().

959 {
960  _local_node_eim_basis_functions.emplace_back(node_bf);
961 }
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.

◆ add_node_interpolation_data()

void RBEIMEvaluation::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.

Definition at line 963 of file rb_eim_evaluation.C.

References _interpolation_points_comp, _vec_eval_input, libMesh::VectorizedEvalInput::all_xyz, libMesh::VectorizedEvalInput::all_xyz_perturb, libMesh::VectorizedEvalInput::boundary_ids, libMesh::VectorizedEvalInput::elem_ids, libMesh::VectorizedEvalInput::elem_types, libMesh::INVALID_ELEM, libMesh::VectorizedEvalInput::JxW_all_qp, libMesh::VectorizedEvalInput::node_ids, libMesh::VectorizedEvalInput::phi_i_all_qp, libMesh::VectorizedEvalInput::phi_i_qp, libMesh::VectorizedEvalInput::qps, libMesh::VectorizedEvalInput::sbd_ids, and libMesh::VectorizedEvalInput::side_indices.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes().

968 {
969  _vec_eval_input.all_xyz.emplace_back(p);
970  _interpolation_points_comp.emplace_back(comp);
971  _vec_eval_input.node_ids.emplace_back(node_id);
972  _vec_eval_input.boundary_ids.emplace_back(boundary_id);
973 
974  // Add dummy values for the other properties, which are unused in the
975  // node case.
976  _vec_eval_input.elem_ids.emplace_back(0);
977  _vec_eval_input.side_indices.emplace_back(0);
978  _vec_eval_input.sbd_ids.emplace_back(0);
979  _vec_eval_input.qps.emplace_back(0);
980  _vec_eval_input.all_xyz_perturb.emplace_back();
981  _vec_eval_input.phi_i_qp.emplace_back();
983  _vec_eval_input.JxW_all_qp.emplace_back();
984  _vec_eval_input.phi_i_all_qp.emplace_back();
985 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< ElemType > elem_types
std::vector< std::vector< Real > > JxW_all_qp
std::vector< unsigned int > qps
std::vector< std::vector< Real > > phi_i_qp
std::vector< dof_id_type > elem_ids
std::vector< subdomain_id_type > sbd_ids
std::vector< unsigned int > side_indices
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.
std::vector< std::vector< std::vector< Real > > > phi_i_all_qp
std::vector< boundary_id_type > boundary_ids
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::vector< std::vector< Point > > all_xyz_perturb
std::vector< dof_id_type > node_ids

◆ add_side_basis_function()

void RBEIMEvaluation::add_side_basis_function ( const SideQpDataMap side_bf)

Add side_bf to our EIM basis.

Definition at line 923 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides().

925 {
926  _local_side_eim_basis_functions.emplace_back(side_bf);
927 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.

◆ add_side_interpolation_data()

void RBEIMEvaluation::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.

Definition at line 929 of file rb_eim_evaluation.C.

References _interpolation_points_comp, _vec_eval_input, libMesh::VectorizedEvalInput::all_xyz, libMesh::VectorizedEvalInput::all_xyz_perturb, libMesh::VectorizedEvalInput::boundary_ids, libMesh::VectorizedEvalInput::elem_ids, libMesh::VectorizedEvalInput::elem_types, libMesh::INVALID_ELEM, libMesh::VectorizedEvalInput::JxW_all_qp, libMesh::VectorizedEvalInput::phi_i_all_qp, libMesh::VectorizedEvalInput::phi_i_qp, libMesh::VectorizedEvalInput::qps, libMesh::VectorizedEvalInput::sbd_ids, and libMesh::VectorizedEvalInput::side_indices.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides().

939 {
940  _vec_eval_input.all_xyz.emplace_back(p);
941  _interpolation_points_comp.emplace_back(comp);
942  _vec_eval_input.elem_ids.emplace_back(elem_id);
943  _vec_eval_input.side_indices.emplace_back(side_index);
944  _vec_eval_input.sbd_ids.emplace_back(subdomain_id);
945  _vec_eval_input.boundary_ids.emplace_back(boundary_id);
946  _vec_eval_input.qps.emplace_back(qp);
947  _vec_eval_input.all_xyz_perturb.emplace_back(perturbs);
948  _vec_eval_input.phi_i_qp.emplace_back(phi_i_qp);
949 
950  // Add dummy values for the other properties, which are unused in the
951  // node case.
953  _vec_eval_input.JxW_all_qp.emplace_back();
954  _vec_eval_input.phi_i_all_qp.emplace_back();
955 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< ElemType > elem_types
std::vector< std::vector< Real > > JxW_all_qp
std::vector< unsigned int > qps
std::vector< std::vector< Real > > phi_i_qp
std::vector< dof_id_type > elem_ids
std::vector< subdomain_id_type > sbd_ids
std::vector< unsigned int > side_indices
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.
std::vector< std::vector< std::vector< Real > > > phi_i_all_qp
std::vector< boundary_id_type > boundary_ids
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::vector< std::vector< Point > > all_xyz_perturb

◆ build_eim_theta()

std::unique_ptr< RBTheta > RBEIMEvaluation::build_eim_theta ( unsigned int  index)
virtual

Build a theta object corresponding to EIM index index.

The default implementation builds an RBEIMTheta object, possibly override in subclasses if we need more specialized behavior.

Definition at line 418 of file rb_eim_evaluation.C.

Referenced by initialize_eim_theta_objects().

419 {
420  return std::make_unique<RBEIMTheta>(*this, index);
421 }

◆ clear()

void RBEIMEvaluation::clear ( )
overridevirtual

Clear this object.

Reimplemented from libMesh::RBParametrized.

Definition at line 60 of file rb_eim_evaluation.C.

References _interpolation_matrix, _interpolation_points_comp, _interpolation_points_spatial_indices, _rb_eim_theta_objects, _vec_eval_input, libMesh::VectorizedEvalInput::clear(), and libMesh::DenseMatrix< T >::resize().

Referenced by distribute_bfs(), node_distribute_bfs(), and side_distribute_bfs().

61 {
63 
66 
67 
69 
70  // Delete any RBTheta objects that were created
71  _rb_eim_theta_objects.clear();
72 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
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 clear()
Clear all the members.
std::vector< unsigned int > _interpolation_points_comp
In the case of a "vector-valued" EIM, this vector determines which component of the parameterized fun...
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Definition: dense_matrix.h:895
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inlineinherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 97 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_tao_equality_constraints(), libMesh::__libmesh_tao_equality_constraints_jacobian(), libMesh::__libmesh_tao_gradient(), libMesh::__libmesh_tao_hessian(), libMesh::__libmesh_tao_inequality_constraints(), libMesh::__libmesh_tao_inequality_constraints_jacobian(), libMesh::__libmesh_tao_objective(), libMesh::MeshRefinement::_coarsen_elements(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< libMesh::Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< Number >::_petsc_shell_matrix_mult_add(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), libMesh::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_variable(), libMesh::System::add_variables(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_data(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::PetscMatrix< libMesh::Number >::create_submatrix_nosort(), libMesh::MeshCommunication::delete_remote_elements(), distribute_bfs(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), get_eim_basis_function_node_value(), get_eim_basis_function_side_value(), get_eim_basis_function_value(), libMesh::MeshBase::get_info(), libMesh::System::get_info(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), get_parametrized_function_node_value(), get_parametrized_function_side_value(), get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_recalculate_monitor(), libMesh::libmesh_petsc_snes_fd_residual(), libMesh::libmesh_petsc_snes_jacobian(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_mffd_residual(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::libmesh_petsc_snes_precheck(), libMesh::libmesh_petsc_snes_residual(), libMesh::libmesh_petsc_snes_residual_helper(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshRefinement::make_flags_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::MeshRefinement::make_refinement_compatible(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::DofMap::n_constrained_dofs(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), node_distribute_bfs(), node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::MeshBase::operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::MeshBase::prepare_for_use(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), read_in_interior_basis_functions(), read_in_node_basis_functions(), read_in_side_basis_functions(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::System::read_legacy_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), side_distribute_bfs(), side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), libMesh::MeshRefinement::test_unflagged(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), ConstraintOperatorTest::testCoreform(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), BoundaryInfoTest::testRenumber(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::VTKIO::write_nodal_data(), write_out_interior_basis_functions(), write_out_node_basis_functions(), write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

98  { return _communicator; }
const Parallel::Communicator & _communicator

◆ decrement_vector()

void RBEIMEvaluation::decrement_vector ( QpDataMap v,
const DenseVector< Number > &  coeffs 
)

Subtract coeffs[i]*basis_function[i] from v.

Definition at line 329 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, get_n_basis_functions(), libMesh::index_range(), and libMesh::DenseVector< T >::size().

Referenced by libMesh::RBEIMConstruction::compute_max_eim_error(), and libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors().

331 {
332  LOG_SCOPE("decrement_vector()", "RBEIMEvaluation");
333 
334  libmesh_error_msg_if(get_n_basis_functions() != coeffs.size(),
335  "Error: Number of coefficients should match number of basis functions");
336 
337  for (auto & [elem_id, v_comp_and_qp] : v)
338  {
339  for (const auto & comp : index_range(v_comp_and_qp))
340  for (unsigned int qp : index_range(v_comp_and_qp[comp]))
341  for (unsigned int i : index_range(_local_eim_basis_functions))
342  {
343  // Check that entry (elem_id,comp,qp) exists in _local_eim_basis_functions so that
344  // we get a clear error message if there is any missing data
345  const auto & basis_comp_and_qp = libmesh_map_find(_local_eim_basis_functions[i], elem_id);
346 
347  libmesh_error_msg_if(comp >= basis_comp_and_qp.size(), "Error: Invalid comp");
348  libmesh_error_msg_if(qp >= basis_comp_and_qp[comp].size(), "Error: Invalid qp");
349 
350  v_comp_and_qp[comp][qp] -= coeffs(i) * basis_comp_and_qp[comp][qp];
351  }
352  }
353 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
virtual unsigned int size() const override final
Definition: dense_vector.h:104
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

101 {
102  _enable_print_counter = false;
103  return;
104 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ distribute_bfs()

void RBEIMEvaluation::distribute_bfs ( const System sys)
private

Helper function that distributes the entries of _local_eim_basis_functions to their respective processors after they are read in on processor 0.

Definition at line 2103 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, TIMPI::Communicator::broadcast(), clear(), libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::System::get_mesh(), libMesh::index_range(), libMesh::make_range(), mesh, n_vars, TIMPI::Communicator::rank(), TIMPI::Communicator::scatter(), and TIMPI::Communicator::size().

Referenced by read_in_interior_basis_functions().

2104 {
2105  // So we can avoid calling these many times below
2106  auto n_procs = sys.comm().size();
2107  auto rank = sys.comm().rank();
2108 
2109  // In serial there's nothing to distribute
2110  if (n_procs == 1)
2111  return;
2112 
2113  // Broadcast the number of basis functions from proc 0. After
2114  // distributing, all procs should have the same number of basis
2115  // functions.
2116  auto n_bf = _local_eim_basis_functions.size();
2117  sys.comm().broadcast(n_bf);
2118 
2119  // Allocate enough space to store n_bf basis functions on non-zero ranks
2120  if (rank != 0)
2121  _local_eim_basis_functions.resize(n_bf);
2122 
2123  // Broadcast the number of variables from proc 0. After
2124  // distributing, all procs should have the same number of variables.
2125  auto n_vars = _local_eim_basis_functions[0].begin()->second.size();
2126  sys.comm().broadcast(n_vars);
2127 
2128  // Construct lists of elem ids owned by different processors
2129  const MeshBase & mesh = sys.get_mesh();
2130 
2131  std::vector<dof_id_type> gathered_local_elem_ids;
2132  gathered_local_elem_ids.reserve(mesh.n_elem());
2133  for (const auto & elem : mesh.active_local_element_ptr_range())
2134  gathered_local_elem_ids.push_back(elem->id());
2135 
2136  // I _think_ the local elem ids are likely to already be sorted in
2137  // ascending order, since that is how they are stored on the Mesh,
2138  // but we can always just guarantee this to be on the safe side as
2139  // well.
2140  std::sort(gathered_local_elem_ids.begin(), gathered_local_elem_ids.end());
2141 
2142  // Gather the number of local elems from all procs to proc 0
2143  auto n_local_elems = gathered_local_elem_ids.size();
2144  std::vector<std::size_t> gathered_n_local_elems = {n_local_elems};
2145  sys.comm().gather(/*root_id=*/0, gathered_n_local_elems);
2146 
2147  // Gather the elem ids owned by each processor onto processor 0.
2148  sys.comm().gather(/*root_id=*/0, gathered_local_elem_ids);
2149 
2150  // Construct vectors of "start" and "one-past-the-end" indices into
2151  // the gathered_local_elem_ids vector for each proc. Only valid on
2152  // processor 0.
2153  std::vector<std::size_t> start_elem_ids_index, end_elem_ids_index;
2154 
2155  if (rank == 0)
2156  {
2157  start_elem_ids_index.resize(n_procs);
2158  start_elem_ids_index[0] = 0;
2159  for (processor_id_type p=1; p<n_procs; ++p)
2160  start_elem_ids_index[p] = start_elem_ids_index[p-1] + gathered_n_local_elems[p-1];
2161 
2162  end_elem_ids_index.resize(n_procs);
2163  end_elem_ids_index[n_procs - 1] = gathered_local_elem_ids.size();
2164  for (processor_id_type p=0; p<n_procs - 1; ++p)
2165  end_elem_ids_index[p] = start_elem_ids_index[p+1];
2166  }
2167 
2168  // On processor 0, using basis function 0 and variable 0, prepare a
2169  // vector with the number of qps per Elem. Then scatter this vector
2170  // out to the processors that require it. The order of this vector
2171  // matches the gathered_local_elem_ids ordering. The counts will be
2172  // gathered_n_local_elems, since there will be one qp count per Elem.
2173  std::vector<unsigned int> n_qp_per_elem_data;
2174 
2175  // On rank 0, the "counts" vector holds the number of floating point values that
2176  // are to be scattered to each proc. It is only required on proc 0.
2177  std::vector<int> counts;
2178 
2179  if (rank == 0)
2180  {
2181  n_qp_per_elem_data.reserve(gathered_local_elem_ids.size());
2182  counts.resize(n_procs);
2183 
2184  auto & bf_map = _local_eim_basis_functions[0];
2185 
2186  for (processor_id_type p=0; p<n_procs; ++p)
2187  {
2188  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2189  {
2190  auto elem_id = gathered_local_elem_ids[e];
2191 
2192  // Get reference to array[n_vars][n_qp] for current Elem.
2193  // Throws an error if the required elem_id is not found.
2194  const auto & array = libmesh_map_find(bf_map, elem_id);
2195 
2196  auto n_qps = array[0].size();
2197 
2198  // We use var==0 to set the number of qps for all vars
2199  n_qp_per_elem_data.push_back(n_qps);
2200 
2201  // Accumulate the count for this proc
2202  counts[p] += n_qps;
2203  } // end for (e)
2204  } // end for proc_id
2205  } // if (rank == 0)
2206 
2207  // Now scatter the n_qp_per_elem_data to all procs (must call the
2208  // scatter on all procs, it is a collective).
2209  {
2210  std::vector<unsigned int> recv;
2211  std::vector<int> tmp(gathered_n_local_elems.begin(), gathered_n_local_elems.end());
2212  sys.comm().scatter(n_qp_per_elem_data, tmp, recv, /*root_id=*/0);
2213 
2214  // Now swap n_qp_per_elem_data and recv. All processors now have a
2215  // vector of length n_local_elems containing the number of
2216  // quadarature points per Elem.
2217  n_qp_per_elem_data.swap(recv);
2218  }
2219 
2220  // For each basis function and each variable, build a vector
2221  // of qp data in the Elem ordering given by the
2222  // gathered_local_elem_ids, then call
2223  //
2224  // sys.comm().scatter(data, counts, recv, /*root_id=*/0);
2225  std::vector<std::vector<Number>> qp_data(n_vars);
2226  if (rank == 0)
2227  {
2228  // The total amount of qp data is given by summing the entries
2229  // of the "counts" vector.
2230  auto n_qp_data =
2231  std::accumulate(counts.begin(), counts.end(), 0u);
2232 
2233  // On processor 0, reserve enough space to hold all the qp
2234  // data for a single basis function for each var.
2235  for (auto var : index_range(qp_data))
2236  qp_data[var].reserve(n_qp_data);
2237  }
2238 
2239  // The recv_qp_data vector will be used on the receiving end of all
2240  // the scatters below.
2241  std::vector<Number> recv_qp_data;
2242 
2243  // Loop from 0..n_bf on _all_ procs, since the scatters inside this
2244  // loop are collective.
2245  for (auto bf : make_range(n_bf))
2246  {
2247  // Prepare data for scattering (only on proc 0)
2248  if (rank == 0)
2249  {
2250  // Reference to the data map for the current basis function.
2251  auto & bf_map = _local_eim_basis_functions[bf];
2252 
2253  // Clear any data from previous bf
2254  for (auto var : index_range(qp_data))
2255  qp_data[var].clear();
2256 
2257  for (processor_id_type p=0; p<n_procs; ++p)
2258  {
2259  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2260  {
2261  auto elem_id = gathered_local_elem_ids[e];
2262 
2263  // Get reference to array[n_vars][n_qp] for current Elem.
2264  // Throws an error if the required elem_id is not found.
2265  const auto & array = libmesh_map_find(bf_map, elem_id);
2266 
2267  for (auto var : index_range(array))
2268  {
2269  // Insert all qp values for this var
2270  qp_data[var].insert(/*insert at*/qp_data[var].end(),
2271  /*data start*/array[var].begin(),
2272  /*data end*/array[var].end());
2273  } // end for (var)
2274  } // end for (e)
2275  } // end for proc_id
2276  } // end if rank==0
2277 
2278  // Perform the scatters (all procs)
2279  for (auto var : make_range(n_vars))
2280  {
2281  // Do the scatter for the current var
2282  sys.comm().scatter(qp_data[var], counts, recv_qp_data, /*root_id=*/0);
2283 
2284  if (rank != 0)
2285  {
2286  // Store the scattered data we received in _local_eim_basis_functions[bf]
2287  auto & bf_map = _local_eim_basis_functions[bf];
2288  auto cursor = recv_qp_data.begin();
2289 
2290  for (auto i : index_range(gathered_local_elem_ids))
2291  {
2292  auto elem_id = gathered_local_elem_ids[i];
2293  auto n_qp_this_elem = n_qp_per_elem_data[i];
2294  auto & array = bf_map[elem_id];
2295 
2296  // Create space to store the data if it doesn't already exist.
2297  if (array.empty())
2298  array.resize(n_vars);
2299 
2300  array[var].assign(cursor, cursor + n_qp_this_elem);
2301  std::advance(cursor, n_qp_this_elem);
2302  }
2303  } // if (rank != 0)
2304  } // end for (var)
2305  } // end for (bf)
2306 
2307  // Now that the scattering is done, delete non-local Elem
2308  // information from processor 0's _local_eim_basis_functions data
2309  // structure.
2310  if (rank == 0)
2311  {
2312  for (processor_id_type p=1; p<n_procs; ++p)
2313  {
2314  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2315  {
2316  auto elem_id = gathered_local_elem_ids[e];
2317 
2318  // Delete this Elem's information from every basis function.
2319  for (auto & bf_map : _local_eim_basis_functions)
2320  bf_map.erase(elem_id);
2321  } // end for (e)
2322  } // end for proc_id
2323  } // if (rank == 0)
2324 }
virtual void clear() override
Clear this object.
MeshBase & mesh
uint8_t processor_id_type
unsigned int n_vars
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

Methods to enable/disable the reference counter output from print_info()

Definition at line 94 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

95 {
96  _enable_print_counter = true;
97  return;
98 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ gather_bfs()

void RBEIMEvaluation::gather_bfs ( )
private

Helper function that gathers the contents of _local_eim_basis_functions to processor 0 in preparation for printing to file.

Definition at line 1684 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::index_range(), TIMPI::Communicator::max(), libMesh::ParallelObject::n_processors(), n_vars, libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::verify().

Referenced by write_out_interior_basis_functions().

1685 {
1686  // We need to gather _local_eim_basis_functions data from other
1687  // procs for printing.
1688  //
1689  // Ideally, this could be accomplished by simply calling:
1690  // this->comm().gather(/*root_id=*/0, _local_eim_basis_functions);
1691  //
1692  // but the data structure seems to be too complicated for this to
1693  // work automatically. (I get some error about the function called
1694  // being "private within this context".) Therefore, we have to
1695  // gather the information manually.
1696 
1697  // So we can avoid calling this many times below
1698  auto n_procs = this->n_processors();
1699 
1700  // In serial there's nothing to gather
1701  if (n_procs == 1)
1702  return;
1703 
1704  // Current assumption is that the number of basis functions stored on
1705  // each processor is the same, the only thing that differs is the number
1706  // of elements, so make sure that is the case now.
1707  auto n_bf = _local_eim_basis_functions.size();
1708  this->comm().verify(n_bf);
1709 
1710  // This function should never be called if there are no basis
1711  // functions, so if it was, something went wrong.
1712  libmesh_error_msg_if(!n_bf, "RBEIMEvaluation::gather_bfs() should not be called with 0 basis functions.");
1713 
1714  // The number of variables should be the same on all processors
1715  // and we can get this from _local_eim_basis_functions. However,
1716  // it may be that some processors have no local elements, so on
1717  // those processors we cannot look up the size from
1718  // _local_eim_basis_functions. As a result we use comm().max(n_vars)
1719  // to make sure all processors agree on the final value.
1720  std::size_t n_vars =
1721  _local_eim_basis_functions[0].empty() ? 0 : _local_eim_basis_functions[0].begin()->second.size();
1722  this->comm().max(n_vars);
1723 
1724  // Gather list of Elem ids stored on each processor to proc 0. We
1725  // use basis function 0 as an example and assume all the basis
1726  // functions are distributed similarly.
1727  std::vector<dof_id_type> elem_ids;
1728  elem_ids.reserve(_local_eim_basis_functions[0].size());
1729  for (const auto & pr : _local_eim_basis_functions[0])
1730  elem_ids.push_back(pr.first);
1731  this->comm().gather(/*root_id=*/0, elem_ids);
1732 
1733  // Store the number of qps per Elem on this processor. Again, use
1734  // basis function 0 (and variable 0) to get this information, then
1735  // apply it to all basis functions.
1736  std::vector<unsigned int> n_qp_per_elem;
1737  n_qp_per_elem.reserve(_local_eim_basis_functions[0].size());
1738  for (const auto & pr : _local_eim_basis_functions[0])
1739  {
1740  // array[n_vars][n_qp] per Elem. We get the number of QPs
1741  // for variable 0, assuming they are all the same.
1742  const auto & array = pr.second;
1743  n_qp_per_elem.push_back(array[0].size());
1744  }
1745 
1746  // Before gathering, compute the total amount of local qp data for
1747  // each var, which is the sum of the entries in the "n_qp_per_elem" array.
1748  // This will be used to reserve space in a vector below.
1749  auto n_local_qp_data =
1750  std::accumulate(n_qp_per_elem.begin(),
1751  n_qp_per_elem.end(),
1752  0u);
1753 
1754  // Gather the number of qps per Elem for each processor onto processor 0.
1755  this->comm().gather(/*root_id=*/0, n_qp_per_elem);
1756 
1757  // Sanity check: On processor 0, this checks that we have gathered the same number
1758  // of elem ids and qp counts.
1759  libmesh_error_msg_if(elem_ids.size() != n_qp_per_elem.size(),
1760  "Must gather same number of Elem ids as qps per Elem.");
1761 
1762  // Reserve space to store contiguous vectors of qp data for each var
1763  std::vector<std::vector<Number>> gathered_qp_data(n_vars);
1764  for (auto var : index_range(gathered_qp_data))
1765  gathered_qp_data[var].reserve(n_local_qp_data);
1766 
1767  // Now we construct a vector for each basis function, for each
1768  // variable, which is ordered according to:
1769  // [ [qp vals for Elem 0], [qp vals for Elem 1], ... [qp vals for Elem N] ]
1770  // and gather it to processor 0.
1771  for (auto bf : index_range(_local_eim_basis_functions))
1772  {
1773  // Clear any data from previous bf
1774  for (auto var : index_range(gathered_qp_data))
1775  gathered_qp_data[var].clear();
1776 
1777  for (const auto & pr : _local_eim_basis_functions[bf])
1778  {
1779  // array[n_vars][n_qp] per Elem
1780  const auto & array = pr.second;
1781  for (auto var : index_range(array))
1782  {
1783  // Insert all qp values for this var
1784  gathered_qp_data[var].insert(/*insert at*/gathered_qp_data[var].end(),
1785  /*data start*/array[var].begin(),
1786  /*data end*/array[var].end());
1787  }
1788  }
1789 
1790  // Reference to the data map for the current basis function.
1791  auto & bf_map = _local_eim_basis_functions[bf];
1792 
1793  for (auto var : index_range(gathered_qp_data))
1794  {
1795  // For each var, gather gathered_qp_data[var] onto processor
1796  // 0. There apparently is not a gather overload for
1797  // vector-of-vectors...
1798  this->comm().gather(/*root_id=*/0, gathered_qp_data[var]);
1799 
1800  // On processor 0, iterate over the gathered_qp_data[var]
1801  // vector we just gathered, filling in the "small" vectors
1802  // for each Elem. Note: here we ignore the fact that we
1803  // already have the data on processor 0 and just overwrite
1804  // it, this makes the indexing logic a bit simpler.
1805  if (this->processor_id() == 0)
1806  {
1807  auto cursor = gathered_qp_data[var].begin();
1808  for (auto i : index_range(elem_ids))
1809  {
1810  auto elem_id = elem_ids[i];
1811  auto n_qp_this_elem = n_qp_per_elem[i];
1812 
1813  // Get reference to the [n_vars][n_qp] array for
1814  // this Elem. We assign() into the vector of
1815  // quadrature point values, which allocates space if
1816  // it doesn't already exist.
1817  auto & array = bf_map[elem_id];
1818 
1819  // Possibly allocate space if this is data for a new
1820  // element we haven't seen before.
1821  if (array.empty())
1822  array.resize(n_vars);
1823 
1824  array[var].assign(cursor, cursor + n_qp_this_elem);
1825  std::advance(cursor, n_qp_this_elem);
1826  }
1827  }
1828  }
1829  } // end loop over basis functions
1830 }
bool verify(const T &r) const
void gather(const unsigned int root_id, const T &send_data, std::vector< T, A > &recv) const
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
unsigned int n_vars
void max(const T &r, T &o, Request &req) const
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ get_basis_function()

const RBEIMEvaluation::QpDataMap & RBEIMEvaluation::get_basis_function ( unsigned int  i) const

Get a reference to the i^th basis function.

Definition at line 639 of file rb_eim_evaluation.C.

References _local_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::update_eim_matrices(), and write_out_projected_basis_functions().

640 {
641  return _local_eim_basis_functions[i];
642 }
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.

◆ get_closest_value()

Real libMesh::RBParametrized::get_closest_value ( Real  value,
const std::vector< Real > &  list_of_values 
)
staticinherited
Returns
The closest entry to value from list_of_values.

Definition at line 443 of file rb_parametrized.C.

References std::abs(), distance(), libMesh::Real, and value.

Referenced by libMesh::RBParametrized::is_value_in_list().

444 {
445  libmesh_error_msg_if(list_of_values.empty(), "Error: list_of_values is empty.");
446 
447  Real min_distance = std::numeric_limits<Real>::max();
448  Real closest_val = 0.;
449  for (const auto & current_value : list_of_values)
450  {
451  Real distance = std::abs(value - current_value);
452  if (distance < min_distance)
453  {
454  min_distance = distance;
455  closest_val = current_value;
456  }
457  }
458 
459  return closest_val;
460 }
Real distance(const Point &p)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:57
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition: xdr_io.C:54

◆ get_discrete_parameter_values()

const std::map< std::string, std::vector< Real > > & libMesh::RBParametrized::get_discrete_parameter_values ( ) const
inherited

Get a const reference to the discrete parameter values.

Definition at line 370 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::check_if_valid_params(), libMesh::RBParametrized::get_n_discrete_params(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBParametrized::print_discrete_parameter_values(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

371 {
372  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
373 
375 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.

◆ get_eim_basis_function_node_local_value()

Number RBEIMEvaluation::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.

Note that this does not do any parallel communication, it just looks up the value from _local_node_eim_basis_functions.

Definition at line 577 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, and get_parametrized_function_node_local_value().

Referenced by libMesh::RBEIMAssembly::evaluate_node_basis_function().

580 {
581  libmesh_error_msg_if(basis_function_index >= _local_node_eim_basis_functions.size(),
582  "Invalid basis function index: " << basis_function_index);
583 
585  _local_node_eim_basis_functions[basis_function_index],
586  node_id,
587  comp);
588 }
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.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.

◆ get_eim_basis_function_node_value()

Number RBEIMEvaluation::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.

Note that unlike get_eim_basis_function_node_local_value(), this does do parallel communication so that it can be called on any processor regardless of whether node_id is local or not.

Definition at line 590 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, libMesh::ParallelObject::comm(), and get_parametrized_function_node_value().

Referenced by libMesh::RBEIMConstruction::update_eim_matrices().

593 {
594  libmesh_error_msg_if(basis_function_index >= _local_node_eim_basis_functions.size(),
595  "Invalid basis function index: " << basis_function_index);
596 
598  comm(),
599  _local_node_eim_basis_functions[basis_function_index],
600  node_id,
601  comp);
602 }
const Parallel::Communicator & comm() const
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
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.

◆ get_eim_basis_function_side_value()

Number RBEIMEvaluation::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.

Definition at line 620 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, libMesh::ParallelObject::comm(), and get_parametrized_function_side_value().

Referenced by libMesh::RBEIMConstruction::update_eim_matrices().

625 {
626  libmesh_error_msg_if(basis_function_index >= _local_side_eim_basis_functions.size(),
627  "Invalid side basis function index: " << basis_function_index);
628 
630  comm(),
631  _local_side_eim_basis_functions[basis_function_index],
632  elem_id,
633  side_index,
634  comp,
635  qp);
636 }
const Parallel::Communicator & comm() const
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
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.

◆ get_eim_basis_function_side_values_at_qps()

void RBEIMEvaluation::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.

Definition at line 560 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, and get_parametrized_function_side_values_at_qps().

Referenced by libMesh::RBEIMAssembly::evaluate_side_basis_function().

565 {
566  libmesh_error_msg_if(basis_function_index >= _local_side_eim_basis_functions.size(),
567  "Invalid basis function index: " << basis_function_index);
568 
570  _local_side_eim_basis_functions[basis_function_index],
571  elem_id,
572  side_index,
573  comp,
574  values);
575 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
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.

◆ get_eim_basis_function_value()

Number RBEIMEvaluation::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.

Definition at line 604 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, libMesh::ParallelObject::comm(), and get_parametrized_function_value().

Referenced by libMesh::RBEIMConstruction::update_eim_matrices().

608 {
609  libmesh_error_msg_if(basis_function_index >= _local_eim_basis_functions.size(),
610  "Invalid basis function index: " << basis_function_index);
611 
613  comm(),
614  _local_eim_basis_functions[basis_function_index],
615  elem_id,
616  comp,
617  qp);
618 }
const Parallel::Communicator & comm() const
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.
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.

◆ get_eim_basis_function_values_at_qps()

void RBEIMEvaluation::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 var, at all quadrature points on element elem_id.

Each processor stores data for only the elements local to that processor, so if elem_id is not on this processor then values will be empty.

Definition at line 545 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, and get_parametrized_function_values_at_qps().

Referenced by libMesh::RBEIMAssembly::evaluate_basis_function().

549 {
550  libmesh_error_msg_if(basis_function_index >= _local_eim_basis_functions.size(),
551  "Invalid basis function index: " << basis_function_index);
552 
554  _local_eim_basis_functions[basis_function_index],
555  elem_id,
556  comp,
557  values);
558 }
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...
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.

◆ get_eim_error_indicator()

std::pair< Real, Real > RBEIMEvaluation::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_interpolation_row.

We also pass in eim_rhs since this is used to normalize the error indicator.

We return a pair that specifies the relative error indicator, and the normalization that was used to compute the relative error indicator. We can then recover the absolute error indicator via rel. indicator x normalization.

Definition at line 2988 of file rb_eim_evaluation.C.

References _error_indicator_interpolation_row, std::abs(), libMesh::DenseVector< T >::dot(), eim_error_indicator_normalization, libMesh::DenseVector< T >::get_principal_subvector(), libMesh::DenseVector< T >::linfty_norm(), MAX_RHS, std::real(), libMesh::Real, RESIDUAL_TERMS, and libMesh::DenseVector< T >::size().

Referenced by rb_eim_solves().

2992 {
2993  DenseVector<Number> coeffs;
2995 
2996  Number EIM_val_at_error_indicator_pt = coeffs.dot(eim_solution);
2997  Real error_indicator_val =
2998  std::real(error_indicator_rhs - EIM_val_at_error_indicator_pt);
2999 
3000  Real normalization = 0.;
3002  {
3003  // This normalization is based on the terms from the "EIM residual" calculation
3004  // used in the calculation of error_indicator_val.
3005  normalization =
3006  std::abs(error_indicator_rhs) + std::abs(EIM_val_at_error_indicator_pt);
3007  }
3009  {
3010  // Normalize the error indicator based on the max-norm of the EIM RHS vector.
3011  // This approach handles the case where different EIM variables have different
3012  // magnitudes well, i.e. if error_indicator_val is based on a
3013  // "small magnitude" variable, then by normalizing based on the entire
3014  // RHS vector (which will typically include values from multiple different
3015  // EIM variables) we will effectively scale down the error indicator
3016  // corresponding to small variables, which is typically what we want.
3017  normalization = std::max(eim_rhs.linfty_norm(), std::abs(error_indicator_rhs));
3018  }
3019  else
3020  {
3021  libmesh_error_msg("unsupported eim_error_indicator_normalization");
3022  }
3023 
3024  // We avoid NaNs by setting normalization to 1 in the case that it is exactly 0.
3025  if (normalization == 0.)
3026  normalization = 1.;
3027 
3028  // Return the relative error indicator, and the normalization that we used. By returning
3029  // the normalization, we can subsequently recover the absolute error indicator if
3030  // desired.
3031  return std::make_pair(std::abs(error_indicator_val) / normalization, normalization);
3032 }
boost::multiprecision::float128 real(const boost::multiprecision::float128 in)
void get_principal_subvector(unsigned int sub_n, DenseVector< T > &dest) const
Puts the principal subvector of size sub_n (i.e.
Definition: dense_vector.h:691
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
Definition: type_vector.h:57
Real linfty_norm() const
Definition: dense_vector.h:667
EimErrorIndicatorNormalization eim_error_indicator_normalization
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual unsigned int size() const override final
Definition: dense_vector.h:104
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...

◆ get_eim_solutions_for_training_set() [1/2]

const std::vector< DenseVector< Number > > & RBEIMEvaluation::get_eim_solutions_for_training_set ( ) const

Return a const reference to the EIM solutions for the parameters in the training set.

Definition at line 682 of file rb_eim_evaluation.C.

References _eim_solutions_for_training_set.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), and libMesh::RBEIMConstruction::store_eim_solutions_for_training_set().

683 {
685 }
std::vector< DenseVector< Number > > _eim_solutions_for_training_set
Storage for EIM solutions from the training set.

◆ get_eim_solutions_for_training_set() [2/2]

std::vector< DenseVector< Number > > & RBEIMEvaluation::get_eim_solutions_for_training_set ( )

Return a writeable reference to the EIM solutions for the parameters in the training set.

Definition at line 687 of file rb_eim_evaluation.C.

References _eim_solutions_for_training_set.

688 {
690 }
std::vector< DenseVector< Number > > _eim_solutions_for_training_set
Storage for EIM solutions from the training set.

◆ get_eim_theta_objects()

std::vector< std::unique_ptr< RBTheta > > & RBEIMEvaluation::get_eim_theta_objects ( )
Returns
The vector of theta objects that point to this RBEIMEvaluation.

Definition at line 413 of file rb_eim_evaluation.C.

References _rb_eim_theta_objects.

414 {
415  return _rb_eim_theta_objects;
416 }
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.

◆ get_eim_vars_to_project_and_write()

const std::vector< EIMVarGroupPlottingInfo > & RBEIMEvaluation::get_eim_vars_to_project_and_write ( ) const

Get _eim_vars_to_project_and_write.

Definition at line 2921 of file rb_eim_evaluation.C.

References _eim_vars_to_project_and_write.

Referenced by write_out_projected_basis_functions().

2922 {
2924 }
std::vector< EIMVarGroupPlottingInfo > _eim_vars_to_project_and_write
This vector specifies which EIM variables will be projected and written out in write_out_projected_ba...

◆ get_error_indicator_interpolation_row()

const DenseVector< Number > & RBEIMEvaluation::get_error_indicator_interpolation_row ( ) const

Get/set _extra_points_interpolation_matrix.

Definition at line 3039 of file rb_eim_evaluation.C.

References _error_indicator_interpolation_row.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

3040 {
3042 }
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...

◆ get_info()

std::string libMesh::ReferenceCounter::get_info ( )
staticinherited

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

Referenced by libMesh::ReferenceCounter::print_info().

48 {
49 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
50 
51  std::ostringstream oss;
52 
53  oss << '\n'
54  << " ---------------------------------------------------------------------------- \n"
55  << "| Reference count information |\n"
56  << " ---------------------------------------------------------------------------- \n";
57 
58  for (const auto & [name, cd] : _counts)
59  oss << "| " << name << " reference count information:\n"
60  << "| Creations: " << cd.first << '\n'
61  << "| Destructions: " << cd.second << '\n';
62 
63  oss << " ---------------------------------------------------------------------------- \n";
64 
65  return oss.str();
66 
67 #else
68 
69  return "";
70 
71 #endif
72 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
static Counts _counts
Actually holds the data.

◆ get_interpolation_matrix()

const DenseMatrix< Number > & RBEIMEvaluation::get_interpolation_matrix ( ) const

Get the EIM interpolation matrix.

Definition at line 878 of file rb_eim_evaluation.C.

References _interpolation_matrix.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

879 {
880  return _interpolation_matrix;
881 }
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ get_interpolation_points_boundary_id()

boundary_id_type RBEIMEvaluation::get_interpolation_points_boundary_id ( unsigned int  index) const

Definition at line 788 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::boundary_ids.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

789 {
790  libmesh_error_msg_if(index >= _vec_eval_input.boundary_ids.size(), "Error: Invalid index");
791 
792  return _vec_eval_input.boundary_ids[index];
793 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< boundary_id_type > boundary_ids

◆ get_interpolation_points_comp()

unsigned int RBEIMEvaluation::get_interpolation_points_comp ( unsigned int  index) const

◆ get_interpolation_points_elem_id()

dof_id_type RBEIMEvaluation::get_interpolation_points_elem_id ( unsigned int  index) const

◆ get_interpolation_points_elem_type()

ElemType RBEIMEvaluation::get_interpolation_points_elem_type ( unsigned int  index) const

Definition at line 830 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::elem_types.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

831 {
832  libmesh_error_msg_if(index >= _vec_eval_input.elem_types.size(), "Error: Invalid index");
833 
834  return _vec_eval_input.elem_types[index];
835 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< ElemType > elem_types

◆ get_interpolation_points_JxW_all_qp()

const std::vector< Real > & RBEIMEvaluation::get_interpolation_points_JxW_all_qp ( unsigned int  index) const

Definition at line 837 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::JxW_all_qp.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

838 {
839  libmesh_error_msg_if(index >= _vec_eval_input.JxW_all_qp.size(), "Error: Invalid index");
840 
841  return _vec_eval_input.JxW_all_qp[index];
842 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Real > > JxW_all_qp

◆ get_interpolation_points_node_id()

dof_id_type RBEIMEvaluation::get_interpolation_points_node_id ( unsigned int  index) const

Definition at line 816 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::node_ids.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), and libMesh::RBEIMConstruction::update_eim_matrices().

817 {
818  libmesh_error_msg_if(index >= _vec_eval_input.node_ids.size(), "Error: Invalid index");
819 
820  return _vec_eval_input.node_ids[index];
821 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< dof_id_type > node_ids

◆ get_interpolation_points_phi_i_all_qp()

const std::vector< std::vector< Real > > & RBEIMEvaluation::get_interpolation_points_phi_i_all_qp ( unsigned int  index) const

Definition at line 844 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::phi_i_all_qp.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

845 {
846  libmesh_error_msg_if(index >= _vec_eval_input.phi_i_all_qp.size(), "Error: Invalid index");
847 
848  return _vec_eval_input.phi_i_all_qp[index];
849 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< std::vector< Real > > > phi_i_all_qp

◆ get_interpolation_points_phi_i_qp()

const std::vector< Real > & RBEIMEvaluation::get_interpolation_points_phi_i_qp ( unsigned int  index) const

Definition at line 851 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::phi_i_qp.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

852 {
853  libmesh_error_msg_if(index >= _vec_eval_input.phi_i_qp.size(), "Error: Invalid index");
854 
855  return _vec_eval_input.phi_i_qp[index];
856 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Real > > phi_i_qp

◆ get_interpolation_points_qp()

unsigned int RBEIMEvaluation::get_interpolation_points_qp ( unsigned int  index) const

◆ get_interpolation_points_side_index()

unsigned int RBEIMEvaluation::get_interpolation_points_side_index ( unsigned int  index) const

Definition at line 809 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::side_indices.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), and libMesh::RBEIMConstruction::update_eim_matrices().

810 {
811  libmesh_error_msg_if(index >= _vec_eval_input.side_indices.size(), "Error: Invalid index");
812 
813  return _vec_eval_input.side_indices[index];
814 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< unsigned int > side_indices

◆ get_interpolation_points_spatial_indices()

const std::vector< unsigned int > & RBEIMEvaluation::get_interpolation_points_spatial_indices ( unsigned int  index) const

Definition at line 858 of file rb_eim_evaluation.C.

References _interpolation_points_spatial_indices.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

859 {
860  libmesh_error_msg_if(index >= _interpolation_points_spatial_indices.size(), "Error: Invalid index");
861 
863 }
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()...

◆ get_interpolation_points_subdomain_id()

subdomain_id_type RBEIMEvaluation::get_interpolation_points_subdomain_id ( unsigned int  index) const

Definition at line 781 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::sbd_ids.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

782 {
783  libmesh_error_msg_if(index >= _vec_eval_input.sbd_ids.size(), "Error: Invalid index");
784 
785  return _vec_eval_input.sbd_ids[index];
786 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< subdomain_id_type > sbd_ids

◆ get_interpolation_points_xyz()

Point RBEIMEvaluation::get_interpolation_points_xyz ( unsigned int  index) const

Get the data associated with EIM interpolation points.

Definition at line 767 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::all_xyz.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

768 {
769  libmesh_error_msg_if(index >= _vec_eval_input.all_xyz.size(), "Error: Invalid index");
770 
771  return _vec_eval_input.all_xyz[index];
772 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.

◆ get_interpolation_points_xyz_perturbations()

const std::vector< Point > & RBEIMEvaluation::get_interpolation_points_xyz_perturbations ( unsigned int  index) const

Definition at line 795 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::all_xyz_perturb.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

796 {
797  libmesh_error_msg_if(index >= _vec_eval_input.all_xyz_perturb.size(), "Error: Invalid index");
798 
799  return _vec_eval_input.all_xyz_perturb[index];
800 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< std::vector< Point > > all_xyz_perturb

◆ get_n_basis_functions()

unsigned int RBEIMEvaluation::get_n_basis_functions ( ) const

Return the current number of EIM basis functions.

Definition at line 304 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, _local_node_eim_basis_functions, _local_side_eim_basis_functions, and get_parametrized_function().

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBEIMConstruction::compute_max_eim_error(), decrement_vector(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBEIMTheta::evaluate_vec(), initialize_eim_theta_objects(), node_decrement_vector(), rb_eim_solve(), rb_eim_solves(), read_in_basis_functions(), set_eim_error_indicator_active(), side_decrement_vector(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBEIMConstruction::update_eim_matrices(), and write_out_projected_basis_functions().

305 {
306  if (get_parametrized_function().on_mesh_sides())
307  return _local_side_eim_basis_functions.size();
308  else if (get_parametrized_function().on_mesh_nodes())
309  return _local_node_eim_basis_functions.size();
310  else
311  return _local_eim_basis_functions.size();
312 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.

◆ get_n_continuous_params()

unsigned int libMesh::RBParametrized::get_n_continuous_params ( ) const
inherited

Get the number of continuous parameters.

Definition at line 112 of file rb_parametrized.C.

References libMesh::RBParametrized::get_n_discrete_params(), libMesh::RBParametrized::get_n_params(), libMesh::libmesh_assert(), and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

113 {
114  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_continuous_params");
115 
117 
118  return static_cast<unsigned int>(get_n_params() - get_n_discrete_params());
119 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int get_n_discrete_params() const
Get the number of discrete parameters.
libmesh_assert(ctx)
unsigned int get_n_params() const
Get the number of parameters.

◆ get_n_discrete_params()

unsigned int libMesh::RBParametrized::get_n_discrete_params ( ) const
inherited

Get the number of discrete parameters.

Definition at line 121 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::get_n_continuous_params(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

122 {
123  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_discrete_params");
124 
125  return cast_int<unsigned int>
127 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.

◆ get_n_interpolation_points()

unsigned int RBEIMEvaluation::get_n_interpolation_points ( ) const

Return the number of interpolation points.

If we're not using the EIM error indicator, then this matches get_n_basis_functions(), but if we are using the EIM error indicator then we should have one extra interpolation point.

Definition at line 314 of file rb_eim_evaluation.C.

References _vec_eval_input, and libMesh::VectorizedEvalInput::all_xyz.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), and set_eim_error_indicator_active().

315 {
316  return _vec_eval_input.all_xyz.size();
317 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.

◆ get_n_interpolation_points_spatial_indices()

unsigned int RBEIMEvaluation::get_n_interpolation_points_spatial_indices ( ) const

_interpolation_points_spatial_indices is optional data, so we need to be able to check how many _interpolation_points_spatial_indices values have actually been set since it may not match the number of interpolation points.

Definition at line 865 of file rb_eim_evaluation.C.

References _interpolation_points_spatial_indices.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

866 {
868 }
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()...

◆ get_n_params()

unsigned int libMesh::RBParametrized::get_n_params ( ) const
inherited

Get the number of parameters.

Definition at line 103 of file rb_parametrized.C.

References libMesh::RBParameters::n_parameters(), libMesh::RBParametrized::parameters_initialized, libMesh::RBParametrized::parameters_max, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBParametrized::check_if_valid_params(), libMesh::RBEIMConstruction::compute_max_eim_error(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), set_eim_error_indicator_active(), and libMesh::RBConstruction::train_reduced_basis_with_POD().

104 {
105  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_params");
106 
107  libmesh_assert_equal_to ( parameters_min.n_parameters(), parameters_max.n_parameters() );
108 
109  return parameters_min.n_parameters();
110 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
unsigned int n_parameters() const
Get the number of parameters that have been added.

◆ get_node_basis_function()

const RBEIMEvaluation::NodeDataMap & RBEIMEvaluation::get_node_basis_function ( unsigned int  i) const

Get a reference to the i^th node basis function.

Definition at line 651 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::update_eim_matrices().

652 {
654 }
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.

◆ get_parameter_max()

Real libMesh::RBParametrized::get_parameter_max ( const std::string &  param_name) const
inherited

Get maximum allowable value of parameter param_name.

Definition at line 183 of file rb_parametrized.C.

References libMesh::RBParameters::get_value(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_max.

Referenced by libMesh::RBParametrized::check_if_valid_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().

184 {
185  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_max");
186 
187  return parameters_max.get_value(param_name);
188 }
Real get_value(const std::string &param_name) const
Get the value of the specified parameter, throw an error if it does not exist.
Definition: rb_parameters.C:65
bool parameters_initialized
Flag indicating whether the parameters have been initialized.

◆ get_parameter_min()

Real libMesh::RBParametrized::get_parameter_min ( const std::string &  param_name) const
inherited

Get minimum allowable value of parameter param_name.

Definition at line 176 of file rb_parametrized.C.

References libMesh::RBParameters::get_value(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBParametrized::check_if_valid_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().

177 {
178  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_min");
179 
180  return parameters_min.get_value(param_name);
181 }
Real get_value(const std::string &param_name) const
Get the value of the specified parameter, throw an error if it does not exist.
Definition: rb_parameters.C:65
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.

◆ get_parameter_names()

std::set< std::string > libMesh::RBParametrized::get_parameter_names ( ) const
inherited

Get a set that stores the parameter names.

Definition at line 129 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

130 {
131  libmesh_deprecated();
132  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_names");
133 
134  std::set<std::string> parameter_names;
135  for (const auto & pr : parameters_min)
136  parameter_names.insert(pr.first);
137 
138  return parameter_names;
139 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.

◆ get_parameters()

const RBParameters & libMesh::RBParametrized::get_parameters ( ) const
inherited

Get the current parameters.

Definition at line 155 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::TransientRBEvaluation::cache_online_residual_terms(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBEvaluation::eval_output_dual_norm(), libMesh::RBSCMConstruction::evaluate_stability_constant(), libMesh::RBConstruction::get_RB_error_bound(), libMesh::RBSCMEvaluation::get_SCM_LB(), libMesh::RBSCMEvaluation::get_SCM_UB(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBConstruction::greedy_termination_test(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBConstruction::preevaluate_thetas(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().

156 {
157  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters");
158 
159  return parameters;
160 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters
Vector storing the current parameters.

◆ get_parameters_max()

const RBParameters & libMesh::RBParametrized::get_parameters_max ( ) const
inherited

Get an RBParameters object that specifies the maximum allowable value for each parameter.

Definition at line 169 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_max.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

170 {
171  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters_max");
172 
173  return parameters_max;
174 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.

◆ get_parameters_min()

const RBParameters & libMesh::RBParametrized::get_parameters_min ( ) const
inherited

Get an RBParameters object that specifies the minimum allowable value for each parameter.

Definition at line 162 of file rb_parametrized.C.

References libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::parameters_min.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

163 {
164  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters_min");
165 
166  return parameters_min;
167 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.

◆ get_parametrized_function() [1/2]

RBParametrizedFunction & RBEIMEvaluation::get_parametrized_function ( )

Get a reference to the parametrized function.

Definition at line 91 of file rb_eim_evaluation.C.

References _parametrized_function.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBEIMConstruction::enrich_eim_approximation(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), get_n_basis_functions(), libMesh::RBEIMConstruction::get_random_point_from_training_sample(), initialize_interpolation_points_spatial_indices(), initialize_param_fn_spatial_indices(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::initialize_qp_data(), libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), node_distribute_bfs(), rb_eim_solves(), read_in_basis_functions(), set_n_basis_functions(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), side_distribute_bfs(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBEIMConstruction::update_eim_matrices(), and write_out_basis_functions().

92 {
93  libmesh_error_msg_if(!_parametrized_function, "Parametrized function not initialized yet");
94 
95  return *_parametrized_function;
96 }
std::unique_ptr< RBParametrizedFunction > _parametrized_function
Store the parametrized function that will be approximated by this EIM system.

◆ get_parametrized_function() [2/2]

const RBParametrizedFunction & RBEIMEvaluation::get_parametrized_function ( ) const

Get a const reference to the parametrized function.

Definition at line 98 of file rb_eim_evaluation.C.

References _parametrized_function.

99 {
100  libmesh_error_msg_if(!_parametrized_function, "Parametrized function not initialized yet");
101 
102  return *_parametrized_function;
103 }
std::unique_ptr< RBParametrizedFunction > _parametrized_function
Store the parametrized function that will be approximated by this EIM system.

◆ get_parametrized_function_node_local_value()

Number RBEIMEvaluation::get_parametrized_function_node_local_value ( const NodeDataMap pf,
dof_id_type  node_id,
unsigned int  comp 
)
static

Same as get_parametrized_function_values_at_qps() except for node data.

Note that this does not do any parallel communication, so it is only applicable to looking up local values.

Definition at line 466 of file rb_eim_evaluation.C.

Referenced by get_eim_basis_function_node_local_value(), and get_parametrized_function_node_value().

470 {
471  LOG_SCOPE("get_parametrized_function_node_local_value()", "RBEIMConstruction");
472 
473  auto it = pf.find(node_id);
474  if (it != pf.end())
475  {
476  const std::vector<Number> & vec = it->second;
477  libmesh_error_msg_if (comp >= vec.size(), "Error: Invalid comp index");
478  return vec[comp];
479  }
480  else
481  return 0.;
482 }

◆ get_parametrized_function_node_value()

Number RBEIMEvaluation::get_parametrized_function_node_value ( const Parallel::Communicator comm,
const NodeDataMap pf,
dof_id_type  node_id,
unsigned int  comp 
)
static

Same as get_parametrized_function_value() except for node data.

Unlike get_parametrized_function_node_local_value(), this does parallel communication, and therefore if can be used to look up values regardless of whether or not node_id is local.

Definition at line 531 of file rb_eim_evaluation.C.

References libMesh::ParallelObject::comm(), get_parametrized_function_node_local_value(), TIMPI::Communicator::sum(), and value.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), get_eim_basis_function_node_value(), and libMesh::RBEIMConstruction::store_eim_solutions_for_training_set().

536 {
537  LOG_SCOPE("get_parametrized_function_node_value()", "RBEIMConstruction");
538 
540  comm.sum(value);
541 
542  return value;
543 }
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.
void sum(T &r) const
const Parallel::Communicator & comm() const
static const bool value
Definition: xdr_io.C:54

◆ get_parametrized_function_side_value()

Number RBEIMEvaluation::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 
)
static

Same as get_parametrized_function_value() except for side data.

Definition at line 507 of file rb_eim_evaluation.C.

References libMesh::ParallelObject::comm(), get_parametrized_function_side_values_at_qps(), TIMPI::Communicator::sum(), and value.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), get_eim_basis_function_side_value(), and libMesh::RBEIMConstruction::store_eim_solutions_for_training_set().

514 {
515  std::vector<Number> values;
516  get_parametrized_function_side_values_at_qps(pf, elem_id, side_index, comp, values);
517 
518  // In parallel, values should only be non-empty on one processor
519  Number value = 0.;
520  if (!values.empty())
521  {
522  libmesh_error_msg_if(qp >= values.size(), "Error: Invalid qp index");
523 
524  value = values[qp];
525  }
526  comm.sum(value);
527 
528  return value;
529 }
void sum(T &r) const
const Parallel::Communicator & comm() const
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.
static const bool value
Definition: xdr_io.C:54

◆ get_parametrized_function_side_values_at_qps()

void RBEIMEvaluation::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 
)
static

Same as get_parametrized_function_values_at_qps() except for side data.

Definition at line 444 of file rb_eim_evaluation.C.

Referenced by get_eim_basis_function_side_values_at_qps(), and get_parametrized_function_side_value().

450 {
451  LOG_SCOPE("get_parametrized_function_side_values_at_qps()", "RBEIMConstruction");
452 
453  values.clear();
454 
455  const auto it = pf.find(std::make_pair(elem_id,side_index));
456  if (it != pf.end())
457  {
458  const auto & comps_and_qps_on_elem = it->second;
459  libmesh_error_msg_if(comp >= comps_and_qps_on_elem.size(),
460  "Invalid comp index: " << comp);
461 
462  values = comps_and_qps_on_elem[comp];
463  }
464 }

◆ get_parametrized_function_value()

Number RBEIMEvaluation::get_parametrized_function_value ( const Parallel::Communicator comm,
const QpDataMap pf,
dof_id_type  elem_id,
unsigned int  comp,
unsigned int  qp 
)
static

Same as above, except that we just return the value at the qp^th quadrature point.

Definition at line 484 of file rb_eim_evaluation.C.

References libMesh::ParallelObject::comm(), get_parametrized_function_values_at_qps(), TIMPI::Communicator::sum(), and value.

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), get_eim_basis_function_value(), and libMesh::RBEIMConstruction::store_eim_solutions_for_training_set().

490 {
491  std::vector<Number> values;
492  get_parametrized_function_values_at_qps(pf, elem_id, comp, values);
493 
494  // In parallel, values should only be non-empty on one processor
495  Number value = 0.;
496  if (!values.empty())
497  {
498  libmesh_error_msg_if(qp >= values.size(), "Error: Invalid qp index");
499 
500  value = values[qp];
501  }
502  comm.sum(value);
503 
504  return value;
505 }
void sum(T &r) const
const Parallel::Communicator & comm() const
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...
static const bool value
Definition: xdr_io.C:54

◆ get_parametrized_function_values_at_qps()

void RBEIMEvaluation::get_parametrized_function_values_at_qps ( const QpDataMap pf,
dof_id_type  elem_id,
unsigned int  comp,
std::vector< Number > &  values 
)
static

Fill up values by evaluating the parametrized function pf for all quadrature points on element elem_id and component comp.

Definition at line 423 of file rb_eim_evaluation.C.

Referenced by get_eim_basis_function_values_at_qps(), and get_parametrized_function_value().

428 {
429  LOG_SCOPE("get_parametrized_function_values_at_qps()", "RBEIMConstruction");
430 
431  values.clear();
432 
433  const auto it = pf.find(elem_id);
434  if (it != pf.end())
435  {
436  const auto & comps_and_qps_on_elem = it->second;
437  libmesh_error_msg_if(comp >= comps_and_qps_on_elem.size(),
438  "Invalid comp index: " << comp);
439 
440  values = comps_and_qps_on_elem[comp];
441  }
442 }

◆ get_preserve_rb_eim_solutions()

bool RBEIMEvaluation::get_preserve_rb_eim_solutions ( ) const

Get _preserve_rb_eim_solutions.

Definition at line 888 of file rb_eim_evaluation.C.

References _preserve_rb_eim_solutions.

889 {
891 }
bool _preserve_rb_eim_solutions
Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves().

◆ get_rb_eim_error_indicators()

const std::vector< Real > & RBEIMEvaluation::get_rb_eim_error_indicators ( ) const

Return the EIM error indicator values from the most recent call to rb_eim_solves().

Definition at line 692 of file rb_eim_evaluation.C.

References _rb_eim_error_indicators.

693 {
695 }
std::vector< Real > _rb_eim_error_indicators
If we&#39;re using the EIM error indicator, then we store the error indicator values corresponding to _rb...

◆ get_rb_eim_solutions()

const std::vector< DenseVector< Number > > & RBEIMEvaluation::get_rb_eim_solutions ( ) const

Return the EIM solution coefficients from the most recent call to rb_eim_solves().

Definition at line 661 of file rb_eim_evaluation.C.

References _rb_eim_solutions.

Referenced by libMesh::RBEIMConstruction::compute_max_eim_error().

662 {
663  return _rb_eim_solutions;
664 }
std::vector< DenseVector< Number > > _rb_eim_solutions
The EIM solution coefficients from the most recent call to rb_eim_solves().

◆ get_rb_eim_solutions_entries()

std::vector< Number > RBEIMEvaluation::get_rb_eim_solutions_entries ( unsigned int  index) const

Return entry index for each solution in _rb_eim_solutions.

Definition at line 666 of file rb_eim_evaluation.C.

References _rb_eim_solutions, and libMesh::index_range().

Referenced by libMesh::RBEIMTheta::evaluate_vec().

667 {
668  LOG_SCOPE("get_rb_eim_solutions_entries()", "RBEIMEvaluation");
669 
670  std::vector<Number> rb_eim_solutions_entries(_rb_eim_solutions.size());
671  for (unsigned int mu_index : index_range(_rb_eim_solutions))
672  {
673  libmesh_error_msg_if(index >= _rb_eim_solutions[mu_index].size(),
674  "Error: Requested solution index " << index <<
675  ", but only have " << _rb_eim_solutions[mu_index].size() << " entries.");
676  rb_eim_solutions_entries[mu_index] = _rb_eim_solutions[mu_index](index);
677  }
678 
679  return rb_eim_solutions_entries;
680 }
std::vector< DenseVector< Number > > _rb_eim_solutions
The EIM solution coefficients from the most recent call to rb_eim_solves().
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ get_side_basis_function()

const RBEIMEvaluation::SideQpDataMap & RBEIMEvaluation::get_side_basis_function ( unsigned int  i) const

Get a reference to the i^th side basis function.

Definition at line 645 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions.

Referenced by libMesh::RBEIMConstruction::update_eim_matrices().

646 {
648 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.

◆ get_vec_eval_input()

const VectorizedEvalInput & RBEIMEvaluation::get_vec_eval_input ( ) const

Get the VectorizedEvalInput data.

Definition at line 3034 of file rb_eim_evaluation.C.

References _vec_eval_input.

Referenced by libMesh::RBEIMConstruction::get_random_point().

3035 {
3036  return _vec_eval_input;
3037 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the construction counter.

Should be called in the constructor of any derived class that will be reference counted.

Definition at line 183 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

184 {
185  libmesh_try
186  {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189  p.first++;
190  }
191  libmesh_catch (...)
192  {
193  auto stream = libMesh::err.get();
194  stream->exceptions(stream->goodbit); // stream must not throw
195  libMesh::err << "Encountered unrecoverable error while calling "
196  << "ReferenceCounter::increment_constructor_count() "
197  << "for a(n) " << name << " object." << std::endl;
198  std::terminate();
199  }
200 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
inlineprotectednoexceptinherited

Increments the destruction counter.

Should be called in the destructor of any derived class that will be reference counted.

Definition at line 207 of file reference_counter.h.

References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

208 {
209  libmesh_try
210  {
211  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212  std::pair<unsigned int, unsigned int> & p = _counts[name];
213  p.second++;
214  }
215  libmesh_catch (...)
216  {
217  auto stream = libMesh::err.get();
218  stream->exceptions(stream->goodbit); // stream must not throw
219  libMesh::err << "Encountered unrecoverable error while calling "
220  << "ReferenceCounter::increment_destructor_count() "
221  << "for a(n) " << name << " object." << std::endl;
222  std::terminate();
223  }
224 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
OStreamProxy err
static Counts _counts
Actually holds the data.
streamT * get()
Rather than implement every ostream/ios/ios_base function, we&#39;ll be lazy and make esoteric uses go th...
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:30

◆ initialize_eim_theta_objects()

void RBEIMEvaluation::initialize_eim_theta_objects ( )

Build a vector of RBTheta objects that accesses the components of the RB_solution member variable of this RBEvaluation.

Store these objects in the member vector rb_theta_objects.

Definition at line 405 of file rb_eim_evaluation.C.

References _rb_eim_theta_objects, build_eim_theta(), get_n_basis_functions(), and libMesh::make_range().

406 {
407  // Initialize the rb_theta objects that access the solution from this rb_eim_evaluation
408  _rb_eim_theta_objects.clear();
409  for (auto i : make_range(get_n_basis_functions()))
410  _rb_eim_theta_objects.emplace_back(build_eim_theta(i));
411 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
std::vector< std::unique_ptr< RBTheta > > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
virtual std::unique_ptr< RBTheta > build_eim_theta(unsigned int index)
Build a theta object corresponding to EIM index index.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134

◆ initialize_interpolation_points_spatial_indices()

void RBEIMEvaluation::initialize_interpolation_points_spatial_indices ( )

Initialize _interpolation_points_spatial_indices.

Once this data is initialized, we can store it in the training data, and read it back in during the Online stage to be used in solves.

Definition at line 290 of file rb_eim_evaluation.C.

References _interpolation_points_spatial_indices, _vec_eval_input, get_parametrized_function(), and libMesh::RBParametrizedFunction::get_spatial_indices().

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder().

291 {
293 
296 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
virtual void get_spatial_indices(std::vector< std::vector< unsigned int >> &spatial_indices, const VectorizedEvalInput &v)
In some cases a parametrized function is defined based on array data that we index into based on the ...
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()...
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.

◆ initialize_param_fn_spatial_indices()

void RBEIMEvaluation::initialize_param_fn_spatial_indices ( )

The Online counterpart of initialize_interpolation_points_spatial_indices().

This is used to initialize the spatial indices data in _parametrized_function so that the _parametrized_function can be used in the Online stage without reconstructing the spatial indices on every element or node in the mesh.

Definition at line 298 of file rb_eim_evaluation.C.

References _interpolation_points_spatial_indices, _vec_eval_input, get_parametrized_function(), and libMesh::RBParametrizedFunction::initialize_spatial_indices().

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

299 {
302 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
virtual void initialize_spatial_indices(const std::vector< std::vector< unsigned int >> &spatial_indices, const VectorizedEvalInput &v)
The Online stage counterpart of get_spatial_indices().
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()...
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.

◆ initialize_parameters() [1/2]

void libMesh::RBParametrized::initialize_parameters ( const RBParameters mu_min_in,
const RBParameters mu_max_in,
const std::map< std::string, std::vector< Real >> &  discrete_parameter_values 
)
inherited

Initialize the parameter ranges and set current_parameters.

Parameter ranges are inclusive. The input min/max RBParameters should have exactly 1 sample each. Vector-valued samples are not currently supported for the min/max parameters or for discrete parameters.

Definition at line 53 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, libMesh::RBParameters::begin_serialized(), libMesh::RBParameters::end_serialized(), libMesh::RBParameters::n_parameters(), libMesh::RBParameters::n_samples(), libMesh::Quality::name(), libMesh::RBParametrized::parameters_initialized, libMesh::RBParametrized::parameters_max, libMesh::RBParametrized::parameters_min, libMesh::Real, libMesh::RBParametrized::set_parameters(), and libMesh::RBParameters::set_value().

Referenced by libMesh::RBConstruction::enrich_basis_from_rhs_terms(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), RBParametersTest::testRBParametrized(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBConstruction::train_reduced_basis_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_POD().

56 {
57  // Check that the min/max vectors have the same size.
58  libmesh_error_msg_if(mu_min_in.n_parameters() != mu_max_in.n_parameters(),
59  "Error: Invalid mu_min/mu_max in initialize_parameters(), different number of parameters.");
60  libmesh_error_msg_if(mu_min_in.n_samples() != 1 ||
61  mu_max_in.n_samples() != 1,
62  "Error: Invalid mu_min/mu_max in initialize_parameters(), only 1 sample supported.");
63 
64  // Ensure all the values are valid for min and max.
65  auto pr_min = mu_min_in.begin_serialized();
66  auto pr_max = mu_max_in.begin_serialized();
67  for (; pr_min != mu_min_in.end_serialized(); ++pr_min, ++pr_max)
68  libmesh_error_msg_if((*pr_min).second > (*pr_max).second,
69  "Error: Invalid mu_min/mu_max in RBParameters constructor.");
70 
71  parameters_min = mu_min_in;
72  parameters_max = mu_max_in;
73 
74  // Add in min/max values due to the discrete parameters
75  for (const auto & [name, vals] : discrete_parameter_values)
76  {
77  libmesh_error_msg_if(vals.empty(), "Error: List of discrete parameters for " << name << " is empty.");
78 
79  Real min_val = *std::min_element(vals.begin(), vals.end());
80  Real max_val = *std::max_element(vals.begin(), vals.end());
81 
82  libmesh_assert_less_equal(min_val, max_val);
83 
84  parameters_min.set_value(name, min_val);
85  parameters_max.set_value(name, max_val);
86  }
87 
88  _discrete_parameter_values = discrete_parameter_values;
89 
91 
92  // Initialize the current parameters to parameters_min
94 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
bool set_parameters(const RBParameters &params)
Set the current parameters to params The parameters are checked for validity; an error is thrown if t...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void set_value(const std::string &param_name, Real value)
Set the value of the specified parameter.

◆ initialize_parameters() [2/2]

void libMesh::RBParametrized::initialize_parameters ( const RBParametrized rb_parametrized)
inherited

Initialize the parameter ranges and set current_parameters.

Definition at line 96 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::get_parameters_max(), libMesh::RBParametrized::get_parameters_min(), and libMesh::RBParametrized::initialize_parameters().

97 {
98  initialize_parameters(rb_parametrized.get_parameters_min(),
99  rb_parametrized.get_parameters_max(),
100  rb_parametrized.get_discrete_parameter_values());
101 }
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.

◆ is_discrete_parameter()

bool libMesh::RBParametrized::is_discrete_parameter ( const std::string &  mu_name) const
inherited

Is parameter mu_name discrete?

Definition at line 363 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

364 {
365  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::is_discrete_parameter");
366 
367  return (_discrete_parameter_values.find(mu_name) != _discrete_parameter_values.end());
368 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.

◆ n_objects()

static unsigned int libMesh::ReferenceCounter::n_objects ( )
inlinestaticinherited

Prints the number of outstanding (created, but not yet destroyed) objects.

Definition at line 85 of file reference_counter.h.

References libMesh::ReferenceCounter::_n_objects.

Referenced by libMesh::LibMeshInit::~LibMeshInit().

86  { return _n_objects; }
static Threads::atomic< unsigned int > _n_objects
The number of objects.

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inlineinherited
Returns
The number of processors in the group.

Definition at line 103 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, libMesh::libmesh_assert(), and TIMPI::Communicator::size().

Referenced by libMesh::Partitioner::_find_global_index_by_pid_map(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DofMap::add_constraints_to_send_list(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::System::add_vector(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), gather_bfs(), libMesh::MeshBase::get_info(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::DofMap::local_variable_indices(), libMesh::MeshRefinement::make_coarsening_compatible(), libMesh::MeshBase::n_active_elem_on_proc(), libMesh::MeshBase::n_elem_on_proc(), libMesh::MeshBase::n_nodes_on_proc(), node_gather_bfs(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::prepare_send_list(), libMesh::DofMap::print_dof_constraints(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::System::read_parallel_data(), libMesh::System::read_SCALAR_dofs(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::System::read_serialized_vector(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), OverlappingFunctorTest::run_partitioner_test(), libMesh::DofMap::scatter_constraints(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), WriteVecAndScalar::setupTests(), side_gather_bfs(), DistributedMeshTest::testRemoteElemError(), CheckpointIOTest::testSplitter(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::System::write_parallel_data(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

104  {
105  processor_id_type returnval =
106  cast_int<processor_id_type>(_communicator.size());
107  libmesh_assert(returnval); // We never have an empty comm
108  return returnval;
109  }
const Parallel::Communicator & _communicator
processor_id_type size() const
uint8_t processor_id_type
libmesh_assert(ctx)

◆ node_decrement_vector()

void RBEIMEvaluation::node_decrement_vector ( NodeDataMap v,
const DenseVector< Number > &  coeffs 
)

Same as decrement_vector() except for node data.

Definition at line 381 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, get_n_basis_functions(), libMesh::index_range(), and libMesh::DenseVector< T >::size().

Referenced by libMesh::RBEIMConstruction::compute_max_eim_error(), and libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes().

383 {
384  LOG_SCOPE("node_decrement_vector()", "RBEIMEvaluation");
385 
386  libmesh_error_msg_if(get_n_basis_functions() != coeffs.size(),
387  "Error: Number of coefficients should match number of basis functions");
388 
389  for (auto & [node_id, v_comps] : v)
390  {
391  for (const auto & comp : index_range(v_comps))
392  for (unsigned int i : index_range(_local_node_eim_basis_functions))
393  {
394  // Check that entry (node_id,comp) exists in _local_node_eim_basis_functions so that
395  // we get a clear error message if there is any missing data
396  const auto & basis_comp = libmesh_map_find(_local_node_eim_basis_functions[i], node_id);
397 
398  libmesh_error_msg_if(comp >= basis_comp.size(), "Error: Invalid comp");
399 
400  v_comps[comp] -= coeffs(i) * basis_comp[comp];
401  }
402  }
403 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
virtual unsigned int size() const override final
Definition: dense_vector.h:104
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ node_distribute_bfs()

void RBEIMEvaluation::node_distribute_bfs ( const System sys)
private

Same as distribute_bfs() except for node data.

Definition at line 2601 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, TIMPI::Communicator::broadcast(), clear(), libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::System::get_mesh(), get_parametrized_function(), libMesh::RBParametrizedFunction::get_parametrized_function_boundary_ids(), libMesh::index_range(), libMesh::make_range(), mesh, n_vars, node_boundary_id, libMesh::DofObject::processor_id(), TIMPI::Communicator::rank(), TIMPI::Communicator::scatter(), and TIMPI::Communicator::size().

Referenced by read_in_node_basis_functions().

2602 {
2603  // So we can avoid calling these many times below
2604  auto n_procs = sys.comm().size();
2605  auto rank = sys.comm().rank();
2606 
2607  // In serial there's nothing to distribute
2608  if (n_procs == 1)
2609  return;
2610 
2611  // Broadcast the number of basis functions from proc 0. After
2612  // distributing, all procs should have the same number of basis
2613  // functions.
2614  auto n_bf = _local_node_eim_basis_functions.size();
2615  sys.comm().broadcast(n_bf);
2616 
2617  // Allocate enough space to store n_bf basis functions on non-zero ranks
2618  if (rank != 0)
2619  _local_node_eim_basis_functions.resize(n_bf);
2620 
2621  // Broadcast the number of variables from proc 0. After
2622  // distributing, all procs should have the same number of variables.
2623  auto n_vars = _local_node_eim_basis_functions[0].begin()->second.size();
2624  sys.comm().broadcast(n_vars);
2625 
2626  // Construct lists of elem ids owned by different processors
2627  const MeshBase & mesh = sys.get_mesh();
2628 
2629  std::vector<dof_id_type> gathered_local_node_ids;
2630  {
2631  const std::set<boundary_id_type> & parametrized_function_boundary_ids =
2633 
2634  const auto & binfo = mesh.get_boundary_info();
2635 
2636  // Make a set with all the nodes that have nodesets. Use
2637  // a set so that we don't have any duplicate entries. We
2638  // deal with duplicate entries below by getting all boundary
2639  // IDs on each node.
2640  std::set<dof_id_type> nodes_with_nodesets;
2641  for (const auto & t : binfo.build_node_list())
2642  nodes_with_nodesets.insert(std::get<0>(t));
2643 
2644  // To be filled in by BoundaryInfo calls in loop below
2645  std::vector<boundary_id_type> node_boundary_ids;
2646 
2647  for(dof_id_type node_id : nodes_with_nodesets)
2648  {
2649  const Node * node = mesh.node_ptr(node_id);
2650 
2651  if (node->processor_id() != mesh.comm().rank())
2652  continue;
2653 
2654  binfo.boundary_ids(node, node_boundary_ids);
2655 
2656  bool has_node_boundary_id = false;
2657  for(boundary_id_type node_boundary_id : node_boundary_ids)
2658  if(parametrized_function_boundary_ids.count(node_boundary_id))
2659  {
2660  has_node_boundary_id = true;
2661  break;
2662  }
2663 
2664  if(has_node_boundary_id)
2665  {
2666  gathered_local_node_ids.push_back(node_id);
2667  }
2668  }
2669  }
2670 
2671  // I _think_ the local node ids are likely to already be sorted in
2672  // ascending order, since that is how they are stored on the Mesh,
2673  // but we can always just guarantee this to be on the safe side as
2674  // well.
2675  std::sort(gathered_local_node_ids.begin(), gathered_local_node_ids.end());
2676 
2677  // Gather the number of local nodes from all procs to proc 0
2678  auto n_local_nodes = gathered_local_node_ids.size();
2679  std::vector<std::size_t> gathered_n_local_nodes = {n_local_nodes};
2680  sys.comm().gather(/*root_id=*/0, gathered_n_local_nodes);
2681 
2682  // Gather the node ids owned by each processor onto processor 0.
2683  sys.comm().gather(/*root_id=*/0, gathered_local_node_ids);
2684 
2685  // Construct vectors of "start" and "one-past-the-end" indices into
2686  // the gathered_local_node_ids vector for each proc. Only valid on
2687  // processor 0.
2688  std::vector<std::size_t> start_node_ids_index, end_node_ids_index;
2689 
2690  if (rank == 0)
2691  {
2692  start_node_ids_index.resize(n_procs);
2693  start_node_ids_index[0] = 0;
2694  for (processor_id_type p=1; p<n_procs; ++p)
2695  start_node_ids_index[p] = start_node_ids_index[p-1] + gathered_n_local_nodes[p-1];
2696 
2697  end_node_ids_index.resize(n_procs);
2698  end_node_ids_index[n_procs - 1] = gathered_local_node_ids.size();
2699  for (processor_id_type p=0; p<n_procs - 1; ++p)
2700  end_node_ids_index[p] = start_node_ids_index[p+1];
2701  }
2702 
2703  // On processor 0, using basis function 0 and variable 0, prepare a
2704  // vector with the nodes. Then scatter this vector
2705  // out to the processors that require it. The order of this vector
2706  // matches the gathered_local_node_ids ordering. The counts will be
2707  // gathered_n_local_nodes.
2708 
2709  // On rank 0, the "counts" vector holds the number of floating point values that
2710  // are to be scattered to each proc. It is only required on proc 0.
2711  std::vector<int> counts;
2712 
2713  if (rank == 0)
2714  {
2715  counts.resize(n_procs);
2716 
2717  for (processor_id_type p=0; p<n_procs; ++p)
2718  {
2719  auto node_ids_range = (end_node_ids_index[p] - start_node_ids_index[p]);
2720 
2721  // Accumulate the count for this proc
2722  counts[p] += node_ids_range;
2723  } // end for proc_id
2724  } // if (rank == 0)
2725 
2726  // The recv_node_data vector will be used on the receiving end of all
2727  // the scatters below.
2728  std::vector<Number> recv_node_data;
2729 
2730  // For each basis function and each variable, build a vector
2731  // data in the Node ordering given by the
2732  // gathered_local_node_ids, then call
2733  //
2734  // sys.comm().scatter(data, counts, recv, /*root_id=*/0);
2735  std::vector<std::vector<Number>> node_data(n_vars);
2736 
2737  // We also reserve space in node_data, since we will push_back into it below.
2738  int count_sum = std::accumulate(counts.begin(), counts.end(), 0);
2739  for (auto var : index_range(node_data))
2740  node_data[var].reserve(count_sum);
2741 
2742  // Loop from 0..n_bf on _all_ procs, since the scatters inside this
2743  // loop are collective.
2744  for (auto bf : make_range(n_bf))
2745  {
2746  // Prepare data for scattering (only on proc 0)
2747  if (rank == 0)
2748  {
2749  // Reference to the data map for the current basis function.
2750  auto & bf_map = _local_node_eim_basis_functions[bf];
2751 
2752  // Clear any data from previous bf (this does not change the capacity
2753  // that was reserved above).
2754  for (auto var : index_range(node_data))
2755  node_data[var].clear();
2756 
2757  for (processor_id_type p=0; p<n_procs; ++p)
2758  {
2759  for (auto n : make_range(start_node_ids_index[p], end_node_ids_index[p]))
2760  {
2761  auto node_id = gathered_local_node_ids[n];
2762 
2763  // Get reference to array[n_vars] for current Node.
2764  // Throws an error if the required node_id is not found.
2765  const auto & array = libmesh_map_find(bf_map, node_id);
2766 
2767  for (auto var : index_range(array))
2768  node_data[var].push_back(array[var]);
2769  } // end for (n)
2770  } // end for proc_id
2771  } // end if rank==0
2772 
2773  // Perform the scatters (all procs)
2774  for (auto var : make_range(n_vars))
2775  {
2776  // Do the scatter for the current var
2777  sys.comm().scatter(node_data[var], counts, recv_node_data, /*root_id=*/0);
2778 
2779  if (rank != 0)
2780  {
2781  // Store the scattered data we received in _local_eim_basis_functions[bf]
2782  auto & bf_map = _local_node_eim_basis_functions[bf];
2783  auto cursor = recv_node_data.begin();
2784 
2785  for (auto i : index_range(gathered_local_node_ids))
2786  {
2787  auto node_id = gathered_local_node_ids[i];
2788  auto & array = bf_map[node_id];
2789 
2790  // Create space to store the data if it doesn't already exist.
2791  if (array.empty())
2792  array.resize(n_vars);
2793 
2794  // There is only one value per variable per node, so
2795  // we set the value by de-referencing cursor, and
2796  // then advance the cursor by 1.
2797  array[var] = *cursor;
2798  std::advance(cursor, 1);
2799  }
2800  } // if (rank != 0)
2801  } // end for (var)
2802  } // end for (bf)
2803 
2804  // Now that the scattering is done, delete non-local Elem
2805  // information from processor 0's _local_eim_basis_functions data
2806  // structure.
2807  if (rank == 0)
2808  {
2809  for (processor_id_type p=1; p<n_procs; ++p)
2810  {
2811  for (auto n : make_range(start_node_ids_index[p], end_node_ids_index[p]))
2812  {
2813  auto node_id = gathered_local_node_ids[n];
2814 
2815  // Delete this Node's information from every basis function.
2816  for (auto & bf_map : _local_node_eim_basis_functions)
2817  bf_map.erase(node_id);
2818  } // end for (n)
2819  } // end for proc_id
2820  } // if (rank == 0)
2821 }
virtual void clear() override
Clear this object.
const std::set< boundary_id_type > & get_parametrized_function_boundary_ids() const
For RBParametrizedFunctions defined on element sides or nodes, we get/set the boundary IDs that this ...
MeshBase & mesh
uint8_t processor_id_type
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
int8_t boundary_id_type
Definition: id_types.h:51
unsigned int n_vars
const boundary_id_type node_boundary_id
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111
uint8_t dof_id_type
Definition: id_types.h:67

◆ node_gather_bfs()

void RBEIMEvaluation::node_gather_bfs ( )
private

Same as gather_bfs() except for node data.

Definition at line 1980 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::index_range(), TIMPI::Communicator::max(), libMesh::ParallelObject::n_processors(), n_vars, libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::verify().

Referenced by write_out_node_basis_functions().

1981 {
1982  // We need to gather _local_node_eim_basis_functions data from other
1983  // procs for printing.
1984  //
1985  // Ideally, this could be accomplished by simply calling:
1986  // this->comm().gather(/*root_id=*/0, _local_node_eim_basis_functions);
1987  //
1988  // but the data structure seems to be too complicated for this to
1989  // work automatically. (I get some error about the function called
1990  // being "private within this context".) Therefore, we have to
1991  // gather the information manually.
1992 
1993  // So we can avoid calling this many times below
1994  auto n_procs = this->n_processors();
1995 
1996  // In serial there's nothing to gather
1997  if (n_procs == 1)
1998  return;
1999 
2000  // Current assumption is that the number of basis functions stored on
2001  // each processor is the same, the only thing that differs is the number
2002  // of elements, so make sure that is the case now.
2003  auto n_bf = _local_node_eim_basis_functions.size();
2004  this->comm().verify(n_bf);
2005 
2006  // This function should never be called if there are no basis
2007  // functions, so if it was, something went wrong.
2008  libmesh_error_msg_if(!n_bf, "RBEIMEvaluation::gather_bfs() should not be called with 0 basis functions.");
2009 
2010  // The number of variables should be the same on all processors
2011  // and we can get this from _local_eim_basis_functions. However,
2012  // it may be that some processors have no local elements, so on
2013  // those processors we cannot look up the size from
2014  // _local_eim_basis_functions. As a result we use comm().max(n_vars)
2015  // to make sure all processors agree on the final value.
2016  std::size_t n_vars =
2017  _local_node_eim_basis_functions[0].empty() ? 0 : _local_node_eim_basis_functions[0].begin()->second.size();
2018  this->comm().max(n_vars);
2019 
2020  // Gather list of Node ids stored on each processor to proc 0. We
2021  // use basis function 0 as an example and assume all the basis
2022  // functions are distributed similarly.
2023  unsigned int n_local_nodes = _local_node_eim_basis_functions[0].size();
2024  std::vector<dof_id_type> node_ids;
2025  node_ids.reserve(n_local_nodes);
2026  for (const auto & pr : _local_node_eim_basis_functions[0])
2027  node_ids.push_back(pr.first);
2028  this->comm().gather(/*root_id=*/0, node_ids);
2029 
2030  // Now we construct a vector for each basis function, for each
2031  // variable, which is ordered according to:
2032  // [ [val for Node 0], [val for Node 1], ... [val for Node N] ]
2033  // and gather it to processor 0.
2034  std::vector<std::vector<Number>> gathered_node_data(n_vars);
2036  {
2037  // Clear any data from previous bf
2038  for (auto var : index_range(gathered_node_data))
2039  {
2040  gathered_node_data[var].clear();
2041  gathered_node_data[var].resize(n_local_nodes);
2042  }
2043 
2044  unsigned int local_node_idx = 0;
2045  for (const auto & pr : _local_node_eim_basis_functions[bf])
2046  {
2047  // array[n_vars] per Node
2048  const auto & array = pr.second;
2049  for (auto var : index_range(array))
2050  {
2051  gathered_node_data[var][local_node_idx] = array[var];
2052  }
2053 
2054  local_node_idx++;
2055  }
2056 
2057  // Reference to the data map for the current basis function.
2058  auto & bf_map = _local_node_eim_basis_functions[bf];
2059 
2060  for (auto var : index_range(gathered_node_data))
2061  {
2062  // For each var, gather gathered_qp_data[var] onto processor
2063  // 0. There apparently is not a gather overload for
2064  // vector-of-vectors...
2065  this->comm().gather(/*root_id=*/0, gathered_node_data[var]);
2066 
2067  // On processor 0, iterate over the gathered_qp_data[var]
2068  // vector we just gathered, filling in the "small" vectors
2069  // for each Elem. Note: here we ignore the fact that we
2070  // already have the data on processor 0 and just overwrite
2071  // it, this makes the indexing logic a bit simpler.
2072  if (this->processor_id() == 0)
2073  {
2074  auto cursor = gathered_node_data[var].begin();
2075  for (auto i : index_range(node_ids))
2076  {
2077  auto node_id = node_ids[i];
2078 
2079  // Get reference to the [n_vars] array for
2080  // this Node. We assign() into the vector of
2081  // node values, which allocates space if
2082  // it doesn't already exist.
2083  auto & array = bf_map[node_id];
2084 
2085  // Possibly allocate space if this is data for a new
2086  // node we haven't seen before.
2087  if (array.empty())
2088  array.resize(n_vars);
2089 
2090  // There is only one value per variable per node, so
2091  // we set the value by de-referencing cursor, and
2092  // then advance the cursor by 1.
2093  array[var] = *cursor;
2094  std::advance(cursor, 1);
2095  }
2096  }
2097  }
2098  } // end loop over basis functions
2099 }
bool verify(const T &r) const
void gather(const unsigned int root_id, const T &send_data, std::vector< T, A > &recv) const
const Parallel::Communicator & comm() const
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
processor_id_type n_processors() const
unsigned int n_vars
void max(const T &r, T &o, Request &req) const
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ operator=() [1/2]

RBEIMEvaluation& libMesh::RBEIMEvaluation::operator= ( const RBEIMEvaluation )
delete

◆ operator=() [2/2]

RBEIMEvaluation& libMesh::RBEIMEvaluation::operator= ( RBEIMEvaluation &&  )
default

◆ print_discrete_parameter_values()

void libMesh::RBParametrized::print_discrete_parameter_values ( ) const
inherited

Print out all the discrete parameter values.

Definition at line 377 of file rb_parametrized.C.

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::Quality::name(), libMesh::out, and value.

Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().

378 {
379  for (const auto & [name, values] : get_discrete_parameter_values())
380  {
381  libMesh::out << "Discrete parameter " << name << ", values: ";
382 
383  for (const auto & value : values)
384  libMesh::out << value << " ";
385  libMesh::out << std::endl;
386  }
387 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
OStreamProxy out
static const bool value
Definition: xdr_io.C:54

◆ print_info()

void libMesh::ReferenceCounter::print_info ( std::ostream &  out_stream = libMesh::out)
staticinherited

Prints the reference information, by default to libMesh::out.

Definition at line 81 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().

Referenced by libMesh::LibMeshInit::~LibMeshInit().

82 {
84  out_stream << ReferenceCounter::get_info();
85 }
static std::string get_info()
Gets a string containing the reference information.
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...

◆ print_local_eim_basis_functions()

void RBEIMEvaluation::print_local_eim_basis_functions ( ) const
private

Print the contents of _local_eim_basis_functions to libMesh::out.

Helper function mainly useful for debugging.

Definition at line 1633 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, _local_node_eim_basis_functions, _local_side_eim_basis_functions, libMesh::index_range(), and libMesh::out.

1634 {
1635  for (auto bf : index_range(_local_eim_basis_functions))
1636  {
1637  libMesh::out << "Interior basis function " << bf << std::endl;
1638  for (const auto & [elem_id, array] : _local_eim_basis_functions[bf])
1639  {
1640  libMesh::out << "Elem " << elem_id << std::endl;
1641  for (auto var : index_range(array))
1642  {
1643  libMesh::out << "Variable " << var << std::endl;
1644  for (auto qp : index_range(array[var]))
1645  libMesh::out << array[var][qp] << " ";
1646  libMesh::out << std::endl;
1647  }
1648  }
1649  }
1650 
1652  {
1653  libMesh::out << "Side basis function " << bf << std::endl;
1654  for (const auto & [pr, array] : _local_side_eim_basis_functions[bf])
1655  {
1656  const auto & elem_id = pr.first;
1657  const auto & side_index = pr.second;
1658  libMesh::out << "Elem " << elem_id << ", Side " << side_index << std::endl;
1659  for (auto var : index_range(array))
1660  {
1661  libMesh::out << "Variable " << var << std::endl;
1662  for (auto qp : index_range(array[var]))
1663  libMesh::out << array[var][qp] << " ";
1664  libMesh::out << std::endl;
1665  }
1666  }
1667  }
1668 
1670  {
1671  libMesh::out << "Node basis function " << bf << std::endl;
1672  for (const auto & [node_id, array] : _local_node_eim_basis_functions[bf])
1673  {
1674  libMesh::out << "Node " << node_id << std::endl;
1675  for (auto var : index_range(array))
1676  {
1677  libMesh::out << "Variable " << var << ": " << array[var] << std::endl;
1678  }
1679  libMesh::out << std::endl;
1680  }
1681  }
1682 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
OStreamProxy out
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ print_parameters()

void libMesh::RBParametrized::print_parameters ( ) const
inherited

Print the current parameters.

Definition at line 190 of file rb_parametrized.C.

References libMesh::RBParametrized::get_parameters(), libMesh::RBParametrized::parameters_initialized, and libMesh::RBParameters::print().

Referenced by libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_greedy().

191 {
192  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::print_current_parameters");
193 
194  get_parameters().print();
195 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void print(unsigned precision=6, int max_values=5) const
Print the parameters.
const RBParameters & get_parameters() const
Get the current parameters.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inlineinherited
Returns
The rank of this processor in the group.

Definition at line 114 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and TIMPI::Communicator::rank().

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DofMap::distribute_scalar_dofs(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMap::end_dof(), libMesh::DofMap::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMap::first_dof(), libMesh::DofMap::first_old_dof(), gather_bfs(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::DofMap::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::DofMap::is_evaluable(), libMesh::SparsityPattern::Build::join(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DofMap::local_variable_indices(), main(), libMesh::MeshRefinement::make_coarsening_compatible(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMap::n_local_dofs(), libMesh::System::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), node_gather_bfs(), libMesh::SparsityPattern::Build::operator()(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::ExodusII_IO::read_header(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::System::read_header(), libMesh::System::read_legacy_data(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), side_gather_bfs(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), MeshInputTest::testAbaqusRead(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testLowOrderEdgeBlocks(), SystemsTest::testProjectMatrix1D(), SystemsTest::testProjectMatrix2D(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::NameBasedIO::write(), libMesh::XdrIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::UCDIO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), write_out_interior_basis_functions(), write_out_node_basis_functions(), write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

115  { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const
const Parallel::Communicator & _communicator

◆ project_qp_data_map_onto_system()

void RBEIMEvaluation::project_qp_data_map_onto_system ( System sys,
const QpDataMap bf_data,
const EIMVarGroupPlottingInfo eim_vargroup 
)
virtual

Project the specified variable of bf_data into the solution vector of System.

This method is virtual so that it can be overridden in sub-classes, e.g. to perform a specialized type of projection.

Definition at line 2823 of file rb_eim_evaluation.C.

References libMesh::DenseMatrix< T >::cholesky_solve(), libMesh::System::current_local_solution, dim, libMesh::MeshBase::elem_dimensions(), libMesh::FEMContext::elem_fe_reinit(), libMesh::EIMVarGroupPlottingInfo::first_eim_var_index, libMesh::DiffContext::get_dof_indices(), libMesh::FEMContext::get_element_fe(), libMesh::FEMContext::get_element_qrule(), libMesh::FEAbstract::get_JxW(), libMesh::System::get_mesh(), libMesh::FEGenericBase< OutputType >::get_phi(), libMesh::make_range(), libMesh::QBase::n_points(), libMesh::System::n_vars(), libMesh::FEMContext::pre_fe_reinit(), and libMesh::System::solution.

Referenced by write_out_projected_basis_functions().

2826 {
2827  LOG_SCOPE("project_basis_function_onto_system()", "RBEIMEvaluation");
2828 
2829  libmesh_error_msg_if(sys.n_vars() == 0, "System must have at least one variable");
2830 
2831  // TODO: Currently only implemented for the case of one variable in a variable group
2832  unsigned int var = eim_vargroup.first_eim_var_index;
2833 
2834  FEMContext context(sys);
2835  {
2836  // Pre-request relevant data for all dimensions
2837  for (unsigned int dim=1; dim<=3; ++dim)
2838  if (sys.get_mesh().elem_dimensions().count(dim))
2839  for (auto init_var : make_range(sys.n_vars()))
2840  {
2841  auto fe = context.get_element_fe(init_var, dim);
2842  fe->get_JxW();
2843  fe->get_phi();
2844  }
2845  }
2846 
2847  FEBase * elem_fe = nullptr;
2848  context.get_element_fe( 0, elem_fe );
2849  const std::vector<Real> & JxW = elem_fe->get_JxW();
2850  const std::vector<std::vector<Real>> & phi = elem_fe->get_phi();
2851 
2852  // Get a reference to the current_local_solution vector, which has
2853  // GHOSTED DOFs. Make sure it is initially zeroed, since we will now
2854  // accumulate values into it.
2855  auto & current_local_soln = *(sys.current_local_solution);
2856  current_local_soln.zero();
2857 
2858  // The repeat_count vector will store the number of times a
2859  // projected value has been assigned to a node. We get a reference
2860  // to it for convenience in the code below.
2861  std::unique_ptr<NumericVector<Number>> repeat_count_ptr = current_local_soln.zero_clone();
2862  auto & repeat_count = *repeat_count_ptr;
2863 
2864  for (const auto & elem : sys.get_mesh().active_local_element_ptr_range())
2865  {
2866  context.pre_fe_reinit(sys, elem);
2867  context.elem_fe_reinit();
2868 
2869  const std::vector<dof_id_type> & dof_indices = context.get_dof_indices(/*var=*/0);
2870  unsigned int n_proj_dofs = dof_indices.size();
2871  unsigned int n_qpoints = context.get_element_qrule().n_points();
2872 
2873  const std::vector<std::vector<Number>> & var_and_qp_data = libmesh_map_find(qp_data_map, elem->id());
2874  libmesh_error_msg_if(var >= var_and_qp_data.size(), "Invalid EIM variable number: " << var);
2875  const std::vector<Number> & qp_data = var_and_qp_data[var];
2876 
2877  // If qp_data doesn't match n_qpoints then we skip this element since this means
2878  // that the EIM basis function is not applicable on this element. This can happen,
2879  // for example, if we have 1D and 3D elements in the same mesh and the EIM basis
2880  // functions have been set up for the 3D elements only. Note that the EIM is
2881  // necessarily dependent on the element dimension since it is based on the number
2882  // of quad. points per element. If multiple dimensions need to be supported then
2883  // one can add a separate EIM for each dimension.
2884  if (qp_data.size() != n_qpoints)
2885  continue;
2886 
2887  DenseMatrix<Number> Me(n_proj_dofs, n_proj_dofs);
2888  DenseVector<Number> Fe(n_proj_dofs);
2889  for (auto qp : make_range(n_qpoints))
2890  for (auto i : make_range(n_proj_dofs))
2891  {
2892  Fe(i) += JxW[qp] * qp_data[qp] * phi[i][qp];
2893 
2894  for (auto j : make_range(n_proj_dofs))
2895  Me(i,j) += JxW[qp] * phi[i][qp] * phi[j][qp];
2896  }
2897 
2898  DenseVector<Number> projected_data;
2899  Me.cholesky_solve(Fe, projected_data);
2900 
2901  for (auto i : make_range(n_proj_dofs))
2902  {
2903  current_local_soln.add(dof_indices[i], projected_data(i));
2904  repeat_count.add(dof_indices[i], 1.);
2905  }
2906  }
2907 
2908  current_local_soln.close();
2909  repeat_count.close();
2910 
2911  // Average the projected QP values to get nodal values
2912  current_local_soln /= repeat_count;
2913  current_local_soln.close();
2914 
2915  // Copy values from the GHOSTED current_local_solution vector into
2916  // sys.solution, since that is what will ultimately be plotted/used
2917  // by other parts of the code.
2918  (*sys.solution) = current_local_soln;
2919 }
unsigned int dim
FEGenericBase< Real > FEBase
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134

◆ rb_eim_solve()

DenseVector< Number > RBEIMEvaluation::rb_eim_solve ( DenseVector< Number > &  EIM_rhs)

Calculate the EIM approximation for the given right-hand side vector EIM_rhs.

Store the solution coefficients in the member _eim_solution.

Definition at line 105 of file rb_eim_evaluation.C.

References _interpolation_matrix, get_n_basis_functions(), libMesh::DenseMatrix< T >::get_principal_submatrix(), libMesh::DenseMatrix< T >::lu_solve(), and libMesh::DenseVector< T >::size().

Referenced by libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), and libMesh::RBEIMConstruction::store_eim_solutions_for_training_set().

106 {
107  LOG_SCOPE("rb_eim_solve()", "RBEIMEvaluation");
108 
109  libmesh_error_msg_if(EIM_rhs.size() > get_n_basis_functions(),
110  "Error: N cannot be larger than the number of basis functions in rb_solve");
111 
112  libmesh_error_msg_if(EIM_rhs.size()==0, "Error: N must be greater than 0 in rb_solve");
113 
114  const unsigned int N = EIM_rhs.size();
115  DenseVector<Number> rb_eim_solution(N);
116  DenseMatrix<Number> interpolation_matrix_N;
117  _interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
118 
119  interpolation_matrix_N.lu_solve(EIM_rhs, rb_eim_solution);
120 
121  return rb_eim_solution;
122 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
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.
virtual unsigned int size() const override final
Definition: dense_vector.h:104
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ rb_eim_solves()

void RBEIMEvaluation::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.

Definition at line 124 of file rb_eim_evaluation.C.

References _eim_solutions_for_training_set, _interpolation_matrix, _interpolation_points_comp, _is_eim_error_indicator_active, _preserve_rb_eim_solutions, _rb_eim_error_indicators, _rb_eim_solutions, _rb_eim_solves_mus, _rb_eim_solves_N, _vec_eval_input, get_eim_error_indicator(), get_n_basis_functions(), get_parametrized_function(), libMesh::DenseMatrix< T >::get_principal_submatrix(), libMesh::index_range(), libMesh::libmesh_ignore(), libMesh::DenseMatrix< T >::lu_solve(), libMesh::make_range(), libMesh::RBParametrizedFunction::node_vectorized_evaluate(), libMesh::Real, libMesh::RBParametrizedFunction::side_vectorized_evaluate(), and libMesh::RBParametrizedFunction::vectorized_evaluate().

Referenced by libMesh::RBEIMConstruction::compute_max_eim_error(), and libMesh::RBEIMTheta::evaluate_vec().

126 {
128  {
129  // In this case we preserve _rb_eim_solutions and hence we
130  // just return immediately so that we skip updating
131  // _rb_eim_solutions below. This is relevant in cases where
132  // we set up _rb_eim_solutions elsewhere and we don't want
133  // to override it.
134  return;
135  }
136 
137  libmesh_error_msg_if(N > get_n_basis_functions(),
138  "Error: N cannot be larger than the number of basis functions in rb_eim_solves");
139  libmesh_error_msg_if(N==0, "Error: N must be greater than 0 in rb_eim_solves");
140 
141  // If mus and N are the same as before, then we return early
142  if ((_rb_eim_solves_mus == mus) && (_rb_eim_solves_N == N))
143  return;
144 
145  LOG_SCOPE("rb_eim_solves()", "RBEIMEvaluation");
146 
147  _rb_eim_solves_mus = mus;
148  _rb_eim_solves_N = N;
149 
150  if (get_parametrized_function().is_lookup_table)
151  {
152  _rb_eim_solutions.resize(mus.size());
153  for (auto mu_index : index_range(mus))
154  {
155  Real lookup_table_param =
156  mus[mu_index].get_value(get_parametrized_function().lookup_table_param_name);
157 
158  // Cast lookup_table_param to an unsigned integer so that we can use
159  // it as an index into the EIM rhs values obtained from the lookup table.
160  unsigned int lookup_table_index =
161  cast_int<unsigned int>(std::round(lookup_table_param));
162 
163  DenseVector<Number> values;
164  _eim_solutions_for_training_set[lookup_table_index].get_principal_subvector(N, values);
165  _rb_eim_solutions[mu_index] = values;
166  }
167 
168  return;
169  }
170 
171  // output all comps indexing is as follows:
172  // mu index --> interpolation point index --> component index --> value.
173  std::vector<std::vector<std::vector<Number>>> output_all_comps;
174  if (get_parametrized_function().on_mesh_sides())
176  else if (get_parametrized_function().on_mesh_nodes())
178  else
180 
181  // Previously we did one RB-EIM solve per input mu, but now we do
182  // one RB-EIM solve per input mu, per sample. In order for this to
183  // work, we require that all the input mu objects have the same
184  // number of samples.
185  auto n_samples_0 = mus[0].n_samples();
186  for (const auto & mu : mus)
187  libmesh_error_msg_if(mu.n_samples() != n_samples_0, "All RBParameters objects must have same n_samples()");
188 
189  // After we verified that all mus have the same number of samples,
190  // the total number of RB-EIM solves is simply the number of mus
191  // times the number of samples.
192  unsigned int num_rb_eim_solves = mus.size() * n_samples_0;
193 
194  // A special case is when we are passed a single RBParameters object
195  // with no parameters stored on it. In this case, we effectively
196  // have Theta(mu) == const, and therefore we still need to do at
197  // least one RB-EIM solve. In this case, we require that there is
198  // only one entry in "mus" for simplicity.
199  if (num_rb_eim_solves == 0 && mus[0].n_parameters() == 0)
200  {
201  libmesh_error_msg_if(mus.size() != 1, "Must pass in only a single RBParameters object when solving with no parameters.");
202  num_rb_eim_solves = 1;
203  }
204 
205  std::vector<std::vector<Number>> evaluated_values_at_interp_points(num_rb_eim_solves);
206 
207  std::vector<Number> evaluated_values_at_err_indicator_point;
209  evaluated_values_at_err_indicator_point.resize(num_rb_eim_solves);
210 
211  // In this loop, counter goes from 0 to num_rb_eim_solves. The
212  // purpose of this loop is to strip out the "columns" of the
213  // output_all_comps array into rows.
214  {
215  unsigned int counter = 0;
216  for (auto mu_index : index_range(mus))
217  for (auto sample_index : make_range(mus[mu_index].n_samples()))
218  {
219  // Ignore compiler warnings about unused loop index
220  libmesh_ignore(sample_index);
221 
222  evaluated_values_at_interp_points[counter].resize(N);
223 
224  for (unsigned int interp_pt_index=0; interp_pt_index<N; interp_pt_index++)
225  {
226  unsigned int comp = _interpolation_points_comp[interp_pt_index];
227 
228  // This line of code previously used "mu_index", now we use
229  // "counter" handle the multi-sample RBParameters case.
230  evaluated_values_at_interp_points[counter][interp_pt_index] =
231  output_all_comps[counter][interp_pt_index][comp];
232  }
233 
235  {
236  unsigned int comp = _interpolation_points_comp[N];
237 
238  evaluated_values_at_err_indicator_point[counter] =
239  output_all_comps[counter][N][comp];
240  }
241 
242  counter++;
243  }
244 
245  // Throw an error if we didn't do the required number of solves for
246  // some reason
247  libmesh_error_msg_if(counter != num_rb_eim_solves,
248  "We should have done " << num_rb_eim_solves <<
249  " solves, instead we did " << counter);
250  }
251 
252  DenseMatrix<Number> interpolation_matrix_N;
253  _interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
254 
255  // The number of RB EIM solutions is equal to the size of the
256  // "evaluated_values_at_interp_points" vector which we determined
257  // earlier.
258  _rb_eim_solutions.resize(num_rb_eim_solves);
260  _rb_eim_error_indicators.resize(num_rb_eim_solves);
261 
262  {
263  unsigned int counter = 0;
264  for (auto mu_index : index_range(mus))
265  for (auto sample_index : make_range(mus[mu_index].n_samples()))
266  {
267  // Ignore compiler warnings about unused loop index
268  libmesh_ignore(sample_index);
269 
270  DenseVector<Number> EIM_rhs = evaluated_values_at_interp_points[counter];
271  interpolation_matrix_N.lu_solve(EIM_rhs, _rb_eim_solutions[counter]);
272 
273  // If we're using the EIM error indicator, then we compute it via the approach
274  // proposed in Proposition 3.3 of "An empirical interpolation method: application
275  // to efficient reduced-basis discretization of partial differential equations",
276  // Barrault et al.
278  {
279  Number error_indicator_rhs = evaluated_values_at_err_indicator_point[counter];
280  _rb_eim_error_indicators[counter] =
282  error_indicator_rhs, _rb_eim_solutions[counter], EIM_rhs).first;
283  }
284 
285  counter++;
286  }
287  }
288 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in this object.
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...
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
virtual void side_vectorized_evaluate(const std::vector< RBParameters > &mus, const VectorizedEvalInput &v, std::vector< std::vector< std::vector< Number >>> &output)
Same as vectorized_evaluate() but on element sides.
bool _is_eim_error_indicator_active
Indicate if the EIM error indicator is active in RB EIM solves.
void libmesh_ignore(const Args &...)
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.
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.
std::vector< Real > _rb_eim_error_indicators
If we&#39;re using the EIM error indicator, then we store the error indicator values corresponding to _rb...
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< DenseVector< Number > > _rb_eim_solutions
The EIM solution coefficients from the most recent call to rb_eim_solves().
std::vector< unsigned int > _interpolation_points_comp
In the case of a "vector-valued" EIM, this vector determines which component of the parameterized fun...
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
virtual void node_vectorized_evaluate(const std::vector< RBParameters > &mus, const VectorizedEvalInput &v, std::vector< std::vector< std::vector< Number >>> &output)
Same as vectorized_evaluate() but on element nodes.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111
virtual void vectorized_evaluate(const std::vector< RBParameters > &mus, const VectorizedEvalInput &v, std::vector< std::vector< std::vector< Number >>> &output)
Vectorized version of evaluate.
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ read_in_basis_functions()

void RBEIMEvaluation::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.

Parameters
sysThe Mesh in this System determines the parallel distribution of the basis functions.
directory_nameSpecifies which directory to write files to.
read_binary_basis_functionsIndicates whether to expect binary or ASCII data.

Note: this is not a virtual function and is not related to the RBEvaluation function of the same name.

Definition at line 1327 of file rb_eim_evaluation.C.

References get_n_basis_functions(), get_parametrized_function(), read_in_interior_basis_functions(), read_in_node_basis_functions(), and read_in_side_basis_functions().

1330 {
1331  LOG_SCOPE("read_in_basis_functions()", "RBEIMEvaluation");
1332 
1333  // Return early without reading in anything if there are no basis functions
1334  if (get_n_basis_functions() == 0)
1335  return;
1336 
1337  if (get_parametrized_function().on_mesh_sides())
1338  read_in_side_basis_functions(sys, directory_name, read_binary_basis_functions);
1339  else if (get_parametrized_function().on_mesh_nodes())
1340  read_in_node_basis_functions(sys, directory_name, read_binary_basis_functions);
1341  else
1342  read_in_interior_basis_functions(sys, directory_name, read_binary_basis_functions);
1343 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
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.
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 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.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.

◆ read_in_interior_basis_functions()

void RBEIMEvaluation::read_in_interior_basis_functions ( const System sys,
const std::string &  directory_name,
bool  read_binary_basis_functions 
)
private

Method that reads in element interior EIM basis functions.

This may be called by read_in_basis_functions().

Definition at line 1346 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, distribute_bfs(), libMesh::index_range(), libMesh::MeshTools::n_elem(), n_vars, TIMPI::Communicator::rank(), and libMesh::READ.

Referenced by read_in_basis_functions().

1349 {
1350  LOG_SCOPE("read_in_interior_basis_functions()", "RBEIMEvaluation");
1351 
1352  // Read values on processor 0 only.
1353  if (sys.comm().rank() == 0)
1354  {
1355  // Create filename
1356  std::ostringstream file_name;
1357  const std::string basis_function_suffix = (read_binary_basis_functions ? ".xdr" : ".dat");
1358  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1359 
1360  // Create XDR reader object
1361  Xdr xdr(file_name.str(), read_binary_basis_functions ? DECODE : READ);
1362 
1363  // Read in the number of basis functions. The comment parameter
1364  // is ignored when reading.
1365  std::size_t n_bf;
1366  xdr.data(n_bf);
1367 
1368  // Read in the number of elements
1369  std::size_t n_elem;
1370  xdr.data(n_elem);
1371 
1372  // Read in the number of variables.
1373  std::size_t n_vars;
1374  xdr.data(n_vars);
1375 
1376  // Read in vector containing the number of QPs per elem. We can
1377  // create this vector with the required size or let it be read
1378  // from the file and sized for us.
1379  std::vector<unsigned int> n_qp_per_elem(n_elem);
1380  xdr.data(n_qp_per_elem);
1381 
1382  // The total amount of qp data for each var is the sum of the
1383  // entries in the "n_qp_per_elem" array.
1384  auto n_qp_data =
1385  std::accumulate(n_qp_per_elem.begin(),
1386  n_qp_per_elem.end(),
1387  0u);
1388 
1389  // Allocate space to store all required basis functions,
1390  // clearing any data that may have been there previously.
1391  //
1392  // TODO: Do we need to also write out/read in Elem ids?
1393  // Or can we assume they will always be contiguously
1394  // numbered (at least on proc 0)?
1396  _local_eim_basis_functions.resize(n_bf);
1397  for (auto i : index_range(_local_eim_basis_functions))
1398  for (std::size_t elem_id=0; elem_id<n_elem; ++elem_id)
1399  {
1400  auto & array = _local_eim_basis_functions[i][elem_id];
1401  array.resize(n_vars);
1402  }
1403 
1404  // Allocate temporary storage for one var's worth of qp data.
1405  std::vector<Number> qp_data;
1406 
1407  // Read in data for each basis function
1408  for (auto i : index_range(_local_eim_basis_functions))
1409  {
1410  // Reference to the data map for the current basis function.
1411  auto & bf_map = _local_eim_basis_functions[i];
1412 
1413  for (std::size_t var=0; var<n_vars; ++var)
1414  {
1415  qp_data.clear();
1416  qp_data.resize(n_qp_data);
1417 
1418  // Read data using data_stream() since that is
1419  // (currently) how we write it out. The "line_break"
1420  // parameter of data_stream() is ignored while reading.
1421  xdr.data_stream(qp_data.data(), qp_data.size());
1422 
1423  // Iterate over the qp_data vector, filling in the
1424  // "small" vectors for each Elem.
1425  auto cursor = qp_data.begin();
1426  for (std::size_t elem_id=0; elem_id<n_elem; ++elem_id)
1427  {
1428  // Get reference to the [n_vars][n_qp] array for
1429  // this Elem. We assign() into the vector of
1430  // quadrature point values, which allocates space if
1431  // it doesn't already exist.
1432  auto & array = bf_map[elem_id];
1433  array[var].assign(cursor, cursor + n_qp_per_elem[elem_id]);
1434  std::advance(cursor, n_qp_per_elem[elem_id]);
1435  }
1436  } // end for (var)
1437  } // end for (i)
1438  } // end if processor 0
1439 
1440  // Distribute the basis function information to the processors that require it
1441  this->distribute_bfs(sys);
1442 }
void distribute_bfs(const System &sys)
Helper function that distributes the entries of _local_eim_basis_functions to their respective proces...
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:850
unsigned int n_vars
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ read_in_node_basis_functions()

void RBEIMEvaluation::read_in_node_basis_functions ( const System sys,
const std::string &  directory_name,
bool  read_binary_basis_functions 
)
private

Method that reads in element node EIM basis functions.

This may be called by read_in_basis_functions().

Definition at line 1553 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::index_range(), n_vars, node_distribute_bfs(), TIMPI::Communicator::rank(), and libMesh::READ.

Referenced by read_in_basis_functions().

1556 {
1557  LOG_SCOPE("read_in_node_basis_functions()", "RBEIMEvaluation");
1558 
1559  // Read values on processor 0 only.
1560  if (sys.comm().rank() == 0)
1561  {
1562  // Create filename
1563  std::ostringstream file_name;
1564  const std::string basis_function_suffix = (read_binary_basis_functions ? ".xdr" : ".dat");
1565  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1566 
1567  // Create XDR reader object
1568  Xdr xdr(file_name.str(), read_binary_basis_functions ? DECODE : READ);
1569 
1570  // Read in the number of basis functions. The comment parameter
1571  // is ignored when reading.
1572  std::size_t n_bf;
1573  xdr.data(n_bf);
1574 
1575  // Read in the number of nodes
1576  std::size_t n_node;
1577  xdr.data(n_node);
1578 
1579  // Read in the number of variables.
1580  std::size_t n_vars;
1581  xdr.data(n_vars);
1582 
1583  std::vector<unsigned int> node_ids(n_node);
1584  xdr.data(node_ids);
1585 
1586  // Allocate space to store all required basis functions,
1587  // clearing any data that may have been there previously.
1588  //
1589  // TODO: Do we need to also write out/read in Node ids?
1590  // Or can we assume they will always be contiguously
1591  // numbered (at least on proc 0)?
1593  _local_node_eim_basis_functions.resize(n_bf);
1595  for (auto node_id : node_ids)
1596  {
1597  auto & array = _local_node_eim_basis_functions[i][node_id];
1598  array.resize(n_vars);
1599  }
1600 
1601  // Read data into node_value from xdr
1602  std::vector<Number> node_value;
1603 
1604  // Read in data for each basis function
1606  {
1607  // Reference to the data map for the current basis function.
1608  auto & bf_map = _local_node_eim_basis_functions[i];
1609 
1610  for (std::size_t var=0; var<n_vars; ++var)
1611  {
1612  node_value.clear();
1613  node_value.resize(n_node);
1614 
1615  // Read data using data_stream() since that is
1616  // (currently) how we write it out. The "line_break"
1617  // parameter of data_stream() is ignored while reading.
1618  xdr.data_stream(node_value.data(), node_value.size());
1619 
1620  for (unsigned int node_counter=0; node_counter<n_node; node_counter++)
1621  {
1622  auto & array = bf_map[node_ids[node_counter]];
1623  array[var] = node_value[node_counter];
1624  }
1625  } // end for (var)
1626  } // end for (i)
1627  } // end if processor 0
1628 
1629  // Distribute the basis function information to the processors that require it
1630  this->node_distribute_bfs(sys);
1631 }
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
unsigned int n_vars
void node_distribute_bfs(const System &sys)
Same as distribute_bfs() except for node data.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ read_in_side_basis_functions()

void RBEIMEvaluation::read_in_side_basis_functions ( const System sys,
const std::string &  directory_name,
bool  read_binary_basis_functions 
)
private

Method that reads in element side EIM basis functions.

This may be called by read_in_basis_functions().

Definition at line 1445 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::index_range(), n_vars, TIMPI::Communicator::rank(), libMesh::READ, and side_distribute_bfs().

Referenced by read_in_basis_functions().

1448 {
1449  LOG_SCOPE("read_in_basis_functions()", "RBEIMEvaluation");
1450 
1451  // Read values on processor 0 only.
1452  if (sys.comm().rank() == 0)
1453  {
1454  // Create filename
1455  std::ostringstream file_name;
1456  const std::string basis_function_suffix = (read_binary_basis_functions ? ".xdr" : ".dat");
1457  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1458 
1459  // Create XDR reader object
1460  Xdr xdr(file_name.str(), read_binary_basis_functions ? DECODE : READ);
1461 
1462  // Read in the number of basis functions. The comment parameter
1463  // is ignored when reading.
1464  std::size_t n_bf;
1465  xdr.data(n_bf);
1466 
1467  // Read in the number of elements
1468  std::size_t n_elem_side;
1469  xdr.data(n_elem_side);
1470 
1471  // Read in the number of variables.
1472  std::size_t n_vars;
1473  xdr.data(n_vars);
1474 
1475  std::vector<unsigned int> elem_ids(n_elem_side);
1476  xdr.data(elem_ids);
1477  std::vector<unsigned int> side_indices(n_elem_side);
1478  xdr.data(side_indices);
1479 
1480  // Read in vector containing the number of QPs per elem. We can
1481  // create this vector with the required size or let it be read
1482  // from the file and sized for us.
1483  std::vector<unsigned int> n_qp_per_elem_side(n_elem_side);
1484  xdr.data(n_qp_per_elem_side);
1485 
1486  // The total amount of qp data for each var is the sum of the
1487  // entries in the "n_qp_per_elem" array.
1488  auto n_qp_data =
1489  std::accumulate(n_qp_per_elem_side.begin(),
1490  n_qp_per_elem_side.end(),
1491  0u);
1492 
1493  // Allocate space to store all required basis functions,
1494  // clearing any data that may have been there previously.
1496  _local_side_eim_basis_functions.resize(n_bf);
1498  for (std::size_t elem_side_idx=0; elem_side_idx<n_elem_side; ++elem_side_idx)
1499  {
1500  unsigned int elem_id = elem_ids[elem_side_idx];
1501  unsigned int side_index = side_indices[elem_side_idx];
1502  auto elem_side_pair = std::make_pair(elem_id, side_index);
1503 
1504  auto & array = _local_side_eim_basis_functions[i][elem_side_pair];
1505  array.resize(n_vars);
1506  }
1507 
1508  // Allocate temporary storage for one var's worth of qp data.
1509  std::vector<Number> qp_data;
1510 
1511  // Read in data for each basis function
1513  {
1514  // Reference to the data map for the current basis function.
1515  auto & bf_map = _local_side_eim_basis_functions[i];
1516 
1517  for (std::size_t var=0; var<n_vars; ++var)
1518  {
1519  qp_data.clear();
1520  qp_data.resize(n_qp_data);
1521 
1522  // Read data using data_stream() since that is
1523  // (currently) how we write it out. The "line_break"
1524  // parameter of data_stream() is ignored while reading.
1525  xdr.data_stream(qp_data.data(), qp_data.size());
1526 
1527  // Iterate over the qp_data vector, filling in the
1528  // "small" vectors for each Elem.
1529  auto cursor = qp_data.begin();
1530  for (std::size_t elem_side_idx=0; elem_side_idx<n_elem_side; ++elem_side_idx)
1531  {
1532  unsigned int elem_id = elem_ids[elem_side_idx];
1533  unsigned int side_index = side_indices[elem_side_idx];
1534  auto elem_side_pair = std::make_pair(elem_id, side_index);
1535 
1536  // Get reference to the [n_vars][n_qp] array for
1537  // this Elem. We assign() into the vector of
1538  // quadrature point values, which allocates space if
1539  // it doesn't already exist.
1540  auto & array = bf_map[elem_side_pair];
1541  array[var].assign(cursor, cursor + n_qp_per_elem_side[elem_side_idx]);
1542  std::advance(cursor, n_qp_per_elem_side[elem_side_idx]);
1543  }
1544  } // end for (var)
1545  } // end for (i)
1546  } // end if processor 0
1547 
1548  // Distribute the basis function information to the processors that require it
1549  this->side_distribute_bfs(sys);
1550 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
void side_distribute_bfs(const System &sys)
Same as distribute_bfs() except for side data.
unsigned int n_vars
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ read_parameter_data_from_files()

void libMesh::RBParametrized::read_parameter_data_from_files ( const std::string &  continuous_param_file_name,
const std::string &  discrete_param_file_name,
const bool  read_binary_data 
)
inherited

Read in the parameter ranges from files.

Definition at line 274 of file rb_parametrized.C.

References libMesh::RBParametrized::initialize_parameters(), libMesh::RBParametrized::read_discrete_parameter_values_from_file(), and libMesh::RBParametrized::read_parameter_ranges_from_file().

Referenced by libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBEvaluation::legacy_read_offline_data_from_files().

277 {
278  RBParameters param_min;
279  RBParameters param_max;
280  read_parameter_ranges_from_file(continuous_param_file_name,
281  read_binary_data,
282  param_min,
283  param_max);
284 
285  std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
286  read_discrete_parameter_values_from_file(discrete_param_file_name,
287  read_binary_data,
288  discrete_parameter_values_in);
289 
290  initialize_parameters(param_min, param_max, discrete_parameter_values_in);
291 }
void read_parameter_ranges_from_file(const std::string &file_name, const bool read_binary, RBParameters &param_min, RBParameters &param_max)
Read in the parameter ranges from file.
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)
Read in the discrete parameter values from file, if we have any.
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.

◆ resize_data_structures()

void RBEIMEvaluation::resize_data_structures ( const unsigned int  Nmax)

Resize the data structures for storing data associated with this object.

Definition at line 74 of file rb_eim_evaluation.C.

References _interpolation_matrix, _interpolation_points_comp, _interpolation_points_spatial_indices, _vec_eval_input, libMesh::VectorizedEvalInput::all_xyz, libMesh::VectorizedEvalInput::clear(), and libMesh::DenseMatrix< T >::resize().

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), and libMesh::RBEIMConstruction::train_eim_approximation_with_POD().

75 {
76  // Resize the data structures relevant to the EIM system
78  _vec_eval_input.all_xyz.clear();
79 
82 
83  _interpolation_matrix.resize(Nmax,Nmax);
84 }
VectorizedEvalInput _vec_eval_input
We store the EIM interpolation point data in 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()...
std::vector< Point > all_xyz
The members that define the inputs to the vectorized evaluate functions.
void clear()
Clear all the members.
std::vector< unsigned int > _interpolation_points_comp
In the case of a "vector-valued" EIM, this vector determines which component of the parameterized fun...
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Definition: dense_matrix.h:895
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ scale_components_in_enrichment()

const std::set< unsigned int > & RBEIMEvaluation::scale_components_in_enrichment ( ) const

Get _scale_components_in_enrichment.

Definition at line 2965 of file rb_eim_evaluation.C.

References _scale_components_in_enrichment.

Referenced by libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), and libMesh::RBEIMConstruction::train_eim_approximation_with_POD().

2966 {
2968 }
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...

◆ set_eim_error_indicator_active()

void RBEIMEvaluation::set_eim_error_indicator_active ( bool  is_active)

Activate/decative the error indicator in EIM solves.

We need this option since in some cases (e.g. during EIM training) we do not want to activate the EIM error indicator, whereas in "online solves" we do want to activate it.

Definition at line 2977 of file rb_eim_evaluation.C.

References _is_eim_error_indicator_active, get_n_basis_functions(), get_n_interpolation_points(), libMesh::RBParametrized::get_n_params(), and use_eim_error_indicator().

Referenced by libMesh::RBEIMTheta::evaluate_vec().

2978 {
2979  // We skip setting _is_eim_error_indicator_active in the case that
2980  // we have no parameters, since we do not use the EIM error indicator
2981  // in that case. We also check if the number of interpolation points
2982  // is larger than the number of EIM basis functions, since that is
2983  // also always the case when the error indicator is active.
2986 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
unsigned int get_n_interpolation_points() const
Return the number of interpolation points.
bool _is_eim_error_indicator_active
Indicate if the EIM error indicator is active in RB EIM solves.
virtual bool use_eim_error_indicator() const
Virtual function to indicate if we use the EIM error indicator in this case.
unsigned int get_n_params() const
Get the number of parameters.

◆ set_error_indicator_interpolation_row()

void RBEIMEvaluation::set_error_indicator_interpolation_row ( const DenseVector< Number > &  error_indicator_row)

Definition at line 3044 of file rb_eim_evaluation.C.

References _error_indicator_interpolation_row.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), and libMesh::RBEIMConstruction::update_eim_matrices().

3045 {
3046  _error_indicator_interpolation_row = extra_point_row;
3047 }
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...

◆ set_interpolation_matrix_entry()

void RBEIMEvaluation::set_interpolation_matrix_entry ( unsigned int  i,
unsigned int  j,
Number  value 
)

Set entry of the EIM interpolation matrix.

Definition at line 870 of file rb_eim_evaluation.C.

References _interpolation_matrix, libMesh::DenseMatrixBase< T >::m(), libMesh::DenseMatrixBase< T >::n(), and value.

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), and libMesh::RBEIMConstruction::update_eim_matrices().

871 {
872  libmesh_error_msg_if((i >= _interpolation_matrix.m()) || (j >= _interpolation_matrix.n()),
873  "Error: Invalid matrix indices");
874 
876 }
unsigned int m() const
static const bool value
Definition: xdr_io.C:54
unsigned int n() const
DenseMatrix< Number > _interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.

◆ set_n_basis_functions()

void RBEIMEvaluation::set_n_basis_functions ( unsigned int  n_bfs)

Set the number of basis functions.

Useful when reading in stored data.

Definition at line 319 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, _local_node_eim_basis_functions, _local_side_eim_basis_functions, and get_parametrized_function().

Referenced by libMesh::RBDataDeserialization::load_rb_eim_evaluation_data().

320 {
321  if (get_parametrized_function().on_mesh_sides())
322  _local_side_eim_basis_functions.resize(n_bfs);
323  else if (get_parametrized_function().on_mesh_nodes())
324  _local_node_eim_basis_functions.resize(n_bfs);
325  else
326  _local_eim_basis_functions.resize(n_bfs);
327 }
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.

◆ set_parameters()

bool libMesh::RBParametrized::set_parameters ( const RBParameters params)
inherited

Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected.

We

Returns
a boolean true if the new parameters are within the min/max range, and false otherwise (but the parameters are set regardless). Enabling the "verbose_mode" flag will also print more details.

Definition at line 141 of file rb_parametrized.C.

References libMesh::RBParametrized::check_if_valid_params(), libMesh::RBParametrized::parameters, and libMesh::RBParametrized::parameters_initialized.

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBConstruction::get_RB_error_bound(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMEvaluation::reload_current_parameters(), libMesh::RBSCMEvaluation::set_current_parameters_from_C_J(), and RBParametersTest::testRBParametrized().

142 {
143  libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::set_parameters");
144 
145  // Terminate if params has the wrong number of parameters or samples.
146  // If the parameters are outside the min/max range, return false.
147  const bool valid_params = check_if_valid_params(params);
148 
149  // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
150  this->parameters = params;
151 
152  return valid_params;
153 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
bool check_if_valid_params(const RBParameters &params) const
Helper function to check that params is valid:
RBParameters parameters
Vector storing the current parameters.

◆ set_parametrized_function()

void RBEIMEvaluation::set_parametrized_function ( std::unique_ptr< RBParametrizedFunction pf)

Set the parametrized function that we will approximate using the Empirical Interpolation Method.

This object will take ownership of the unique pointer.

Definition at line 86 of file rb_eim_evaluation.C.

References _parametrized_function.

87 {
88  _parametrized_function = std::move(pf);
89 }
std::unique_ptr< RBParametrizedFunction > _parametrized_function
Store the parametrized function that will be approximated by this EIM system.

◆ set_preserve_rb_eim_solutions()

void RBEIMEvaluation::set_preserve_rb_eim_solutions ( bool  preserve_rb_eim_solutions)

Set _preserve_rb_eim_solutions.

Definition at line 883 of file rb_eim_evaluation.C.

References _preserve_rb_eim_solutions.

884 {
885  _preserve_rb_eim_solutions = preserve_rb_eim_solutions;
886 }
bool _preserve_rb_eim_solutions
Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves().

◆ set_rb_eim_solutions()

void RBEIMEvaluation::set_rb_eim_solutions ( const std::vector< DenseVector< Number >> &  rb_eim_solutions)

Set _rb_eim_solutions.

Normally we update _rb_eim_solutions by performing and EIM solve, but in some cases we want to set the EIM solution coefficients elsewhere, so this setter enables us to do that.

Definition at line 656 of file rb_eim_evaluation.C.

References _rb_eim_solutions.

657 {
658  _rb_eim_solutions = rb_eim_solutions;
659 }
std::vector< DenseVector< Number > > _rb_eim_solutions
The EIM solution coefficients from the most recent call to rb_eim_solves().

◆ side_decrement_vector()

void RBEIMEvaluation::side_decrement_vector ( SideQpDataMap v,
const DenseVector< Number > &  coeffs 
)

Same as decrement_vector() except for Side data.

Definition at line 355 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, get_n_basis_functions(), libMesh::index_range(), and libMesh::DenseVector< T >::size().

Referenced by libMesh::RBEIMConstruction::compute_max_eim_error(), and libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides().

357 {
358  LOG_SCOPE("side_decrement_vector()", "RBEIMEvaluation");
359 
360  libmesh_error_msg_if(get_n_basis_functions() != coeffs.size(),
361  "Error: Number of coefficients should match number of basis functions");
362 
363  for (auto & [elem_and_side, v_comp_and_qp] : v)
364  {
365  for (const auto & comp : index_range(v_comp_and_qp))
366  for (unsigned int qp : index_range(v_comp_and_qp[comp]))
367  for (unsigned int i : index_range(_local_side_eim_basis_functions))
368  {
369  // Check that entry (elem_and_side,comp,qp) exists in _local_side_eim_basis_functions so that
370  // we get a clear error message if there is any missing data
371  const auto & basis_comp_and_qp = libmesh_map_find(_local_side_eim_basis_functions[i], elem_and_side);
372 
373  libmesh_error_msg_if(comp >= basis_comp_and_qp.size(), "Error: Invalid comp");
374  libmesh_error_msg_if(qp >= basis_comp_and_qp[comp].size(), "Error: Invalid qp");
375 
376  v_comp_and_qp[comp][qp] -= coeffs(i) * basis_comp_and_qp[comp][qp];
377  }
378  }
379 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
virtual unsigned int size() const override final
Definition: dense_vector.h:104
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ side_distribute_bfs()

void RBEIMEvaluation::side_distribute_bfs ( const System sys)
private

Same as distribute_bfs() except for side data.

Definition at line 2326 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, TIMPI::Communicator::broadcast(), clear(), libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::System::get_mesh(), get_parametrized_function(), libMesh::RBParametrizedFunction::get_parametrized_function_boundary_ids(), libMesh::index_range(), libMesh::make_range(), mesh, n_vars, TIMPI::Communicator::rank(), TIMPI::Communicator::scatter(), and TIMPI::Communicator::size().

Referenced by read_in_side_basis_functions().

2327 {
2328  // So we can avoid calling these many times below
2329  auto n_procs = sys.comm().size();
2330  auto rank = sys.comm().rank();
2331 
2332  // In serial there's nothing to distribute
2333  if (n_procs == 1)
2334  return;
2335 
2336  // Broadcast the number of basis functions from proc 0. After
2337  // distributing, all procs should have the same number of basis
2338  // functions.
2339  auto n_bf = _local_side_eim_basis_functions.size();
2340  sys.comm().broadcast(n_bf);
2341 
2342  // Allocate enough space to store n_bf basis functions on non-zero ranks
2343  if (rank != 0)
2344  _local_side_eim_basis_functions.resize(n_bf);
2345 
2346  // Broadcast the number of variables from proc 0. After
2347  // distributing, all procs should have the same number of variables.
2348  auto n_vars = _local_side_eim_basis_functions[0].begin()->second.size();
2349  sys.comm().broadcast(n_vars);
2350 
2351  const std::set<boundary_id_type> & parametrized_function_boundary_ids =
2353 
2354  // Construct lists of elem ids owned by different processors
2355  const MeshBase & mesh = sys.get_mesh();
2356 
2357  // BoundaryInfo and related data structures
2358  const auto & binfo = mesh.get_boundary_info();
2359  std::vector<boundary_id_type> side_boundary_ids;
2360 
2361  std::vector<dof_id_type> gathered_local_elem_ids;
2362  std::vector<dof_id_type> gathered_local_side_indices;
2363  for (const auto & elem : mesh.active_local_element_ptr_range())
2364  {
2365  for (unsigned int side = 0; side != elem->n_sides(); ++side)
2366  {
2367  // skip non-boundary elements
2368  if (!elem->neighbor_ptr(side))
2369  {
2370  binfo.boundary_ids(elem, side, side_boundary_ids);
2371 
2372  bool has_side_boundary_id = false;
2373  for (boundary_id_type side_boundary_id : side_boundary_ids)
2374  if (parametrized_function_boundary_ids.count(side_boundary_id))
2375  {
2376  has_side_boundary_id = true;
2377  break;
2378  }
2379 
2380  if (has_side_boundary_id)
2381  {
2382  gathered_local_elem_ids.push_back(elem->id());
2383  gathered_local_side_indices.push_back(side);
2384  }
2385  }
2386  }
2387 
2388  // In the case of 2D elements, we also check the shellfaces
2389  if (elem->dim() == 2)
2390  for (unsigned int shellface_index=0; shellface_index<2; shellface_index++)
2391  {
2392  binfo.shellface_boundary_ids(elem, shellface_index, side_boundary_ids);
2393 
2394  bool has_side_boundary_id = false;
2395  for (boundary_id_type side_boundary_id : side_boundary_ids)
2396  if (parametrized_function_boundary_ids.count(side_boundary_id))
2397  {
2398  has_side_boundary_id = true;
2399  break;
2400  }
2401 
2402  if (has_side_boundary_id)
2403  {
2404  // We use shellface_index as the side_index since shellface boundary conditions
2405  // are stored separately from side boundary conditions in BoundaryInfo.
2406  gathered_local_elem_ids.push_back(elem->id());
2407  gathered_local_side_indices.push_back(shellface_index);
2408  }
2409  }
2410  }
2411 
2412  // Gather the number of local elems from all procs to proc 0
2413  auto n_local_elems = gathered_local_elem_ids.size();
2414  std::vector<std::size_t> gathered_n_local_elems = {n_local_elems};
2415  sys.comm().gather(/*root_id=*/0, gathered_n_local_elems);
2416 
2417  // Gather the (elem,side) owned by each processor onto processor 0.
2418  sys.comm().gather(/*root_id=*/0, gathered_local_elem_ids);
2419  sys.comm().gather(/*root_id=*/0, gathered_local_side_indices);
2420 
2421  // Construct vectors of "start" and "one-past-the-end" indices into
2422  // the gathered_local_elem_ids vector for each proc. Only valid on
2423  // processor 0.
2424  std::vector<std::size_t> start_elem_ids_index, end_elem_ids_index;
2425 
2426  if (rank == 0)
2427  {
2428  start_elem_ids_index.resize(n_procs);
2429  start_elem_ids_index[0] = 0;
2430  for (processor_id_type p=1; p<n_procs; ++p)
2431  start_elem_ids_index[p] = start_elem_ids_index[p-1] + gathered_n_local_elems[p-1];
2432 
2433  end_elem_ids_index.resize(n_procs);
2434  end_elem_ids_index[n_procs - 1] = gathered_local_elem_ids.size();
2435  for (processor_id_type p=0; p<n_procs - 1; ++p)
2436  end_elem_ids_index[p] = start_elem_ids_index[p+1];
2437  }
2438 
2439  // On processor 0, using basis function 0 and variable 0, prepare a
2440  // vector with the number of qps per Elem. Then scatter this vector
2441  // out to the processors that require it. The order of this vector
2442  // matches the gathered_local_elem_ids ordering. The counts will be
2443  // gathered_n_local_elems, since there will be one qp count per Elem.
2444  std::vector<unsigned int> n_qp_per_elem_data;
2445 
2446  // On rank 0, the "counts" vector holds the number of floating point values that
2447  // are to be scattered to each proc. It is only required on proc 0.
2448  std::vector<int> counts;
2449 
2450  if (rank == 0)
2451  {
2452  n_qp_per_elem_data.reserve(gathered_local_elem_ids.size());
2453  counts.resize(n_procs);
2454 
2455  auto & bf_map = _local_side_eim_basis_functions[0];
2456 
2457  for (processor_id_type p=0; p<n_procs; ++p)
2458  {
2459  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2460  {
2461  auto elem_id = gathered_local_elem_ids[e];
2462  auto side_index = gathered_local_side_indices[e];
2463 
2464  // Get reference to array[n_vars][n_qp] for current Elem.
2465  // Throws an error if the required elem_id is not found.
2466  const auto & array = libmesh_map_find(bf_map, std::make_pair(elem_id, side_index));
2467 
2468  auto n_qps = array[0].size();
2469 
2470  // We use var==0 to set the number of qps for all vars
2471  n_qp_per_elem_data.push_back(n_qps);
2472 
2473  // Accumulate the count for this proc
2474  counts[p] += n_qps;
2475  } // end for (e)
2476  } // end for proc_id
2477  } // if (rank == 0)
2478 
2479  // Now scatter the n_qp_per_elem_data to all procs (must call the
2480  // scatter on all procs, it is a collective).
2481  {
2482  std::vector<unsigned int> recv;
2483  std::vector<int> tmp(gathered_n_local_elems.begin(), gathered_n_local_elems.end());
2484  sys.comm().scatter(n_qp_per_elem_data, tmp, recv, /*root_id=*/0);
2485 
2486  // Now swap n_qp_per_elem_data and recv. All processors now have a
2487  // vector of length n_local_elems containing the number of
2488  // quadarature points per Elem.
2489  n_qp_per_elem_data.swap(recv);
2490  }
2491 
2492  // For each basis function and each variable, build a vector
2493  // of qp data in the Elem ordering given by the
2494  // gathered_local_elem_ids, then call
2495  //
2496  // sys.comm().scatter(data, counts, recv, /*root_id=*/0);
2497  std::vector<std::vector<Number>> qp_data(n_vars);
2498  if (rank == 0)
2499  {
2500  // The total amount of qp data is given by summing the entries
2501  // of the "counts" vector.
2502  auto n_qp_data =
2503  std::accumulate(counts.begin(), counts.end(), 0u);
2504 
2505  // On processor 0, reserve enough space to hold all the qp
2506  // data for a single basis function for each var.
2507  for (auto var : index_range(qp_data))
2508  qp_data[var].reserve(n_qp_data);
2509  }
2510 
2511  // The recv_qp_data vector will be used on the receiving end of all
2512  // the scatters below.
2513  std::vector<Number> recv_qp_data;
2514 
2515  // Loop from 0..n_bf on _all_ procs, since the scatters inside this
2516  // loop are collective.
2517  for (auto bf : make_range(n_bf))
2518  {
2519  // Prepare data for scattering (only on proc 0)
2520  if (rank == 0)
2521  {
2522  // Reference to the data map for the current basis function.
2523  auto & bf_map = _local_side_eim_basis_functions[bf];
2524 
2525  // Clear any data from previous bf
2526  for (auto var : index_range(qp_data))
2527  qp_data[var].clear();
2528 
2529  for (processor_id_type p=0; p<n_procs; ++p)
2530  {
2531  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2532  {
2533  auto elem_id = gathered_local_elem_ids[e];
2534  auto side_index = gathered_local_side_indices[e];
2535 
2536  // Get reference to array[n_vars][n_qp] for current Elem.
2537  // Throws an error if the required (elem,side) is not found.
2538  const auto & array = libmesh_map_find(bf_map, std::make_pair(elem_id, side_index));
2539 
2540  for (auto var : index_range(array))
2541  {
2542  // Insert all qp values for this var
2543  qp_data[var].insert(/*insert at*/qp_data[var].end(),
2544  /*data start*/array[var].begin(),
2545  /*data end*/array[var].end());
2546  } // end for (var)
2547  } // end for (e)
2548  } // end for proc_id
2549  } // end if rank==0
2550 
2551  // Perform the scatters (all procs)
2552  for (auto var : make_range(n_vars))
2553  {
2554  // Do the scatter for the current var
2555  sys.comm().scatter(qp_data[var], counts, recv_qp_data, /*root_id=*/0);
2556 
2557  if (rank != 0)
2558  {
2559  // Store the scattered data we received in _local_side_eim_basis_functions[bf]
2560  auto & bf_map = _local_side_eim_basis_functions[bf];
2561  auto cursor = recv_qp_data.begin();
2562 
2563  for (auto i : index_range(gathered_local_elem_ids))
2564  {
2565  auto elem_id = gathered_local_elem_ids[i];
2566  auto side_index = gathered_local_side_indices[i];
2567  auto n_qp_this_elem = n_qp_per_elem_data[i];
2568  auto & array = bf_map[std::make_pair(elem_id, side_index)];
2569 
2570  // Create space to store the data if it doesn't already exist.
2571  if (array.empty())
2572  array.resize(n_vars);
2573 
2574  array[var].assign(cursor, cursor + n_qp_this_elem);
2575  std::advance(cursor, n_qp_this_elem);
2576  }
2577  } // if (rank != 0)
2578  } // end for (var)
2579  } // end for (bf)
2580 
2581  // Now that the scattering is done, delete non-local Elem
2582  // information from processor 0's _local_side_eim_basis_functions data
2583  // structure.
2584  if (rank == 0)
2585  {
2586  for (processor_id_type p=1; p<n_procs; ++p)
2587  {
2588  for (auto e : make_range(start_elem_ids_index[p], end_elem_ids_index[p]))
2589  {
2590  auto elem_id = gathered_local_elem_ids[e];
2591  auto side_index = gathered_local_side_indices[e];
2592 
2593  // Delete this Elem's information from every basis function.
2594  for (auto & bf_map : _local_side_eim_basis_functions)
2595  bf_map.erase(std::make_pair(elem_id, side_index));
2596  } // end for (e)
2597  } // end for proc_id
2598  } // if (rank == 0)
2599 }
virtual void clear() override
Clear this object.
const std::set< boundary_id_type > & get_parametrized_function_boundary_ids() const
For RBParametrizedFunctions defined on element sides or nodes, we get/set the boundary IDs that this ...
MeshBase & mesh
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
uint8_t processor_id_type
int8_t boundary_id_type
Definition: id_types.h:51
unsigned int n_vars
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ side_gather_bfs()

void RBEIMEvaluation::side_gather_bfs ( )
private

Same as gather_bfs() except for side data.

Definition at line 1832 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, libMesh::ParallelObject::comm(), TIMPI::Communicator::gather(), libMesh::index_range(), TIMPI::Communicator::max(), libMesh::ParallelObject::n_processors(), n_vars, libMesh::ParallelObject::processor_id(), and TIMPI::Communicator::verify().

Referenced by write_out_side_basis_functions().

1833 {
1834  // We need to gather _local_side_eim_basis_functions data from other
1835  // procs for printing.
1836  //
1837  // Ideally, this could be accomplished by simply calling:
1838  // this->comm().gather(/*root_id=*/0, _local_side_eim_basis_functions);
1839  //
1840  // but the data structure seems to be too complicated for this to
1841  // work automatically. (I get some error about the function called
1842  // being "private within this context".) Therefore, we have to
1843  // gather the information manually.
1844 
1845  // So we can avoid calling this many times below
1846  auto n_procs = this->n_processors();
1847 
1848  // In serial there's nothing to gather
1849  if (n_procs == 1)
1850  return;
1851 
1852  // Current assumption is that the number of basis functions stored on
1853  // each processor is the same, the only thing that differs is the number
1854  // of elements, so make sure that is the case now.
1855  auto n_bf = _local_side_eim_basis_functions.size();
1856  this->comm().verify(n_bf);
1857 
1858  // This function should never be called if there are no basis
1859  // functions, so if it was, something went wrong.
1860  libmesh_error_msg_if(!n_bf, "SideRBEIMEvaluation::gather_bfs() should not be called with 0 basis functions.");
1861 
1862  // The number of variables should be the same on all processors
1863  // and we can get this from _local_side_eim_basis_functions. However,
1864  // it may be that some processors have no local elements, so on
1865  // those processors we cannot look up the size from
1866  // _local_side_eim_basis_functions. As a result we use comm().max(n_vars)
1867  // to make sure all processors agree on the final value.
1868  std::size_t n_vars =
1869  _local_side_eim_basis_functions[0].empty() ? 0 : _local_side_eim_basis_functions[0].begin()->second.size();
1870  this->comm().max(n_vars);
1871 
1872  // Gather list of (elem,side) pairs stored on each processor to proc 0. We
1873  // use basis function 0 as an example and assume all the basis
1874  // functions are distributed similarly.
1875  std::vector<std::pair<dof_id_type,unsigned int>> elem_side_pairs;
1876  elem_side_pairs.reserve(_local_side_eim_basis_functions[0].size());
1877  for (const auto & pr : _local_side_eim_basis_functions[0])
1878  elem_side_pairs.push_back(pr.first);
1879  this->comm().gather(/*root_id=*/0, elem_side_pairs);
1880 
1881  // Store the number of qps per Elem on this processor. Again, use
1882  // basis function 0 (and variable 0) to get this information, then
1883  // apply it to all basis functions.
1884  std::vector<unsigned int> n_qp_per_elem_side;
1885  n_qp_per_elem_side.reserve(_local_side_eim_basis_functions[0].size());
1886  for (const auto & pr : _local_side_eim_basis_functions[0])
1887  {
1888  // array[n_vars][n_qp] per (elem,side). We get the number of QPs
1889  // for variable 0, assuming they are all the same.
1890  const auto & array = pr.second;
1891  n_qp_per_elem_side.push_back(array[0].size());
1892  }
1893 
1894  // Before gathering, compute the total amount of local qp data for
1895  // each var, which is the sum of the entries in the "n_qp_per_elem_side" array.
1896  // This will be used to reserve space in a vector below.
1897  auto n_local_qp_data =
1898  std::accumulate(n_qp_per_elem_side.begin(),
1899  n_qp_per_elem_side.end(),
1900  0u);
1901 
1902  // Gather the number of qps per Elem for each processor onto processor 0.
1903  this->comm().gather(/*root_id=*/0, n_qp_per_elem_side);
1904 
1905  // Sanity check: On processor 0, this checks that we have gathered the same number
1906  // of (elem,side) pairs and qp counts.
1907  libmesh_error_msg_if(elem_side_pairs.size() != n_qp_per_elem_side.size(),
1908  "Must gather same number of Elem ids as qps per Elem.");
1909 
1910  // Reserve space to store contiguous vectors of qp data for each var
1911  std::vector<std::vector<Number>> gathered_qp_data(n_vars);
1912  for (auto var : index_range(gathered_qp_data))
1913  gathered_qp_data[var].reserve(n_local_qp_data);
1914 
1915  // Now we construct a vector for each basis function, for each
1916  // variable, which is ordered according to:
1917  // [ [qp vals for Elem 0], [qp vals for Elem 1], ... [qp vals for Elem N] ]
1918  // and gather it to processor 0.
1920  {
1921  // Clear any data from previous bf
1922  for (auto var : index_range(gathered_qp_data))
1923  gathered_qp_data[var].clear();
1924 
1925  for (const auto & pr : _local_side_eim_basis_functions[bf])
1926  {
1927  // array[n_vars][n_qp] per (elem,side) pair
1928  const auto & array = pr.second;
1929  for (auto var : index_range(array))
1930  {
1931  // Insert all qp values for this var
1932  gathered_qp_data[var].insert(/*insert at*/gathered_qp_data[var].end(),
1933  /*data start*/array[var].begin(),
1934  /*data end*/array[var].end());
1935  }
1936  }
1937 
1938  // Reference to the data map for the current basis function.
1939  auto & bf_map = _local_side_eim_basis_functions[bf];
1940 
1941  for (auto var : index_range(gathered_qp_data))
1942  {
1943  // For each var, gather gathered_qp_data[var] onto processor
1944  // 0. There apparently is not a gather overload for
1945  // vector-of-vectors...
1946  this->comm().gather(/*root_id=*/0, gathered_qp_data[var]);
1947 
1948  // On processor 0, iterate over the gathered_qp_data[var]
1949  // vector we just gathered, filling in the "small" vectors
1950  // for each Elem. Note: here we ignore the fact that we
1951  // already have the data on processor 0 and just overwrite
1952  // it, this makes the indexing logic a bit simpler.
1953  if (this->processor_id() == 0)
1954  {
1955  auto cursor = gathered_qp_data[var].begin();
1956  for (auto i : index_range(elem_side_pairs))
1957  {
1958  auto elem_side_pair = elem_side_pairs[i];
1959  auto n_qp_this_elem_side = n_qp_per_elem_side[i];
1960 
1961  // Get reference to the [n_vars][n_qp] array for
1962  // this Elem. We assign() into the vector of
1963  // quadrature point values, which allocates space if
1964  // it doesn't already exist.
1965  auto & array = bf_map[elem_side_pair];
1966 
1967  // Possibly allocate space if this is data for a new
1968  // element we haven't seen before.
1969  if (array.empty())
1970  array.resize(n_vars);
1971 
1972  array[var].assign(cursor, cursor + n_qp_this_elem_side);
1973  std::advance(cursor, n_qp_this_elem_side);
1974  }
1975  }
1976  }
1977  } // end loop over basis functions
1978 }
bool verify(const T &r) const
void gather(const unsigned int root_id, const T &send_data, std::vector< T, A > &recv) const
const Parallel::Communicator & comm() const
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
processor_id_type n_processors() const
unsigned int n_vars
void max(const T &r, T &o, Request &req) const
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ use_eim_error_indicator()

bool RBEIMEvaluation::use_eim_error_indicator ( ) const
virtual

Virtual function to indicate if we use the EIM error indicator in this case.

This indicates if we will generate the data during the Offline training for the EIM error indicator. In EIM solves, the error indicator will only be used if set_eim_error_indicator_active() is set to true, since we want to be able to enable or disable the error indicator depending on the type of solve we are doing (e.g. EIM solves during training do not need the error indicator).

Definition at line 2970 of file rb_eim_evaluation.C.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBEIMConstruction::reinit_eim_projection_matrix(), set_eim_error_indicator_active(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), and libMesh::RBEIMConstruction::train_eim_approximation_with_POD().

2971 {
2972  // Return false by default, but we override this in subclasses
2973  // for cases where we want to use the error indicator.
2974  return false;
2975 }

◆ write_out_basis_functions()

void RBEIMEvaluation::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.

sys is used for file IO directory_name specifies which directory to write files to read_binary_basis_functions indicates whether to write binary or ASCII data

Note: this is not currently a virtual function and is not related to the RBEvaluation function of the same name.

Definition at line 988 of file rb_eim_evaluation.C.

References get_parametrized_function(), write_out_interior_basis_functions(), write_out_node_basis_functions(), and write_out_side_basis_functions().

990 {
991  LOG_SCOPE("write_out_basis_functions()", "RBEIMEvaluation");
992 
993  if (get_parametrized_function().on_mesh_sides())
994  write_out_side_basis_functions(directory_name, write_binary_basis_functions);
995  else if (get_parametrized_function().on_mesh_nodes())
996  write_out_node_basis_functions(directory_name, write_binary_basis_functions);
997  else
998  write_out_interior_basis_functions(directory_name, write_binary_basis_functions);
999 }
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.
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.
RBParametrizedFunction & get_parametrized_function()
Get a reference to the parametrized function.
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.

◆ write_out_interior_basis_functions()

void RBEIMEvaluation::write_out_interior_basis_functions ( const std::string &  directory_name,
bool  write_binary_basis_functions 
)
private

Method that writes out element interior EIM basis functions.

This may be called by write_out_basis_functions().

Definition at line 1002 of file rb_eim_evaluation.C.

References _local_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::ENCODE, gather_bfs(), libMesh::index_range(), libMesh::Utility::mkdir(), libMesh::MeshTools::n_elem(), n_vars, libMesh::ParallelObject::processor_id(), TIMPI::Communicator::verify(), and libMesh::WRITE.

Referenced by write_out_basis_functions().

1004 {
1005  LOG_SCOPE("write_out_interior_basis_functions()", "RBEIMEvaluation");
1006 
1007  // Quick return if there is no work to do. Note: make sure all procs
1008  // agree there is no work to do.
1009  bool is_empty = _local_eim_basis_functions.empty();
1010  this->comm().verify(is_empty);
1011 
1012  if (is_empty)
1013  return;
1014 
1015  // Gather basis function data from other procs, storing it in
1016  // _local_eim_basis_functions, so that we can then print everything
1017  // from processor 0.
1018  this->gather_bfs();
1019 
1020  // Write values from processor 0 only.
1021  if (this->processor_id() == 0)
1022  {
1023  // Make a directory to store all the data files
1024  Utility::mkdir(directory_name.c_str());
1025 
1026  // Create filename
1027  std::ostringstream file_name;
1028  const std::string basis_function_suffix = (write_binary_basis_functions ? ".xdr" : ".dat");
1029  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1030 
1031  // Create XDR writer object
1032  Xdr xdr(file_name.str(), write_binary_basis_functions ? ENCODE : WRITE);
1033 
1034  // Write number of basis functions to file. Note: the
1035  // Xdr::data() function takes non-const references, so you can't
1036  // pass e.g. vec.size() to that interface.
1037  auto n_bf = _local_eim_basis_functions.size();
1038  xdr.data(n_bf, "# Number of basis functions");
1039 
1040  // We assume that each basis function has data for the same
1041  // number of elements as basis function 0, which is equal to the
1042  // size of the map.
1043  auto n_elem = _local_eim_basis_functions[0].size();
1044  xdr.data(n_elem, "# Number of elements");
1045 
1046  // We assume that each element has the same number of variables,
1047  // and we get the number of vars from the first element of the
1048  // first basis function.
1049  auto n_vars = _local_eim_basis_functions[0].begin()->second.size();
1050  xdr.data(n_vars, "# Number of variables");
1051 
1052  // We assume that the list of elements for each basis function
1053  // is the same as basis function 0. We also assume that all vars
1054  // have the same number of qps.
1055  std::vector<unsigned int> n_qp_per_elem;
1056  n_qp_per_elem.reserve(n_elem);
1057  dof_id_type expected_elem_id = 0;
1058  for (const auto & [actual_elem_id, array] : _local_eim_basis_functions[0])
1059  {
1060  // Note: Currently we require that the Elems are numbered
1061  // contiguously from [0..n_elem). This allows us to avoid
1062  // writing the Elem ids to the Xdr file, but if we need to
1063  // generalize this assumption later, we can.
1064  libmesh_error_msg_if(actual_elem_id != expected_elem_id++,
1065  "RBEIMEvaluation currently assumes a contiguous Elem numbering starting from 0.");
1066 
1067  // array[n_vars][n_qp] per Elem. We get the number of QPs
1068  // for variable 0, assuming they are all the same.
1069  n_qp_per_elem.push_back(array[0].size());
1070  }
1071  xdr.data(n_qp_per_elem, "# Number of QPs per Elem");
1072 
1073  // The total amount of qp data for each var is the sum of the
1074  // entries in the "n_qp_per_elem" array.
1075  auto n_qp_data =
1076  std::accumulate(n_qp_per_elem.begin(),
1077  n_qp_per_elem.end(),
1078  0u);
1079 
1080  // Reserve space to store contiguous vectors of qp data for each var
1081  std::vector<std::vector<Number>> qp_data(n_vars);
1082  for (auto var : index_range(qp_data))
1083  qp_data[var].reserve(n_qp_data);
1084 
1085  // Now we construct a vector for each basis function, for each
1086  // variable which is ordered according to:
1087  // [ [qp vals for Elem 0], [qp vals for Elem 1], ... [qp vals for Elem N] ]
1088  // and write it to file.
1089  for (auto bf : index_range(_local_eim_basis_functions))
1090  {
1091  // Clear any data from previous bf
1092  for (auto var : index_range(qp_data))
1093  qp_data[var].clear();
1094 
1095  for (const auto & pr : _local_eim_basis_functions[bf])
1096  {
1097  // array[n_vars][n_qp] per Elem
1098  const auto & array = pr.second;
1099  for (auto var : index_range(array))
1100  {
1101  // Insert all qp values for this var
1102  qp_data[var].insert(/*insert at*/qp_data[var].end(),
1103  /*data start*/array[var].begin(),
1104  /*data end*/array[var].end());
1105  }
1106  }
1107 
1108  // Write all the var values for this bf
1109  for (auto var : index_range(qp_data))
1110  xdr.data_stream(qp_data[var].data(), qp_data[var].size(), /*line_break=*/qp_data[var].size());
1111  }
1112  }
1113 }
bool verify(const T &r) const
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:850
const Parallel::Communicator & comm() const
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:144
unsigned int n_vars
std::vector< QpDataMap > _local_eim_basis_functions
The EIM basis functions.
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111
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...

◆ write_out_node_basis_functions()

void RBEIMEvaluation::write_out_node_basis_functions ( const std::string &  directory_name,
bool  write_binary_basis_functions 
)
private

Method that writes out element node EIM basis functions.

This may be called by write_out_basis_functions().

Definition at line 1232 of file rb_eim_evaluation.C.

References _local_node_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::ENCODE, libMesh::index_range(), libMesh::Utility::mkdir(), n_vars, node_gather_bfs(), libMesh::ParallelObject::processor_id(), TIMPI::Communicator::verify(), and libMesh::WRITE.

Referenced by write_out_basis_functions().

1234 {
1235  LOG_SCOPE("write_out_node_basis_functions()", "RBEIMEvaluation");
1236 
1237  // Quick return if there is no work to do. Note: make sure all procs
1238  // agree there is no work to do.
1239  bool is_empty = _local_node_eim_basis_functions.empty();
1240  this->comm().verify(is_empty);
1241 
1242  if (is_empty)
1243  return;
1244 
1245  // Gather basis function data from other procs, storing it in
1246  // _local_node_eim_basis_functions, so that we can then print everything
1247  // from processor 0.
1248  this->node_gather_bfs();
1249 
1250  // Write values from processor 0 only.
1251  if (this->processor_id() == 0)
1252  {
1253  // Make a directory to store all the data files
1254  Utility::mkdir(directory_name.c_str());
1255 
1256  // Create filename
1257  std::ostringstream file_name;
1258  const std::string basis_function_suffix = (write_binary_basis_functions ? ".xdr" : ".dat");
1259  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1260 
1261  // Create XDR writer object
1262  Xdr xdr(file_name.str(), write_binary_basis_functions ? ENCODE : WRITE);
1263 
1264  // Write number of basis functions to file. Note: the
1265  // Xdr::data() function takes non-const references, so you can't
1266  // pass e.g. vec.size() to that interface.
1267  auto n_bf = _local_node_eim_basis_functions.size();
1268  xdr.data(n_bf, "# Number of basis functions");
1269 
1270  // We assume that each basis function has data for the same
1271  // number of elements as basis function 0, which is equal to the
1272  // size of the map.
1273  auto n_node = _local_node_eim_basis_functions[0].size();
1274  xdr.data(n_node, "# Number of nodes");
1275 
1276  // We assume that each element has the same number of variables,
1277  // and we get the number of vars from the first element of the
1278  // first basis function.
1279  auto n_vars = _local_node_eim_basis_functions[0].begin()->second.size();
1280  xdr.data(n_vars, "# Number of variables");
1281 
1282  // We write out the following arrays:
1283  // - node IDs
1284  std::vector<unsigned int> node_ids;
1285  node_ids.reserve(n_node);
1286  for (const auto & pr : _local_node_eim_basis_functions[0])
1287  {
1288  node_ids.push_back(pr.first);
1289  }
1290  xdr.data(node_ids, "# Node IDs");
1291 
1292  // Now we construct a vector for each basis function, for each
1293  // variable which is ordered according to:
1294  // [ [val for Node 0], [val for Node 1], ... [val for Node N] ]
1295  // and write it to file.
1296 
1297  std::vector<std::vector<Number>> var_data(n_vars);
1298  for (unsigned int var=0; var<n_vars; var++)
1299  var_data[var].resize(n_node);
1300 
1302  {
1303  unsigned int node_counter = 0;
1304  for (const auto & pr : _local_node_eim_basis_functions[bf])
1305  {
1306  // array[n_vars] per Node
1307  const auto & array = pr.second;
1308  for (auto var : index_range(array))
1309  {
1310  // Based on the error check above, we know that node_id is numbered
1311  // contiguously from [0..nodes], so we can use it as the vector
1312  // index here.
1313  var_data[var][node_counter] = array[var];
1314  }
1315 
1316  node_counter++;
1317  }
1318 
1319  // Write all the var values for this bf
1320  for (auto var : index_range(var_data))
1321  xdr.data_stream(var_data[var].data(), var_data[var].size(), /*line_break=*/var_data[var].size());
1322  }
1323  }
1324 }
bool verify(const T &r) const
const Parallel::Communicator & comm() const
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:144
std::vector< NodeDataMap > _local_node_eim_basis_functions
The EIM basis functions on element nodes (e.g.
unsigned int n_vars
void node_gather_bfs()
Same as gather_bfs() except for node data.
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ write_out_projected_basis_functions()

void RBEIMEvaluation::write_out_projected_basis_functions ( EquationSystems es,
const std::string &  directory_name = "offline_data" 
)

Project all basis functions using project_qp_data_map_onto_system() and then write out the resulting vectors.

Definition at line 2926 of file rb_eim_evaluation.C.

References get_basis_function(), get_eim_vars_to_project_and_write(), get_n_basis_functions(), libMesh::EquationSystems::get_system(), libMesh::index_range(), libMesh::make_range(), project_qp_data_map_onto_system(), libMesh::System::solution, and libMesh::RBEvaluation::write_out_vectors().

2928 {
2929  if (get_eim_vars_to_project_and_write().empty())
2930  return;
2931 
2932  unsigned int var_group_idx = 0;
2933  for (const auto & eim_vargroup : get_eim_vars_to_project_and_write())
2934  {
2935  std::vector<std::unique_ptr<NumericVector<Number>>> projected_bfs;
2936 
2937  const auto & sys_name = eim_vargroup.eim_sys_name;
2938  System & sys = es.get_system(sys_name);
2939 
2940  for (unsigned int bf_index : make_range(get_n_basis_functions()))
2941  {
2943  sys,
2944  get_basis_function(bf_index),
2945  eim_vargroup);
2946 
2947  projected_bfs.emplace_back(sys.solution->clone());
2948  }
2949 
2950  // Create projected_bfs_ptrs so that we can call RBEvaluation::write_out_vectors()
2951  std::vector<NumericVector<Number>*> projected_bfs_ptrs(projected_bfs.size());
2952  for (unsigned int i : index_range(projected_bfs))
2953  {
2954  projected_bfs_ptrs[i] = projected_bfs[i].get();
2955  }
2956 
2958  projected_bfs_ptrs,
2959  directory_name,
2960  "projected_bf_vargroup_" + std::to_string(var_group_idx));
2961  var_group_idx++;
2962  }
2963 }
unsigned int get_n_basis_functions() const
Return the current number of EIM basis functions.
virtual void project_qp_data_map_onto_system(System &sys, const QpDataMap &bf_data, const EIMVarGroupPlottingInfo &eim_vargroup)
Project the specified variable of bf_data into the solution vector of System.
static void write_out_vectors(System &sys, std::vector< NumericVector< Number > *> &vectors, const std::string &directory_name="offline_data", const std::string &data_name="bf", const bool write_binary_basis_functions=true)
Same as write_out_basis_functions, except in this case we pass in the vectors to be written...
const QpDataMap & get_basis_function(unsigned int i) const
Get a reference to the i^th basis function.
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition: int_range.h:134
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111
const std::vector< EIMVarGroupPlottingInfo > & get_eim_vars_to_project_and_write() const
Get _eim_vars_to_project_and_write.

◆ write_out_side_basis_functions()

void RBEIMEvaluation::write_out_side_basis_functions ( const std::string &  directory_name,
bool  write_binary_basis_functions 
)
private

Method that writes out element side EIM basis functions.

This may be called by write_out_basis_functions().

Definition at line 1116 of file rb_eim_evaluation.C.

References _local_side_eim_basis_functions, libMesh::ParallelObject::comm(), libMesh::ENCODE, libMesh::index_range(), libMesh::Utility::mkdir(), libMesh::MeshTools::n_elem(), n_vars, libMesh::ParallelObject::processor_id(), side_gather_bfs(), TIMPI::Communicator::verify(), and libMesh::WRITE.

Referenced by write_out_basis_functions().

1118 {
1119  LOG_SCOPE("write_out_side_basis_functions()", "RBEIMEvaluation");
1120 
1121  // Quick return if there is no work to do. Note: make sure all procs
1122  // agree there is no work to do.
1123  bool is_empty = _local_side_eim_basis_functions.empty();
1124  this->comm().verify(is_empty);
1125 
1126  if (is_empty)
1127  return;
1128 
1129  // Gather basis function data from other procs, storing it in
1130  // _local_side_eim_basis_functions, so that we can then print everything
1131  // from processor 0.
1132  this->side_gather_bfs();
1133 
1134  // Write values from processor 0 only.
1135  if (this->processor_id() == 0)
1136  {
1137  // Make a directory to store all the data files
1138  Utility::mkdir(directory_name.c_str());
1139 
1140  // Create filename
1141  std::ostringstream file_name;
1142  const std::string basis_function_suffix = (write_binary_basis_functions ? ".xdr" : ".dat");
1143  file_name << directory_name << "/" << "bf_data" << basis_function_suffix;
1144 
1145  // Create XDR writer object
1146  Xdr xdr(file_name.str(), write_binary_basis_functions ? ENCODE : WRITE);
1147 
1148  // Write number of basis functions to file. Note: the
1149  // Xdr::data() function takes non-const references, so you can't
1150  // pass e.g. vec.size() to that interface.
1151  auto n_bf = _local_side_eim_basis_functions.size();
1152  xdr.data(n_bf, "# Number of basis functions");
1153 
1154  // We assume that each basis function has data for the same
1155  // number of (elem,side) pairs as basis function 0, which is equal to the
1156  // size of the map.
1157  auto n_elem = _local_side_eim_basis_functions[0].size();
1158  xdr.data(n_elem, "# Number of (elem,side) pairs");
1159 
1160  // We assume that each element has the same number of variables,
1161  // and we get the number of vars from the first element of the
1162  // first basis function.
1163  auto n_vars = _local_side_eim_basis_functions[0].begin()->second.size();
1164  xdr.data(n_vars, "# Number of variables");
1165 
1166  // We write out the following arrays:
1167  // - element IDs
1168  // - side indices
1169  // - n_qp_per_elem_side
1170  std::vector<unsigned int> n_qp_per_elem_side;
1171  std::vector<unsigned int> elem_ids;
1172  std::vector<unsigned int> side_indices;
1173  elem_ids.reserve(n_elem);
1174  side_indices.reserve(n_elem);
1175  n_qp_per_elem_side.reserve(n_elem);
1176  for (const auto & [elem_side_pair, array] : _local_side_eim_basis_functions[0])
1177  {
1178  elem_ids.push_back(elem_side_pair.first);
1179  side_indices.push_back(elem_side_pair.second);
1180 
1181  // array[n_vars][n_qp] per Elem. We get the number of QPs
1182  // for variable 0, assuming they are all the same.
1183  n_qp_per_elem_side.push_back(array[0].size());
1184  }
1185  xdr.data(elem_ids, "# Elem IDs");
1186  xdr.data(side_indices, "# Side indices");
1187  xdr.data(n_qp_per_elem_side, "# Number of QPs per Elem");
1188 
1189  // The total amount of qp data for each var is the sum of the
1190  // entries in the "n_qp_per_elem" array.
1191  auto n_qp_data =
1192  std::accumulate(n_qp_per_elem_side.begin(),
1193  n_qp_per_elem_side.end(),
1194  0u);
1195 
1196  // Reserve space to store contiguous vectors of qp data for each var
1197  std::vector<std::vector<Number>> qp_data(n_vars);
1198  for (auto var : index_range(qp_data))
1199  qp_data[var].reserve(n_qp_data);
1200 
1201  // Now we construct a vector for each basis function, for each
1202  // variable which is ordered according to:
1203  // [ [qp vals for Elem 0], [qp vals for Elem 1], ... [qp vals for Elem N] ]
1204  // and write it to file.
1206  {
1207  // Clear any data from previous bf
1208  for (auto var : index_range(qp_data))
1209  qp_data[var].clear();
1210 
1211  for (const auto & pr : _local_side_eim_basis_functions[bf])
1212  {
1213  // array[n_vars][n_qp] per Elem
1214  const auto & array = pr.second;
1215  for (auto var : index_range(array))
1216  {
1217  // Insert all qp values for this var
1218  qp_data[var].insert(/*insert at*/qp_data[var].end(),
1219  /*data start*/array[var].begin(),
1220  /*data end*/array[var].end());
1221  }
1222  }
1223 
1224  // Write all the var values for this bf
1225  for (auto var : index_range(qp_data))
1226  xdr.data_stream(qp_data[var].data(), qp_data[var].size(), /*line_break=*/qp_data[var].size());
1227  }
1228  }
1229 }
bool verify(const T &r) const
dof_id_type n_elem(const MeshBase::const_element_iterator &begin, const MeshBase::const_element_iterator &end)
Count up the number of elements of a specific type (as defined by an iterator range).
Definition: mesh_tools.C:850
const Parallel::Communicator & comm() const
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:144
std::vector< SideQpDataMap > _local_side_eim_basis_functions
The EIM basis functions on element sides.
void side_gather_bfs()
Same as gather_bfs() except for side data.
unsigned int n_vars
processor_id_type processor_id() const
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ write_parameter_data_to_files()

void libMesh::RBParametrized::write_parameter_data_to_files ( const std::string &  continuous_param_file_name,
const std::string &  discrete_param_file_name,
const bool  write_binary_data 
)
inherited

Write out the parameter ranges to files.

Definition at line 197 of file rb_parametrized.C.

References libMesh::RBParametrized::write_discrete_parameter_values_to_file(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

Referenced by libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), and libMesh::RBEvaluation::legacy_write_offline_data_to_files().

200 {
201  write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
202  write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
203 }
void write_discrete_parameter_values_to_file(const std::string &file_name, const bool write_binary_data)
Write out the discrete parameter values to file.
void write_parameter_ranges_to_file(const std::string &file_name, const bool write_binary)
Write out the parameter ranges to file.

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _counts

ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited

Actually holds the data.

Definition at line 124 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::get_info().

◆ _eim_solutions_for_training_set

std::vector<DenseVector<Number> > libMesh::RBEIMEvaluation::_eim_solutions_for_training_set
private

Storage for EIM solutions from the training set.

This is typically used in the case that we have is_lookup_table==true in our RBParametrizedFunction, since in that case we need to store all the EIM solutions on the training set so that we do not always need to refer to the lookup table itself (since in some cases, like in the Online stage, the lookup table is not available).

Definition at line 730 of file rb_eim_evaluation.h.

Referenced by get_eim_solutions_for_training_set(), and rb_eim_solves().

◆ _eim_vars_to_project_and_write

std::vector<EIMVarGroupPlottingInfo> libMesh::RBEIMEvaluation::_eim_vars_to_project_and_write
protected

This vector specifies which EIM variables will be projected and written out in write_out_projected_basis_functions().

By default this is an empty set, but can be updated in subclasses to specify the EIM variables that are relevant for visualization.

We identify groups of variables with one or more variables in a group. The purpose of using a group is often we plot multiple components of a tensor-valued or vector-valued quantity, so it makes sense to refer to the entire group of variables together in those cases.

Definition at line 651 of file rb_eim_evaluation.h.

Referenced by get_eim_vars_to_project_and_write().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

Flag to control whether reference count information is printed when print_info is called.

Definition at line 143 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().

◆ _error_indicator_interpolation_row

DenseVector<Number> libMesh::RBEIMEvaluation::_error_indicator_interpolation_row
private

Here we store an extra row of the interpolation matrix which is used to compute the EIM error indicator.

This stores the EIM basis function values at the extra point associated with the error indicator.

Definition at line 873 of file rb_eim_evaluation.h.

Referenced by get_eim_error_indicator(), get_error_indicator_interpolation_row(), and set_error_indicator_interpolation_row().

◆ _interpolation_matrix

DenseMatrix<Number> libMesh::RBEIMEvaluation::_interpolation_matrix
private

Dense matrix that stores the lower triangular interpolation matrix that can be used.

Definition at line 745 of file rb_eim_evaluation.h.

Referenced by clear(), get_interpolation_matrix(), rb_eim_solve(), rb_eim_solves(), resize_data_structures(), and set_interpolation_matrix_entry().

◆ _interpolation_points_comp

std::vector<unsigned int> libMesh::RBEIMEvaluation::_interpolation_points_comp
private

In the case of a "vector-valued" EIM, this vector determines which component of the parameterized function we sample at each EIM point.

Definition at line 756 of file rb_eim_evaluation.h.

Referenced by add_interpolation_data(), add_interpolation_points_comp(), add_node_interpolation_data(), add_side_interpolation_data(), clear(), get_interpolation_points_comp(), rb_eim_solves(), and resize_data_structures().

◆ _interpolation_points_spatial_indices

std::vector<std::vector<unsigned int> > libMesh::RBEIMEvaluation::_interpolation_points_spatial_indices
private

Here we store the spatial indices that were initialized by initialize_spatial_indices_at_interp_pts().

These are relevant in the case that _parametrized_function is defined by indexing into separate data based on the mesh-based data.

Definition at line 764 of file rb_eim_evaluation.h.

Referenced by add_interpolation_points_spatial_indices(), clear(), get_interpolation_points_spatial_indices(), get_n_interpolation_points_spatial_indices(), initialize_interpolation_points_spatial_indices(), initialize_param_fn_spatial_indices(), and resize_data_structures().

◆ _is_eim_error_indicator_active

bool libMesh::RBEIMEvaluation::_is_eim_error_indicator_active
private

Indicate if the EIM error indicator is active in RB EIM solves.

Note that this is distinct from use_eim_error_indicator(), since use_eim_error_indicator() indicates if this RBEIMEvaluation has an EIM error indicator defined, whereas _is_eim_error_indicator_active is used to turn on or off the error indicator. This primary purpose of _is_eim_error_indicator_active is to turn the error indicator off during EIM training (when it is not relevant) and to turn it on during "online solves".

Definition at line 866 of file rb_eim_evaluation.h.

Referenced by rb_eim_solves(), and set_eim_error_indicator_active().

◆ _local_eim_basis_functions

std::vector<QpDataMap> libMesh::RBEIMEvaluation::_local_eim_basis_functions
private

The EIM basis functions.

We store values at quadrature points on elements that are local to this processor. The indexing is as follows: basis function index –> element ID –> variable –> quadrature point –> value We use a map to index the element ID, since the IDs on this processor in general will not start at zero.

Definition at line 788 of file rb_eim_evaluation.h.

Referenced by add_basis_function(), decrement_vector(), distribute_bfs(), gather_bfs(), get_basis_function(), get_eim_basis_function_value(), get_eim_basis_function_values_at_qps(), get_n_basis_functions(), print_local_eim_basis_functions(), read_in_interior_basis_functions(), set_n_basis_functions(), and write_out_interior_basis_functions().

◆ _local_node_eim_basis_functions

std::vector<NodeDataMap> libMesh::RBEIMEvaluation::_local_node_eim_basis_functions
private

The EIM basis functions on element nodes (e.g.

on a nodeset). We store values at nodes that are local to this processor. The indexing is as follows: basis function index –> node ID –> variable –> value We use a map to index the node ID, since the IDs on this processor in general will not start at zero.

Definition at line 808 of file rb_eim_evaluation.h.

Referenced by add_node_basis_function(), get_eim_basis_function_node_local_value(), get_eim_basis_function_node_value(), get_n_basis_functions(), get_node_basis_function(), node_decrement_vector(), node_distribute_bfs(), node_gather_bfs(), print_local_eim_basis_functions(), read_in_node_basis_functions(), set_n_basis_functions(), and write_out_node_basis_functions().

◆ _local_side_eim_basis_functions

std::vector<SideQpDataMap> libMesh::RBEIMEvaluation::_local_side_eim_basis_functions
private

The EIM basis functions on element sides.

We store values at quadrature points on elements that are local to this processor. The indexing is as follows: basis function index –> (element ID,side index) –> variable –> quadrature point –> value We use a map to index the element ID, since the IDs on this processor in general will not start at zero.

Definition at line 798 of file rb_eim_evaluation.h.

Referenced by add_side_basis_function(), get_eim_basis_function_side_value(), get_eim_basis_function_side_values_at_qps(), get_n_basis_functions(), get_side_basis_function(), print_local_eim_basis_functions(), read_in_side_basis_functions(), set_n_basis_functions(), side_decrement_vector(), side_distribute_bfs(), side_gather_bfs(), and write_out_side_basis_functions().

◆ _mutex

Threads::spin_mutex libMesh::ReferenceCounter::_mutex
staticprotectedinherited

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
staticprotectedinherited

The number of objects.

Print the reference count information when the number returns to 0.

Definition at line 132 of file reference_counter.h.

Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().

◆ _parametrized_function

std::unique_ptr<RBParametrizedFunction> libMesh::RBEIMEvaluation::_parametrized_function
private

Store the parametrized function that will be approximated by this EIM system.

Note that the parametrized function may have more than one component, and each component is approximated by a separate variable in the EIM system.

Definition at line 772 of file rb_eim_evaluation.h.

Referenced by get_parametrized_function(), and set_parametrized_function().

◆ _preserve_rb_eim_solutions

bool libMesh::RBEIMEvaluation::_preserve_rb_eim_solutions
private

Boolean to indicate if we skip updating _rb_eim_solutions in rb_eim_solves().

This is relevant for cases when we set up _rb_eim_solutions elsewhere and we want to avoid changing it.

Definition at line 855 of file rb_eim_evaluation.h.

Referenced by get_preserve_rb_eim_solutions(), rb_eim_solves(), and set_preserve_rb_eim_solutions().

◆ _rb_eim_error_indicators

std::vector<Real> libMesh::RBEIMEvaluation::_rb_eim_error_indicators
private

If we're using the EIM error indicator, then we store the error indicator values corresponding to _rb_eim_solutions here.

Definition at line 720 of file rb_eim_evaluation.h.

Referenced by get_rb_eim_error_indicators(), and rb_eim_solves().

◆ _rb_eim_solutions

std::vector<DenseVector<Number> > libMesh::RBEIMEvaluation::_rb_eim_solutions
private

The EIM solution coefficients from the most recent call to rb_eim_solves().

Definition at line 714 of file rb_eim_evaluation.h.

Referenced by get_rb_eim_solutions(), get_rb_eim_solutions_entries(), rb_eim_solves(), and set_rb_eim_solutions().

◆ _rb_eim_solves_mus

std::vector<RBParameters> libMesh::RBEIMEvaluation::_rb_eim_solves_mus
private

The parameters and the number of basis functions that were used in the most recent call to rb_eim_solves().

We store this so that we can check if we can skip calling rb_eim_solves() again if the inputs haven't changed.

Definition at line 738 of file rb_eim_evaluation.h.

Referenced by rb_eim_solves().

◆ _rb_eim_solves_N

unsigned int libMesh::RBEIMEvaluation::_rb_eim_solves_N
private

Definition at line 739 of file rb_eim_evaluation.h.

Referenced by rb_eim_solves().

◆ _rb_eim_theta_objects

std::vector<std::unique_ptr<RBTheta> > libMesh::RBEIMEvaluation::_rb_eim_theta_objects
private

The vector of RBTheta objects that are created to point to this RBEIMEvaluation.

Definition at line 778 of file rb_eim_evaluation.h.

Referenced by clear(), get_eim_theta_objects(), and initialize_eim_theta_objects().

◆ _scale_components_in_enrichment

std::set<unsigned int> libMesh::RBEIMEvaluation::_scale_components_in_enrichment
protected

This set that specifies which EIM variables will be scaled during EIM enrichment so that their maximum value matches the maximum value across all variables.

This is helpful in cases where some components are much smaller in magnitude than others, since in those cases if we do not apply component scaling to the small components then the accuracy of the EIM approximation for those components will not be controlled well by the EIM enrichment process.

Definition at line 662 of file rb_eim_evaluation.h.

Referenced by scale_components_in_enrichment().

◆ _vec_eval_input

VectorizedEvalInput libMesh::RBEIMEvaluation::_vec_eval_input
private

◆ eim_error_indicator_normalization

EimErrorIndicatorNormalization libMesh::RBEIMEvaluation::eim_error_indicator_normalization

Definition at line 636 of file rb_eim_evaluation.h.

Referenced by get_eim_error_indicator().

◆ verbose_mode

bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 191 of file rb_parametrized.h.

Referenced by libMesh::RBParametrized::check_if_valid_params().


The documentation for this class was generated from the following files: