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 is part of the rbOOmit framework. More...

#include <rb_eim_evaluation.h>

Inheritance diagram for libMesh::RBEIMEvaluation:
[legend]

Public Types

typedef RBEvaluation Parent
 The type of the parent. More...
 

Public Member Functions

 RBEIMEvaluation (const libMesh::Parallel::Communicator &comm_in LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
 Constructor. More...
 
virtual ~RBEIMEvaluation ()
 Destructor. More...
 
virtual void clear () libmesh_override
 Clear this object. More...
 
virtual void resize_data_structures (const unsigned int Nmax, bool resize_error_bound_data=true) libmesh_override
 Resize the data structures for storing data associated with this object. More...
 
void attach_parametrized_function (RBParametrizedFunction *pf)
 Attach the parametrized function that we will approximate using the Empirical Interpolation Method. More...
 
unsigned int get_n_parametrized_functions () const
 Get the number of parametrized functions that have been attached to this system. More...
 
ReplicatedMeshget_interpolation_points_mesh ()
 Get a writable reference to the interpolation points mesh. More...
 
Number evaluate_parametrized_function (unsigned int var_index, const Point &p, const Elem &elem)
 
virtual Real rb_solve (unsigned int N) libmesh_override
 Calculate the EIM approximation to parametrized_function using the first N EIM basis functions. More...
 
void rb_solve (DenseVector< Number > &EIM_rhs)
 Calculate the EIM approximation for the given right-hand side vector EIM_rhs. More...
 
virtual Real get_error_bound_normalization () libmesh_override
 
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< RBTheta * > get_eim_theta_objects ()
 
virtual UniquePtr< RBThetabuild_eim_theta (unsigned int index)
 Build a theta object corresponding to EIM index index. More...
 
virtual void legacy_write_offline_data_to_files (const std::string &directory_name="offline_data", const bool write_binary_data=true) libmesh_override
 Write out all the data to text files in order to segregate the Offline stage from the Online stage. More...
 
virtual void legacy_read_offline_data_from_files (const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true) libmesh_override
 Read in the saved Offline reduced basis data to initialize the system for Online solves. More...
 
void set_rb_theta_expansion (RBThetaExpansion &rb_theta_expansion_in)
 Set the RBThetaExpansion object. More...
 
RBThetaExpansionget_rb_theta_expansion ()
 Get a reference to the rb_theta_expansion. More...
 
bool is_rb_theta_expansion_initialized () const
 
NumericVector< Number > & get_basis_function (unsigned int i)
 Get a reference to the i^th basis function. More...
 
virtual Real compute_residual_dual_norm (const unsigned int N)
 Compute the dual norm of the residual for the solution saved in RB_solution_vector. More...
 
virtual Real residual_scaling_denom (Real alpha_LB)
 Specifies the residual scaling on the denominator to be used in the a posteriori error bound. More...
 
Real eval_output_dual_norm (unsigned int n, const RBParameters &mu)
 Evaluate the dual norm of output n for the current parameters. More...
 
virtual Real get_stability_lower_bound ()
 Get a lower bound for the stability constant (e.g. More...
 
virtual unsigned int get_n_basis_functions () const
 Get the current number of basis functions. More...
 
virtual void set_n_basis_functions (unsigned int n_bfs)
 Set the number of basis functions. More...
 
virtual void clear_riesz_representors ()
 Clear all the Riesz representors that are used to compute the RB residual (and hence error bound). More...
 
virtual void write_out_basis_functions (System &sys, const std::string &directory_name="offline_data", const bool write_binary_basis_functions=true)
 Write out all the basis functions to file. More...
 
virtual 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. More...
 
virtual void read_in_basis_functions (System &sys, const std::string &directory_name="offline_data", const bool read_binary_basis_functions=true)
 Read in all the basis functions from file. More...
 
void read_in_vectors (System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
 Same as read_in_basis_functions, except in this case we pass in the vectors to be written. More...
 
void read_in_vectors_from_multiple_files (System &sys, std::vector< std::vector< NumericVector< Number > * > * > multiple_vectors, const std::vector< std::string > &multiple_directory_names, const std::vector< std::string > &multiple_data_names, const bool read_binary_vectors)
 Performs read_in_vectors for a list of directory names and data names. 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...
 
void set_parameters (const RBParameters &params)
 Set the current parameters to params. 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 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=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

DenseMatrix< Numberinterpolation_matrix
 Dense matrix that stores the lower triangular interpolation matrix that can be used. More...
 
std::vector< Pointinterpolation_points
 The list of interpolation points, i.e. More...
 
std::vector< unsigned intinterpolation_points_var
 The corresponding list of variables indices at which the interpolation points were identified. More...
 
std::vector< Elem * > interpolation_points_elem
 The corresponding list of elements at which the interpolation points were identified. More...
 
std::vector< NumericVector< Number > * > basis_functions
 The libMesh vectors storing the finite element coefficients of the RB basis functions. More...
 
std::vector< RBParametersgreedy_param_list
 The list of parameters selected by the Greedy algorithm in generating the Reduced Basis associated with this RBEvaluation object. More...
 
DenseMatrix< NumberRB_inner_product_matrix
 The inner product matrix. More...
 
std::vector< DenseMatrix< Number > > RB_Aq_vector
 Dense matrices for the RB computations. More...
 
std::vector< DenseVector< Number > > RB_Fq_vector
 Dense vector for the RHS. More...
 
DenseVector< NumberRB_solution
 The RB solution vector. More...
 
std::vector< std::vector< DenseVector< Number > > > RB_output_vectors
 The vectors storing the RB output vectors. More...
 
std::vector< NumberRB_outputs
 The vectors storing the RB output values and corresponding error bounds. More...
 
std::vector< RealRB_output_error_bounds
 
std::vector< NumberFq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
 Vectors storing the residual representor inner products to be used in computing the residuals online. More...
 
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
 
std::vector< std::vector< Number > > output_dual_innerprods
 The vector storing the dual norm inner product terms for each output. More...
 
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
 Vector storing the residual representors associated with the left-hand side. More...
 
bool evaluate_RB_error_bound
 Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called. More...
 
bool compute_RB_inner_product
 Boolean flag to indicate whether we compute the RB_inner_product_matrix. More...
 
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 assert_file_exists (const std::string &file_name)
 Helper function that checks if file_name exists. More...
 
void increment_constructor_count (const std::string &name)
 Increments the construction counter. More...
 
void increment_destructor_count (const std::string &name)
 Increments the destruction counter. More...
 

Protected Attributes

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 legacy_write_out_interpolation_points_elem (const std::string &directory_name)
 Write out interpolation_points_elem by putting the elements into a mesh and writing out the mesh. More...
 
void legacy_read_in_interpolation_points_elem (const std::string &directory_name)
 Read int interpolation_points_elem from a mesh. More...
 

Private Attributes

std::vector< RBParametrizedFunction * > _parametrized_functions
 This vector stores the parametrized functions that will be approximated in this EIM system. More...
 
std::vector< RBTheta * > _rb_eim_theta_objects
 The vector of RBTheta objects that are created to point to this RBEIMEvaluation. More...
 
RBThetaExpansion _empty_rb_theta_expansion
 We initialize RBEIMEvaluation so that it has an "empty" RBThetaExpansion, because this isn't used at all in the EIM. More...
 
RBParameters _previous_parameters
 Store the parameters at which the previous solve was performed (so we can avoid an unnecessary repeat solve). More...
 
unsigned int _previous_N
 Store the number of basis functions used for the previous solve (so we can avoid an unnecessary repeat solve). More...
 
Real _previous_error_bound
 Store the previous error bound returned by rb_solve (so we can return it if we are avoiding an unnecessary repeat solve). More...
 
ReplicatedMesh _interpolation_points_mesh
 Mesh object that we use to store copies of the elements associated with interpolation points. More...
 

Detailed Description

This class is part of the rbOOmit framework.

RBEIMEvaluation extends RBEvaluation to encapsulate the code and data required to perform "online" evaluations for EIM approximations.

Author
David J. Knezevic
Date
2011

Definition at line 51 of file rb_eim_evaluation.h.

Member Typedef Documentation

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.

The type of the parent.

Definition at line 69 of file rb_eim_evaluation.h.

Constructor & Destructor Documentation

RBEIMEvaluation::RBEIMEvaluation ( const libMesh::Parallel::Communicator &comm_in  LIBMESH_CAN_DEFAULT_TO_COMMWORLD)

Constructor.

Definition at line 38 of file rb_eim_evaluation.C.

References _empty_rb_theta_expansion, _interpolation_points_mesh, libMesh::MeshBase::allow_renumbering(), libMesh::RBEvaluation::compute_RB_inner_product, and libMesh::RBEvaluation::set_rb_theta_expansion().

39  :
40  RBEvaluation(comm_in),
41  _previous_N(0),
44 {
45  // Indicate that we need to compute the RB
46  // inner product matrix in this case
48 
49  // initialize to the empty RBThetaExpansion object
51 
52  // Let's not renumber the _interpolation_points_mesh
54 }
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
void allow_renumbering(bool allow)
If false is passed in then this mesh will no longer be renumbered when being prepared for use...
Definition: mesh_base.h:749
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points...
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:84
RBEvaluation(const Parallel::Communicator &comm LIBMESH_CAN_DEFAULT_TO_COMMWORLD)
Constructor.
Definition: rb_evaluation.C:45
unsigned int _previous_N
Store the number of basis functions used for the previous solve (so we can avoid an unnecessary repea...
RBThetaExpansion _empty_rb_theta_expansion
We initialize RBEIMEvaluation so that it has an "empty" RBThetaExpansion, because this isn&#39;t used at ...
Real _previous_error_bound
Store the previous error bound returned by rb_solve (so we can return it if we are avoiding an unnece...
RBEIMEvaluation::~RBEIMEvaluation ( )
virtual

Destructor.

Definition at line 56 of file rb_eim_evaluation.C.

References clear().

57 {
58  this->clear();
59 }
virtual void clear() libmesh_override
Clear this object.

Member Function Documentation

void libMesh::RBEvaluation::assert_file_exists ( const std::string &  file_name)
protectedinherited

Helper function that checks if file_name exists.

Definition at line 894 of file rb_evaluation.C.

Referenced by libMesh::TransientRBEvaluation::legacy_read_offline_data_from_files(), legacy_read_offline_data_from_files(), libMesh::RBEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

895 {
896  if (!std::ifstream(file_name.c_str()))
897  libmesh_error_msg("File missing: " + file_name);
898 }
void RBEIMEvaluation::attach_parametrized_function ( RBParametrizedFunction pf)

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

Definition at line 88 of file rb_eim_evaluation.C.

References _parametrized_functions.

89 {
90  _parametrized_functions.push_back(pf);
91 }
std::vector< RBParametrizedFunction * > _parametrized_functions
This vector stores the parametrized functions that will be approximated in this EIM system...
UniquePtr< 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 223 of file rb_eim_evaluation.C.

Referenced by initialize_eim_theta_objects().

224 {
225  return UniquePtr<RBTheta>( new RBEIMTheta(*this, index) );
226 }
void RBEIMEvaluation::clear ( )
virtual

Clear this object.

Reimplemented from libMesh::RBEvaluation.

Definition at line 61 of file rb_eim_evaluation.C.

References _interpolation_points_mesh, _rb_eim_theta_objects, libMesh::RBEvaluation::clear(), libMesh::ReplicatedMesh::clear(), interpolation_points, interpolation_points_elem, and interpolation_points_var.

Referenced by ~RBEIMEvaluation().

62 {
63  Parent::clear();
64 
65  interpolation_points.clear();
69 
70  // Delete any RBTheta objects that were created
71  for (std::size_t i=0; i<_rb_eim_theta_objects.size(); i++)
72  delete _rb_eim_theta_objects[i];
73  _rb_eim_theta_objects.clear();
74 }
std::vector< RBTheta * > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
virtual void clear() libmesh_override
Clear all internal data.
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points...
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified...
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
virtual void clear() libmesh_override
Clear this RBEvaluation object.
Definition: rb_evaluation.C:60
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
void libMesh::RBEvaluation::clear_riesz_representors ( )
virtualinherited

Clear all the Riesz representors that are used to compute the RB residual (and hence error bound).

This is useful since once we complete the Greedy we may not need the representors any more.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 412 of file rb_evaluation.C.

References libMesh::RBEvaluation::Aq_representor, and libmesh_nullptr.

Referenced by libMesh::RBEvaluation::clear(), libMesh::TransientRBEvaluation::clear_riesz_representors(), libMesh::RBEvaluation::resize_data_structures(), and libMesh::RBEvaluation::set_n_basis_functions().

413 {
414 
415  // Clear the Aq_representors
416  for (std::size_t q_a=0; q_a<Aq_representor.size(); q_a++)
417  for (std::size_t i=0; i<Aq_representor[q_a].size(); i++)
418  {
419  delete Aq_representor[q_a][i];
421  }
422 }
std::vector< std::vector< NumericVector< Number > * > > Aq_representor
Vector storing the residual representors associated with the left-hand side.
const class libmesh_nullptr_t libmesh_nullptr
const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited
Returns
A reference to the Parallel::Communicator object used by this mesh.

Definition at line 87 of file parallel_object.h.

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::__libmesh_petsc_preconditioner_apply(), libMesh::__libmesh_petsc_snes_jacobian(), libMesh::__libmesh_petsc_snes_postcheck(), libMesh::__libmesh_petsc_snes_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::ParmetisPartitioner::_do_repartition(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_get_diagonal(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult(), libMesh::SlepcEigenSolver< T >::_petsc_shell_matrix_mult(), libMesh::PetscLinearSolver< T >::_petsc_shell_matrix_mult_add(), libMesh::EquationSystems::_read_impl(), libMesh::MeshRefinement::_refine_elements(), libMesh::MeshRefinement::_smooth_flags(), add_cube_convex_hull_to_mesh(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::ImplicitSystem::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::EigenSparseLinearSolver< T >::adjoint_solve(), libMesh::UnstructuredMesh::all_second_order(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::FEMSystem::assemble_qoi(), libMesh::MeshCommunication::assign_global_indices(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::DofMap::attach_matrix(), libMesh::Parallel::BinSorter< KeyType, IdxType >::binsort(), libMesh::Parallel::Sort< KeyType, IdxType >::binsort(), libMesh::MeshCommunication::broadcast(), libMesh::SparseMatrix< T >::build(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Parallel::Histogram< KeyType, IdxType >::build_histogram(), libMesh::PetscNonlinearSolver< T >::build_mat_null_space(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshBase::cache_elem_dims(), libMesh::System::calculate_norm(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::Parallel::Sort< KeyType, IdxType >::communicate_bins(), 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::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::Problem_Interface::computeF(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), 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::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), AssembleOptimization::equality_constraints(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::DofMap::get_info(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::EquationSystems::get_solution(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::LocationMap< T >::init(), libMesh::TopologyMap::init(), libMesh::PetscDiffSolver::init(), libMesh::TimeSolver::init(), libMesh::TaoOptimizationSolver< T >::init(), libMesh::PetscNonlinearSolver< T >::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::EigenSystem::init_data(), libMesh::EigenSystem::init_matrices(), libMesh::ParmetisPartitioner::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_rb_construction(), integrate_function(), 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::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), 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_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::MeshSerializer::MeshSerializer(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), new_function_base(), 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::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::MetisPartitioner::partition_range(), 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::SparseMatrix< T >::print(), FEMParameters::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::MeshCommunication::redistribute(), libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::DistributedMesh::renumber_dof_objects(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBEIMConstruction::set_explicit_sys_subvector(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::Parallel::sync_element_data_by_parent_id(), libMesh::Parallel::sync_node_data_by_element_id(), libMesh::MeshRefinement::test_level_one(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), libMesh::MeshRefinement::test_unflagged(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), SystemsTest::testProjectCubeWithMeshFunction(), libMesh::MeshTools::total_weight(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), 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::RBEvaluation::write_out_vectors(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bcs_helper(), 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().

88  { return _communicator; }
const Parallel::Communicator & _communicator
Real libMesh::RBEvaluation::compute_residual_dual_norm ( const unsigned int  N)
virtualinherited

Compute the dual norm of the residual for the solution saved in RB_solution_vector.

Reimplemented in libMesh::TransientRBEvaluation.

Definition at line 303 of file rb_evaluation.C.

References std::abs(), libMesh::RBEvaluation::Aq_Aq_representor_innerprods, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::eval_F_theta(), libMesh::RBEvaluation::Fq_Aq_representor_innerprods, libMesh::RBEvaluation::Fq_representor_innerprods, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBThetaExpansion::get_n_F_terms(), libMesh::RBParametrized::get_parameters(), libMesh::libmesh_conj(), libMesh::libmesh_real(), libMesh::RBEvaluation::RB_solution, libMesh::RBEvaluation::rb_theta_expansion, and libMesh::Real.

Referenced by libMesh::RBEvaluation::rb_solve().

304 {
305  LOG_SCOPE("compute_residual_dual_norm()", "RBEvaluation");
306 
307  const RBParameters & mu = get_parameters();
308 
309  // Use the stored representor inner product values
310  // to evaluate the residual norm
311  Number residual_norm_sq = 0.;
312 
313  unsigned int q=0;
314  for (unsigned int q_f1=0; q_f1<rb_theta_expansion->get_n_F_terms(); q_f1++)
315  {
316  for (unsigned int q_f2=q_f1; q_f2<rb_theta_expansion->get_n_F_terms(); q_f2++)
317  {
318  Real delta = (q_f1==q_f2) ? 1. : 2.;
319  residual_norm_sq += delta * libmesh_real(
322 
323  q++;
324  }
325  }
326 
327  for (unsigned int q_f=0; q_f<rb_theta_expansion->get_n_F_terms(); q_f++)
328  {
329  for (unsigned int q_a=0; q_a<rb_theta_expansion->get_n_A_terms(); q_a++)
330  {
331  for (unsigned int i=0; i<N; i++)
332  {
333  Real delta = 2.;
334  residual_norm_sq +=
335  delta * libmesh_real( rb_theta_expansion->eval_F_theta(q_f, mu) *
338  }
339  }
340  }
341 
342  q=0;
343  for (unsigned int q_a1=0; q_a1<rb_theta_expansion->get_n_A_terms(); q_a1++)
344  {
345  for (unsigned int q_a2=q_a1; q_a2<rb_theta_expansion->get_n_A_terms(); q_a2++)
346  {
347  Real delta = (q_a1==q_a2) ? 1. : 2.;
348 
349  for (unsigned int i=0; i<N; i++)
350  {
351  for (unsigned int j=0; j<N; j++)
352  {
353  residual_norm_sq +=
355  rb_theta_expansion->eval_A_theta(q_a2, mu) *
357  }
358  }
359 
360  q++;
361  }
362  }
363 
364  if (libmesh_real(residual_norm_sq) < 0.)
365  {
366  // libMesh::out << "Warning: Square of residual norm is negative "
367  // << "in RBSystem::compute_residual_dual_norm()" << std::endl;
368 
369  // Sometimes this is negative due to rounding error,
370  // but when this occurs the error is on the order of 1.e-10,
371  // so shouldn't affect error bound much...
372  residual_norm_sq = std::abs(residual_norm_sq);
373  }
374 
375  return std::sqrt( libmesh_real(residual_norm_sq) );
376 }
T libmesh_real(T a)
double abs(double a)
std::vector< Number > Fq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_a at the current parameter.
T libmesh_conj(T a)
DenseVector< Number > RB_solution
The RB solution vector.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
unsigned int get_n_F_terms() const
Get Q_f, the number of terms in the affine expansion for the right-hand side.
std::vector< std::vector< std::vector< Number > > > Fq_Aq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
virtual Number eval_F_theta(unsigned int q, const RBParameters &mu)
Evaluate theta_q_f at the current parameter.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const RBParameters & get_parameters() const
Get the current parameters.
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
std::vector< std::vector< std::vector< Number > > > Aq_Aq_representor_innerprods
void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 107 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

108 {
109  _enable_print_counter = false;
110  return;
111 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 101 of file reference_counter.C.

References libMesh::ReferenceCounter::_enable_print_counter.

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

102 {
103  _enable_print_counter = true;
104  return;
105 }
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called...
Real libMesh::RBEvaluation::eval_output_dual_norm ( unsigned int  n,
const RBParameters mu 
)
inherited

Evaluate the dual norm of output n for the current parameters.

Definition at line 393 of file rb_evaluation.C.

References libMesh::RBThetaExpansion::eval_output_theta(), libMesh::RBThetaExpansion::get_n_output_terms(), libMesh::libmesh_conj(), libMesh::libmesh_real(), libMesh::RBEvaluation::output_dual_innerprods, libMesh::RBEvaluation::rb_theta_expansion, and libMesh::Real.

Referenced by libMesh::TransientRBEvaluation::rb_solve(), and libMesh::RBEvaluation::rb_solve().

394 {
395  Number output_bound_sq = 0.;
396  unsigned int q=0;
397  for (unsigned int q_l1=0; q_l1<rb_theta_expansion->get_n_output_terms(n); q_l1++)
398  {
399  for (unsigned int q_l2=q_l1; q_l2<rb_theta_expansion->get_n_output_terms(n); q_l2++)
400  {
401  Real delta = (q_l1==q_l2) ? 1. : 2.;
402  output_bound_sq += delta * libmesh_real(
405  q++;
406  }
407  }
408 
409  return libmesh_real(std::sqrt( output_bound_sq ));
410 }
T libmesh_real(T a)
T libmesh_conj(T a)
unsigned int get_n_output_terms(unsigned int output_index) const
Get the number of affine terms associated with the specified output.
std::vector< std::vector< Number > > output_dual_innerprods
The vector storing the dual norm inner product terms for each output.
virtual Number eval_output_theta(unsigned int output_index, unsigned int q_l, const RBParameters &mu)
Evaluate theta_q_l at the current parameter.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
Number RBEIMEvaluation::evaluate_parametrized_function ( unsigned int  var_index,
const Point p,
const Elem elem 
)
Returns
The value of the parametrized function that is being approximated at the point p. var_index specifies the variable (i.e. the parametrized function index) to be evaluated. elem specifies the element of the mesh that contains p.

Definition at line 104 of file rb_eim_evaluation.C.

References _parametrized_functions, get_n_parametrized_functions(), and libMesh::RBParametrized::get_parameters().

Referenced by rb_solve(), and libMesh::RBEIMConstruction::truth_solve().

107 {
108  if (var_index >= get_n_parametrized_functions())
109  libmesh_error_msg("Error: We must have var_index < get_n_parametrized_functions() in evaluate_parametrized_function.");
110 
111  return _parametrized_functions[var_index]->evaluate(get_parameters(), p, elem);
112 }
std::vector< RBParametrizedFunction * > _parametrized_functions
This vector stores the parametrized functions that will be approximated in this EIM system...
const RBParameters & get_parameters() const
Get the current parameters.
unsigned int get_n_parametrized_functions() const
Get the number of parametrized functions that have been attached to this system.
NumericVector< Number > & libMesh::RBEvaluation::get_basis_function ( unsigned int  i)
inherited
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 464 of file rb_parametrized.C.

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

Referenced by libMesh::RBConstructionBase< Base >::initialize_training_parameters(), and libMesh::RBParametrized::is_value_in_list().

465 {
466  if (list_of_values.empty())
467  libmesh_error_msg("Error: list_of_values is empty.");
468 
469  std::vector<Real>::const_iterator it = list_of_values.begin();
470  std::vector<Real>::const_iterator it_end = list_of_values.end();
471 
472  Real min_distance = std::numeric_limits<Real>::max();
473  Real closest_val = 0.;
474  for ( ; it != it_end; ++it)
475  {
476  Real distance = std::abs(value - *it);
477  if (distance < min_distance)
478  {
479  min_distance = distance;
480  closest_val = *it;
481  }
482  }
483 
484  return closest_val;
485 }
double abs(double a)
long double max(long double a, double b)
Real distance(const Point &p)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition: xdr_io.C:108
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 403 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::get_n_discrete_params(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBConstructionBase< Base >::initialize_training_parameters(), libMesh::RBParametrized::print_discrete_parameter_values(), libMesh::RBParametrized::valid_params(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

404 {
406  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
407 
409 }
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.
std::vector< RBTheta * > RBEIMEvaluation::get_eim_theta_objects ( )
Returns
The vector of theta objects that point to this RBEIMEvaluation.

Definition at line 218 of file rb_eim_evaluation.C.

References _rb_eim_theta_objects.

219 {
220  return _rb_eim_theta_objects;
221 }
std::vector< RBTheta * > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
Real RBEIMEvaluation::get_error_bound_normalization ( )
virtual
Returns
A scaling factor that we can use to provide a consistent scaling of the RB error bound across different parameter values.

Reimplemented from libMesh::RBEvaluation.

Definition at line 199 of file rb_eim_evaluation.C.

200 {
201  // Just set the normalization factor to 1 in this case.
202  // Users can override this method if specific behavior
203  // is required.
204 
205  return 1.;
206 }
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 (Counts::iterator it = _counts.begin();
59  it != _counts.end(); ++it)
60  {
61  const std::string name(it->first);
62  const unsigned int creations = it->second.first;
63  const unsigned int destructions = it->second.second;
64 
65  oss << "| " << name << " reference count information:\n"
66  << "| Creations: " << creations << '\n'
67  << "| Destructions: " << destructions << '\n';
68  }
69 
70  oss << " ---------------------------------------------------------------------------- \n";
71 
72  return oss.str();
73 
74 #else
75 
76  return "";
77 
78 #endif
79 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
static Counts _counts
Actually holds the data.
ReplicatedMesh & RBEIMEvaluation::get_interpolation_points_mesh ( )

Get a writable reference to the interpolation points mesh.

Definition at line 99 of file rb_eim_evaluation.C.

References _interpolation_points_mesh.

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

100 {
102 }
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points...
virtual unsigned int libMesh::RBEvaluation::get_n_basis_functions ( ) const
virtualinherited

Get the current number of basis functions.

Definition at line 146 of file rb_evaluation.h.

References libMesh::RBEvaluation::basis_functions.

Referenced by libMesh::RBDataSerialization::add_rb_eim_evaluation_data_to_builder(), libMesh::RBDataSerialization::add_rb_evaluation_data_to_builder(), libMesh::RBDataSerialization::add_transient_rb_evaluation_data_to_builder(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBEIMConstruction::initialize_eim_assembly_objects(), initialize_eim_theta_objects(), legacy_read_in_interpolation_points_elem(), libMesh::TransientRBEvaluation::legacy_read_offline_data_from_files(), legacy_read_offline_data_from_files(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_eim_evaluation_data(), libMesh::RBEIMConstruction::load_rb_solution(), libMesh::RBConstruction::load_rb_solution(), libMesh::TransientRBConstruction::load_rb_solution(), libMesh::RBConstruction::print_basis_function_orthogonality(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), rb_solve(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::recompute_all_residual_terms(), libMesh::RBEvaluation::resize_data_structures(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::RBConstruction::train_reduced_basis(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBEIMConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), and libMesh::RBConstruction::write_riesz_representors_to_files().

147  { return cast_int<unsigned int>(basis_functions.size()); }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
unsigned int libMesh::RBParametrized::get_n_continuous_params ( ) const
inherited

Get the number of continuous parameters.

Definition at line 133 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().

134 {
136  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_continuous_params");
137 
139 
140  return static_cast<unsigned int>(get_n_params() - get_n_discrete_params());
141 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int get_n_params() const
Get the number of parameters.
libmesh_assert(j)
unsigned int get_n_discrete_params() const
Get the number of discrete parameters.
unsigned int libMesh::RBParametrized::get_n_discrete_params ( ) const
inherited

Get the number of discrete parameters.

Definition at line 143 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(), libMesh::RBConstructionBase< Base >::initialize_training_parameters(), and libMesh::RBParametrized::write_discrete_parameter_values_to_file().

144 {
146  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_discrete_params");
147 
148  return cast_int<unsigned int>
150 }
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.
unsigned int RBEIMEvaluation::get_n_parametrized_functions ( ) const

Get the number of parametrized functions that have been attached to this system.

Definition at line 93 of file rb_eim_evaluation.C.

References _parametrized_functions.

Referenced by evaluate_parametrized_function().

94 {
95  return cast_int<unsigned int>
96  (_parametrized_functions.size());
97 }
std::vector< RBParametrizedFunction * > _parametrized_functions
This vector stores the parametrized functions that will be approximated in this EIM system...
unsigned int libMesh::RBParametrized::get_n_params ( ) const
inherited

Get the number of parameters.

Definition at line 123 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::RBConstruction::compute_max_error_bound(), libMesh::RBEIMTheta::evaluate(), libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBConstructionBase< Base >::load_training_set(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and libMesh::RBParametrized::valid_params().

124 {
126  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_params");
127 
128  libmesh_assert_equal_to ( parameters_min.n_parameters(), parameters_max.n_parameters() );
129 
130  return parameters_min.n_parameters();
131 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
unsigned int n_parameters() const
Get the number of parameters that have been added.
Definition: rb_parameters.C:62
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
Real libMesh::RBParametrized::get_parameter_max ( const std::string &  param_name) const
inherited

Get maximum allowable value of parameter param_name.

Definition at line 206 of file rb_parametrized.C.

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

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

207 {
209  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_max");
210 
211  return parameters_max.get_value(param_name);
212 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:45
Real libMesh::RBParametrized::get_parameter_min ( const std::string &  param_name) const
inherited

Get minimum allowable value of parameter param_name.

Definition at line 198 of file rb_parametrized.C.

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

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

199 {
201  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_min");
202 
203  return parameters_min.get_value(param_name);
204 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:45
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
std::set< std::string > libMesh::RBParametrized::get_parameter_names ( ) const
inherited

Get a set that stores the parameter names.

Definition at line 152 of file rb_parametrized.C.

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

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

153 {
155  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_names");
156 
157  std::set<std::string> parameter_names;
158  parameters_min.get_parameter_names(parameter_names);
159 
160  return parameter_names;
161 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void get_parameter_names(std::set< std::string > &param_names) const
Fill param_names with the names of the parameters.
Definition: rb_parameters.C:68
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
const RBParameters & libMesh::RBParametrized::get_parameters ( ) const
inherited

Get the current parameters.

Definition at line 174 of file rb_parametrized.C.

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

Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::RBConstructionBase< Base >::broadcast_parameters(), libMesh::TransientRBEvaluation::cache_online_residual_terms(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), evaluate_parametrized_function(), 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::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().

175 {
177  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_current_parameters");
178 
179  return parameters;
180 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
RBParameters parameters
Vector storing the current parameters.
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 190 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::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

191 {
193  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_max");
194 
195  return parameters_max;
196 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
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 182 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::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

183 {
185  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_min");
186 
187  return parameters_min;
188 }
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.
RBThetaExpansion & libMesh::RBEvaluation::get_rb_theta_expansion ( )
inherited
Real libMesh::RBEvaluation::get_stability_lower_bound ( )
virtualinherited

Get a lower bound for the stability constant (e.g.

coercivity constant or inf-sup constant) at the current parameter value.

Reimplemented in SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, SimpleRBEvaluation, and ElasticityRBEvaluation.

Definition at line 378 of file rb_evaluation.C.

Referenced by libMesh::TransientRBEvaluation::rb_solve(), and libMesh::RBEvaluation::rb_solve().

379 {
380  // Return a default value of 1, this function should
381  // be overloaded to specify a problem-dependent stability
382  // factor lower bound
383  return 1.;
384 }
void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
protectedinherited

Increments the construction counter.

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

Definition at line 185 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

186 {
187  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
188  std::pair<unsigned int, unsigned int> & p = _counts[name];
189 
190  p.first++;
191 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
protectedinherited

Increments the destruction counter.

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

Definition at line 198 of file reference_counter.h.

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

Referenced by libMesh::ReferenceCounter::n_objects(), and libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().

199 {
200  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
201  std::pair<unsigned int, unsigned int> & p = _counts[name];
202 
203  p.second++;
204 }
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:39
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
static Counts _counts
Actually holds the data.
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 208 of file rb_eim_evaluation.C.

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

209 {
210  // Initialize the rb_theta objects that access the solution from this rb_eim_evaluation
211  _rb_eim_theta_objects.clear();
212  for (unsigned int i=0; i<get_n_basis_functions(); i++)
213  {
214  _rb_eim_theta_objects.push_back( build_eim_theta(i).release() );
215  }
216 }
std::vector< RBTheta * > _rb_eim_theta_objects
The vector of RBTheta objects that are created to point to this RBEIMEvaluation.
virtual UniquePtr< RBTheta > build_eim_theta(unsigned int index)
Build a theta object corresponding to EIM index index.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
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.

Definition at line 60 of file rb_parametrized.C.

References libMesh::RBParametrized::_discrete_parameter_values, libMesh::RBParameters::begin(), libMesh::RBParameters::end(), libMesh::RBParameters::get_value(), libMesh::RBParameters::n_parameters(), 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::RBParametrized::initialize_parameters(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBConstruction::train_reduced_basis().

63 {
64  // Check that the min/max vectors are valid
65  {
66  const std::string err_string = "Error: Invalid mu_min/mu_max in RBParameters constructor.";
67  bool valid_min_max = (mu_min_in.n_parameters() == mu_max_in.n_parameters());
68  if (!valid_min_max)
69  libmesh_error_msg(err_string);
70 
71  else
72  {
73  RBParameters::const_iterator it = mu_min_in.begin();
74  RBParameters::const_iterator it_end = mu_min_in.end();
75  for ( ; it != it_end; ++it)
76  {
77  std::string param_name = it->first;
78  if (mu_min_in.get_value(param_name) > mu_max_in.get_value(param_name))
79  libmesh_error_msg(err_string);
80  }
81  }
82  }
83 
84  parameters_min = mu_min_in;
85  parameters_max = mu_max_in;
86 
87  // Add in min/max values due to the discrete parameters
88  {
89  std::map<std::string, std::vector<Real>>::const_iterator it =
90  discrete_parameter_values.begin();
91  const std::map<std::string, std::vector<Real>>::const_iterator it_end =
92  discrete_parameter_values.end();
93  for ( ; it != it_end; ++it)
94  {
95  if (it->second.empty())
96  libmesh_error_msg("Error: List of discrete parameters for " << it->first << " is empty.");
97 
98  Real min_val = *std::min_element(it->second.begin(), it->second.end());
99  Real max_val = *std::max_element(it->second.begin(), it->second.end());
100 
101  libmesh_assert_less_equal(min_val,max_val);
102 
103  parameters_min.set_value(it->first, min_val);
104  parameters_max.set_value(it->first, max_val);
105  }
106 
107  _discrete_parameter_values = discrete_parameter_values;
108  }
109 
110  parameters_initialized = true;
111 
112  // Initialize the current parameters to parameters_min
114 }
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.
void set_parameters(const RBParameters &params)
Set the current parameters to params.
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
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.
Definition: rb_parameters.C:57
const_iterator begin() const
Get a constant iterator to beginning of this RBParameters object.
Definition: rb_parameters.C:80
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
void libMesh::RBParametrized::initialize_parameters ( const RBParametrized rb_parametrized)
inherited

Initialize the parameter ranges and set current_parameters.

Definition at line 116 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().

117 {
118  initialize_parameters(rb_parametrized.get_parameters_min(),
119  rb_parametrized.get_parameters_max(),
120  rb_parametrized.get_discrete_parameter_values());
121 }
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.
bool libMesh::RBParametrized::is_discrete_parameter ( const std::string &  mu_name) const
inherited

Is parameter mu_name discrete?

Definition at line 395 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::RBConstructionBase< Base >::initialize_training_parameters(), libMesh::RBConstruction::print_info(), libMesh::RBParametrized::valid_params(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

396 {
398  libmesh_error_msg("Error: parameters not initialized in RBParametrized::is_discrete_parameter");
399 
400  return (_discrete_parameter_values.find(mu_name) != _discrete_parameter_values.end());
401 }
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.
bool libMesh::RBEvaluation::is_rb_theta_expansion_initialized ( ) const
inherited
Returns
true if the theta expansion has been initialized.

Definition at line 97 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

Referenced by libMesh::RBEvaluation::get_rb_theta_expansion().

98 {
100  {
101  return true;
102  }
103  else
104  {
105  return false;
106  }
107 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void RBEIMEvaluation::legacy_read_in_interpolation_points_elem ( const std::string &  directory_name)
private

Read int interpolation_points_elem from a mesh.

Definition at line 475 of file rb_eim_evaluation.C.

References _interpolation_points_mesh, libMesh::ReplicatedMesh::elem_ptr(), libMesh::RBEvaluation::get_n_basis_functions(), interpolation_points_elem, and libMesh::UnstructuredMesh::read().

Referenced by legacy_read_offline_data_from_files().

476 {
477  _interpolation_points_mesh.read(directory_name + "/interpolation_points_mesh.xda");
478 
479  // We have an element for each EIM basis function
480  unsigned int n_bfs = this->get_n_basis_functions();
481 
482  std::vector<dof_id_type> interpolation_elem_ids;
483  {
484  // These are just integers, so no need for a binary format here
485  std::ifstream interpolation_elem_ids_in
486  ((directory_name + "/interpolation_elem_ids.dat").c_str(), std::ifstream::in);
487 
488  if (!interpolation_elem_ids_in)
489  libmesh_error_msg("RB data missing: " + directory_name + "/interpolation_elem_ids.dat");
490 
491  for (unsigned int i=0; i<n_bfs; i++)
492  {
493  dof_id_type elem_id;
494  interpolation_elem_ids_in >> elem_id;
495  interpolation_elem_ids.push_back(elem_id);
496  }
497  interpolation_elem_ids_in.close();
498  }
499 
500  interpolation_points_elem.resize(n_bfs);
501  for (unsigned int i=0; i<n_bfs; i++)
502  {
504  _interpolation_points_mesh.elem_ptr(interpolation_elem_ids[i]);
505  }
506 }
virtual const Elem * elem_ptr(const dof_id_type i) const libmesh_override
virtual void read(const std::string &name, void *mesh_data=libmesh_nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false) libmesh_override
Reads the file specified by name.
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points...
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
uint8_t dof_id_type
Definition: id_types.h:64
void RBEIMEvaluation::legacy_read_offline_data_from_files ( const std::string &  directory_name = "offline_data",
bool  read_error_bound_data = true,
const bool  read_binary_data = true 
)
virtual

Read in the saved Offline reduced basis data to initialize the system for Online solves.

Note
This is a legacy method, use RBDataSerialization instead.

Reimplemented from libMesh::RBEvaluation.

Definition at line 394 of file rb_eim_evaluation.C.

References libMesh::RBEvaluation::assert_file_exists(), libMesh::DECODE, libMesh::RBEvaluation::get_n_basis_functions(), interpolation_matrix, interpolation_points, interpolation_points_var, legacy_read_in_interpolation_points_elem(), libMesh::RBEvaluation::legacy_read_offline_data_from_files(), libMesh::READ, libMesh::Real, and value.

397 {
398  LOG_SCOPE("legacy_read_offline_data_from_files()", "RBEIMEvaluation");
399 
400  Parent::legacy_read_offline_data_from_files(directory_name, read_error_bound_data);
401 
402  // First, find out how many basis functions we had when Greedy terminated
403  // This was set in RBSystem::read_offline_data_from_files
404  unsigned int n_bfs = this->get_n_basis_functions();
405 
406  // The writing mode: DECODE for binary, READ for ASCII
407  XdrMODE mode = read_binary_data ? DECODE : READ;
408 
409  // The suffix to use for all the files that are written out
410  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
411 
412  // Stream for creating file names
413  std::ostringstream file_name;
414 
415  // Read in the interpolation matrix
416  file_name.str("");
417  file_name << directory_name << "/interpolation_matrix" << suffix;
418  assert_file_exists(file_name.str());
419 
420  Xdr interpolation_matrix_in(file_name.str(), mode);
421 
422  for (unsigned int i=0; i<n_bfs; i++)
423  {
424  for (unsigned int j=0; j<=i; j++)
425  {
426  Number value;
427  interpolation_matrix_in >> value;
429  }
430  }
431  interpolation_matrix_in.close();
432 
433  // Next read in interpolation_points
434  file_name.str("");
435  file_name << directory_name << "/interpolation_points" << suffix;
436  assert_file_exists(file_name.str());
437 
438  Xdr interpolation_points_in(file_name.str(), mode);
439 
440  for (unsigned int i=0; i<n_bfs; i++)
441  {
442  Real x_val, y_val, z_val = 0.;
443  interpolation_points_in >> x_val;
444 
445  if (LIBMESH_DIM >= 2)
446  interpolation_points_in >> y_val;
447 
448  if (LIBMESH_DIM >= 3)
449  interpolation_points_in >> z_val;
450 
451  Point p(x_val, y_val, z_val);
452  interpolation_points.push_back(p);
453  }
454  interpolation_points_in.close();
455 
456  // Next read in interpolation_points_var
457  file_name.str("");
458  file_name << directory_name << "/interpolation_points_var" << suffix;
459  assert_file_exists(file_name.str());
460 
461  Xdr interpolation_points_var_in(file_name.str(), mode);
462 
463  for (unsigned int i=0; i<n_bfs; i++)
464  {
465  unsigned int var;
466  interpolation_points_var_in >> var;
467  interpolation_points_var.push_back(var);
468  }
469  interpolation_points_var_in.close();
470 
471  // Read in the elements corresponding to the interpolation points
473 }
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
void legacy_read_in_interpolation_points_elem(const std::string &directory_name)
Read int interpolation_points_elem from a mesh.
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
virtual void legacy_read_offline_data_from_files(const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true)
Read in the saved Offline reduced basis data to initialize the system for Online solves.
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
static const bool value
Definition: xdr_io.C:108
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
void RBEIMEvaluation::legacy_write_offline_data_to_files ( const std::string &  directory_name = "offline_data",
const bool  write_binary_data = true 
)
virtual

Write out all the data to text files in order to segregate the Offline stage from the Online stage.

Note
This is a legacy method, use RBDataSerialization instead.

Reimplemented from libMesh::RBEvaluation.

Definition at line 228 of file rb_eim_evaluation.C.

References libMesh::ENCODE, libMesh::RBEvaluation::get_n_basis_functions(), interpolation_matrix, interpolation_points, interpolation_points_var, libMesh::RBEvaluation::legacy_write_offline_data_to_files(), legacy_write_out_interpolation_points_elem(), libMesh::ParallelObject::processor_id(), and libMesh::WRITE.

230 {
231  LOG_SCOPE("legacy_write_offline_data_to_files()", "RBEIMEvaluation");
232 
234 
235  // Get the number of basis functions
236  unsigned int n_bfs = get_n_basis_functions();
237 
238  // The writing mode: ENCODE for binary, WRITE for ASCII
239  XdrMODE mode = read_binary_data ? ENCODE : WRITE;
240 
241  // The suffix to use for all the files that are written out
242  const std::string suffix = read_binary_data ? ".xdr" : ".dat";
243 
244  if (this->processor_id() == 0)
245  {
246  std::ostringstream file_name;
247 
248  // Next write out the interpolation_matrix
249  file_name.str("");
250  file_name << directory_name << "/interpolation_matrix" << suffix;
251  Xdr interpolation_matrix_out(file_name.str(), mode);
252 
253  for (unsigned int i=0; i<n_bfs; i++)
254  {
255  for (unsigned int j=0; j<=i; j++)
256  {
257  interpolation_matrix_out << interpolation_matrix(i,j);
258  }
259  }
260 
261  // Next write out interpolation_points
262  file_name.str("");
263  file_name << directory_name << "/interpolation_points" << suffix;
264  Xdr interpolation_points_out(file_name.str(), mode);
265 
266  for (unsigned int i=0; i<n_bfs; i++)
267  {
268  interpolation_points_out << interpolation_points[i](0);
269 
270  if (LIBMESH_DIM >= 2)
271  interpolation_points_out << interpolation_points[i](1);
272 
273  if (LIBMESH_DIM >= 3)
274  interpolation_points_out << interpolation_points[i](2);
275  }
276  interpolation_points_out.close();
277 
278  // Next write out interpolation_points_var
279  file_name.str("");
280  file_name << directory_name << "/interpolation_points_var" << suffix;
281  Xdr interpolation_points_var_out(file_name.str(), mode);
282 
283  for (unsigned int i=0; i<n_bfs; i++)
284  {
285  interpolation_points_var_out << interpolation_points_var[i];
286  }
287  interpolation_points_var_out.close();
288  }
289 
290  // Write out the elements associated with the interpolation points.
291  // This uses mesh I/O, hence we have to do it on all processors.
293 }
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
void legacy_write_out_interpolation_points_elem(const std::string &directory_name)
Write out interpolation_points_elem by putting the elements into a mesh and writing out the mesh...
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:32
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true)
Write out all the data to text files in order to segregate the Offline stage from the Online stage...
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified...
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
processor_id_type processor_id() const
void RBEIMEvaluation::legacy_write_out_interpolation_points_elem ( const std::string &  directory_name)
private

Write out interpolation_points_elem by putting the elements into a mesh and writing out the mesh.

Definition at line 295 of file rb_eim_evaluation.C.

References _interpolation_points_mesh, libMesh::ReplicatedMesh::add_elem(), libMesh::ReplicatedMesh::add_point(), libMesh::Elem::build(), libMesh::ReplicatedMesh::clear(), libMesh::DofObject::id(), interpolation_points_elem, libMesh::libmesh_assert(), libmesh_nullptr, libMesh::ReplicatedMesh::n_elem(), libMesh::Elem::n_nodes(), libMesh::Elem::node_id(), libMesh::ReplicatedMesh::node_ptr(), libMesh::Elem::node_ref(), libMesh::out, libMesh::ParallelObject::processor_id(), libMesh::DofObject::processor_id(), libMesh::DofObject::set_id(), libMesh::Elem::set_node(), libMesh::Elem::subdomain_id(), libMesh::Elem::type(), and libMesh::UnstructuredMesh::write().

Referenced by legacy_write_offline_data_to_files().

296 {
298 
299  // Maintain a set of node IDs to make sure we don't insert
300  // the same node into _interpolation_points_mesh more than once
301  std::set<dof_id_type> node_ids;
302  std::map<dof_id_type, dof_id_type> node_id_map;
303 
304  unsigned int new_node_id = 0;
305  for (std::size_t i=0; i<interpolation_points_elem.size(); i++)
306  {
307  Elem * old_elem = interpolation_points_elem[i];
308 
309  for (unsigned int n=0; n<old_elem->n_nodes(); n++)
310  {
311  Node & node_ref = old_elem->node_ref(n);
312  dof_id_type old_node_id = node_ref.id();
313 
314  // Check if this node has already been added. This
315  // could happen if some of the elements are neighbors.
316  if (node_ids.find(old_node_id) == node_ids.end())
317  {
318  node_ids.insert(old_node_id);
319  _interpolation_points_mesh.add_point(node_ref, new_node_id, /* proc_id */ 0);
320 
321  node_id_map[old_node_id] = new_node_id;
322 
323  new_node_id++;
324  }
325  }
326  }
327 
328  // Maintain a map of elem IDs to make sure we don't insert
329  // the same elem into _interpolation_points_mesh more than once
330  std::map<dof_id_type,dof_id_type> elem_id_map;
331  std::vector<dof_id_type> interpolation_elem_ids(interpolation_points_elem.size());
332  dof_id_type new_elem_id = 0;
333  for (std::size_t i=0; i<interpolation_elem_ids.size(); i++)
334  {
335  Elem * old_elem = interpolation_points_elem[i];
336 
337  dof_id_type old_elem_id = old_elem->id();
338 
339  // Only insert the element into the mesh if it hasn't already been inserted
340  std::map<dof_id_type,dof_id_type>::iterator id_it = elem_id_map.find(old_elem_id);
341  if (id_it == elem_id_map.end())
342  {
343  Elem * new_elem = Elem::build(old_elem->type(), /*parent*/ libmesh_nullptr).release();
344  new_elem->subdomain_id() = old_elem->subdomain_id();
345 
346  // Assign all the nodes
347  for (unsigned int n=0; n<new_elem->n_nodes(); n++)
348  {
349  dof_id_type old_node_id = old_elem->node_id(n);
350  new_elem->set_node(n) =
351  _interpolation_points_mesh.node_ptr( node_id_map[old_node_id] );
352  }
353 
354  // Just set all proc_ids to 0
355  new_elem->processor_id() = 0;
356 
357  // Add the element to the mesh
359 
360  // Set the id of new_elem appropriately
361  new_elem->set_id(new_elem_id);
362  interpolation_elem_ids[i] = new_elem->id();
363  elem_id_map[old_elem_id] = new_elem->id();
364 
365  new_elem_id++;
366  }
367  else
368  {
369  interpolation_elem_ids[i] = id_it->second;
370  }
371 
372  }
373 
375 
376  _interpolation_points_mesh.write(directory_name + "/interpolation_points_mesh.xda");
377 
378  // Also, write out the vector that tells us which element each entry
379  // of interpolation_points_elem corresponds to. This allows us to handle
380  // the case in which elements are repeated in interpolation_points_elem.
381  if (processor_id() == 0)
382  {
383  // These are just integers, so no need for a binary format here
384  std::ofstream interpolation_elem_ids_out
385  ((directory_name + "/interpolation_elem_ids.dat").c_str(), std::ofstream::out);
386 
387  for (std::size_t i=0; i<interpolation_elem_ids.size(); i++)
388  interpolation_elem_ids_out << interpolation_elem_ids[i] << std::endl;
389 
390  interpolation_elem_ids_out.close();
391  }
392 }
virtual Node * add_point(const Point &p, const dof_id_type id=DofObject::invalid_id, const processor_id_type proc_id=DofObject::invalid_processor_id) libmesh_override
functions for adding /deleting nodes elements.
virtual const Node * node_ptr(const dof_id_type i) const libmesh_override
static UniquePtr< Elem > build(const ElemType type, Elem *p=libmesh_nullptr)
Definition: elem.C:238
virtual Elem * add_elem(Elem *e) libmesh_override
Add elem e to the end of the element array.
virtual void clear() libmesh_override
Clear all internal data.
const class libmesh_nullptr_t libmesh_nullptr
ReplicatedMesh _interpolation_points_mesh
Mesh object that we use to store copies of the elements associated with interpolation points...
dof_id_type & set_id()
Definition: dof_object.h:641
libmesh_assert(j)
virtual dof_id_type n_elem() const libmesh_override
virtual void write(const std::string &name) libmesh_override
Write the file specified by name.
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
OStreamProxy out
processor_id_type processor_id() const
uint8_t dof_id_type
Definition: id_types.h:64
processor_id_type processor_id() const
Definition: dof_object.h:694
static unsigned int libMesh::ReferenceCounter::n_objects ( )
staticinherited
processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

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

Referenced by libMesh::ParmetisPartitioner::_do_repartition(), libMesh::BoundaryInfo::_find_id_maps(), libMesh::DistributedMesh::add_elem(), libMesh::DistributedMesh::add_node(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::AztecLinearSolver< T >::AztecLinearSolver(), libMesh::MeshCommunication::broadcast(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DistributedMesh::clear(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::UnstructuredMesh::create_pid_mesh(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), libMesh::MeshBase::get_info(), libMesh::EquationSystems::get_solution(), libMesh::SystemSubsetBySubdomain::init(), libMesh::ParmetisPartitioner::initialize(), libMesh::Nemesis_IO_Helper::initialize(), libMesh::DistributedMesh::insert_elem(), 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(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::Partitioner::partition(), libMesh::MeshBase::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::PetscLinearSolver< T >::PetscLinearSolver(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NameBasedIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::CheckpointIO::read_connectivity(), libMesh::XdrIO::read_header(), libMesh::CheckpointIO::read_nodes(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::Partitioner::repartition(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Parallel::Sort< KeyType, IdxType >::sort(), WriteVecAndScalar::testWrite(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), and libMesh::XdrIO::write_serialized_nodesets().

94  { return cast_int<processor_id_type>(_communicator.size()); }
unsigned int size() const
Definition: parallel.h:726
const Parallel::Communicator & _communicator
void libMesh::RBParametrized::print_discrete_parameter_values ( ) const
inherited

Print out all the discrete parameter values.

Definition at line 411 of file rb_parametrized.C.

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

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

412 {
413  std::map<std::string, std::vector<Real>>::const_iterator it =
415  const std::map<std::string, std::vector<Real>>::const_iterator it_end =
417 
418  for ( ; it != it_end; ++it)
419  {
420  libMesh::out << "Discrete parameter " << it->first << ", values: ";
421 
422  std::vector<Real> values = it->second;
423  for (std::size_t i=0; i<values.size(); i++)
424  libMesh::out << values[i] << " ";
425  libMesh::out << std::endl;
426  }
427 }
OStreamProxy out
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
void libMesh::ReferenceCounter::print_info ( std::ostream &  out = libMesh::out)
staticinherited

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

Definition at line 88 of file reference_counter.C.

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

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

89 {
91  out_stream << ReferenceCounter::get_info();
92 }
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...
void libMesh::RBParametrized::print_parameters ( ) const
inherited

Print the current parameters.

Definition at line 214 of file rb_parametrized.C.

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

Referenced by libMesh::RBConstruction::train_reduced_basis().

215 {
217  libmesh_error_msg("Error: parameters not initialized in RBParametrized::print_current_parameters");
218 
219  get_parameters().print();
220 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
void print() const
Print the parameters.
const RBParameters & get_parameters() const
Get the current parameters.
processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited
Returns
The rank of this processor in the group.

Definition at line 99 of file parallel_object.h.

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::EquationSystems::_read_impl(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DofMap::add_neighbors_to_send_list(), libMesh::DistributedMesh::add_node(), libMesh::MeshRefinement::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::ParmetisPartitioner::assign_partitioning(), libMesh::MeshCommunication::broadcast(), libMesh::EquationSystems::build_discontinuous_solution_vector(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::ParmetisPartitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::DofMap::build_sparsity(), libMesh::DistributedMesh::clear(), 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::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::DistributedMesh::delete_elem(), libMesh::DistributedMesh::delete_node(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DofMap::distribute_dofs(), libMesh::DofMap::distribute_local_dofs_node_major(), libMesh::DofMap::distribute_local_dofs_var_major(), libMesh::DistributedMesh::DistributedMesh(), libMesh::EnsightIO::EnsightIO(), libMesh::RBEIMConstruction::evaluate_mesh_function(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::MeshCommunication::gather(), libMesh::MeshCommunication::gather_neighboring_elements(), 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::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::EquationSystems::get_solution(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ParmetisPartitioner::initialize(), 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(), legacy_write_offline_data_to_files(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), legacy_write_out_interpolation_points_elem(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), 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::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::BoundaryInfo::n_edge_conds(), 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(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::MetisPartitioner::partition_range(), libMesh::System::point_gradient(), libMesh::System::point_hessian(), libMesh::System::point_value(), libMesh::SparseMatrix< T >::print(), libMesh::NumericVector< T >::print_global(), 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::CheckpointIO::read(), libMesh::XdrIO::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::CheckpointIO::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::MeshCommunication::redistribute(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::MeshCommunication::send_coarse_ghosts(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::LaplaceMeshSmoother::smooth(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), BoundaryInfoTest::testShellFaceConstraints(), WriteVecAndScalar::testWrite(), libMesh::MeshTools::total_weight(), libMesh::MeshRefinement::uniformly_coarsen(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::weight(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::XdrIO::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_elements(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), 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::ExodusII_IO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::RBEvaluation::write_out_vectors(), write_output_solvedata(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), and libMesh::ExodusII_IO_Helper::write_timestep().

100  { return cast_int<processor_id_type>(_communicator.rank()); }
const Parallel::Communicator & _communicator
unsigned int rank() const
Definition: parallel.h:724
Real RBEIMEvaluation::rb_solve ( unsigned int  N)
virtual

Calculate the EIM approximation to parametrized_function using the first N EIM basis functions.

Store the solution coefficients in the member RB_solution.

Returns
The EIM a posteriori error bound.

Reimplemented from libMesh::RBEvaluation.

Definition at line 114 of file rb_eim_evaluation.C.

References _previous_error_bound, _previous_N, _previous_parameters, std::abs(), evaluate_parametrized_function(), libMesh::RBEvaluation::evaluate_RB_error_bound, libMesh::RBEvaluation::get_n_basis_functions(), libMesh::RBParametrized::get_parameters(), libMesh::DenseMatrix< T >::get_principal_submatrix(), interpolation_matrix, interpolation_points, interpolation_points_elem, interpolation_points_var, libMesh::DenseMatrix< T >::lu_solve(), libMesh::RBEvaluation::RB_solution, and libMesh::Real.

Referenced by libMesh::RBEIMConstruction::enrich_RB_space(), and libMesh::RBEIMTheta::evaluate().

115 {
116  // Short-circuit if we are using the same parameters and value of N
117  if ((_previous_parameters == get_parameters()) && (_previous_N == N))
118  {
119  return _previous_error_bound;
120  }
121 
122  // Otherwise, update _previous parameters, _previous_N
124  _previous_N = N;
125 
126  LOG_SCOPE("rb_solve()", "RBEIMEvaluation");
127 
128  if (N > get_n_basis_functions())
129  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
130 
131  if (N==0)
132  libmesh_error_msg("ERROR: N must be greater than 0 in rb_solve");
133 
134  // Get the rhs by sampling parametrized_function
135  // at the first N interpolation_points
136  DenseVector<Number> EIM_rhs(N);
137  for (unsigned int i=0; i<N; i++)
138  {
142  }
143 
144 
145 
146  DenseMatrix<Number> interpolation_matrix_N;
147  interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
148 
149  interpolation_matrix_N.lu_solve(EIM_rhs, RB_solution);
150 
151  // Optionally evaluate an a posteriori error bound. The EIM error estimate
152  // recommended in the literature is based on using "next" EIM point, so
153  // we skip this if N == get_n_basis_functions()
155  {
156  // Compute the a posteriori error bound
157  // First, sample the parametrized function at x_{N+1}
161 
162  // Next, evaluate the EIM approximation at x_{N+1}
163  Number EIM_approx_at_next_x = 0.;
164  for (unsigned int j=0; j<N; j++)
165  {
166  EIM_approx_at_next_x += RB_solution(j) * interpolation_matrix(N,j);
167  }
168 
169  Real error_estimate = std::abs(g_at_next_x - EIM_approx_at_next_x);
170 
171  _previous_error_bound = error_estimate;
172  return error_estimate;
173  }
174  else // Don't evaluate an error bound
175  {
176  _previous_error_bound = -1.;
177  return -1.;
178  }
179 
180 }
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
double abs(double a)
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called...
DenseVector< Number > RB_solution
The RB solution vector.
void get_principal_submatrix(unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const
Put the sub_m x sub_n principal submatrix into dest.
Definition: dense_matrix.C:553
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified...
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
unsigned int _previous_N
Store the number of basis functions used for the previous solve (so we can avoid an unnecessary repea...
Number evaluate_parametrized_function(unsigned int var_index, const Point &p, const Elem &elem)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const RBParameters & get_parameters() const
Get the current parameters.
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
Real _previous_error_bound
Store the previous error bound returned by rb_solve (so we can return it if we are avoiding an unnece...
RBParameters _previous_parameters
Store the parameters at which the previous solve was performed (so we can avoid an unnecessary repeat...
void RBEIMEvaluation::rb_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 RB_solution.

Definition at line 182 of file rb_eim_evaluation.C.

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

183 {
184  LOG_SCOPE("rb_solve()", "RBEIMEvaluation");
185 
186  if (EIM_rhs.size() > get_n_basis_functions())
187  libmesh_error_msg("ERROR: N cannot be larger than the number of basis functions in rb_solve");
188 
189  if (EIM_rhs.size()==0)
190  libmesh_error_msg("ERROR: N must be greater than 0 in rb_solve");
191 
192  const unsigned int N = EIM_rhs.size();
193  DenseMatrix<Number> interpolation_matrix_N;
194  interpolation_matrix.get_principal_submatrix(N, interpolation_matrix_N);
195 
196  interpolation_matrix_N.lu_solve(EIM_rhs, RB_solution);
197 }
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
DenseVector< Number > RB_solution
The RB solution vector.
virtual unsigned int size() const libmesh_override
Definition: dense_vector.h:87
void get_principal_submatrix(unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const
Put the sub_m x sub_n principal submatrix into dest.
Definition: dense_matrix.C:553
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
void libMesh::RBEvaluation::read_in_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  read_binary_basis_functions = true 
)
virtualinherited

Read in all the basis functions from file.

Parameters
sysUsed for file IO.
directory_nameSpecifies which directory to write files to.
read_binary_basis_functionsIndicates whether to expect binary or ASCII data.

Definition at line 970 of file rb_evaluation.C.

References libMesh::RBEvaluation::basis_functions, and libMesh::RBEvaluation::read_in_vectors().

Referenced by libMesh::RBEvaluation::set_n_basis_functions().

973 {
974  LOG_SCOPE("read_in_basis_functions()", "RBEvaluation");
975 
978  directory_name,
979  "bf",
980  read_binary_basis_functions);
981 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
ImplicitSystem & sys
void read_in_vectors(System &sys, std::vector< NumericVector< Number > * > &vectors, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
Same as read_in_basis_functions, except in this case we pass in the vectors to be written...
void libMesh::RBEvaluation::read_in_vectors ( System sys,
std::vector< NumericVector< Number > * > &  vectors,
const std::string &  directory_name,
const std::string &  data_name,
const bool  read_binary_vectors 
)
inherited

Same as read_in_basis_functions, except in this case we pass in the vectors to be written.

We assume that the size of vectors indicates the number of vectors that need to be read in.

Definition at line 983 of file rb_evaluation.C.

References libMesh::RBEvaluation::read_in_vectors_from_multiple_files().

Referenced by libMesh::RBEvaluation::read_in_basis_functions(), and libMesh::RBEvaluation::set_n_basis_functions().

988 {
989  std::vector<std::vector<NumericVector<Number> *> *> vectors_vec;
990  vectors_vec.push_back(&vectors);
991 
992  std::vector<std::string> directory_name_vec;
993  directory_name_vec.push_back(directory_name);
994 
995  std::vector<std::string> data_name_vec;
996  data_name_vec.push_back(data_name);
997 
999  vectors_vec,
1000  directory_name_vec,
1001  data_name_vec,
1002  read_binary_vectors);
1003 }
ImplicitSystem & sys
void read_in_vectors_from_multiple_files(System &sys, std::vector< std::vector< NumericVector< Number > * > * > multiple_vectors, const std::vector< std::string > &multiple_directory_names, const std::vector< std::string > &multiple_data_names, const bool read_binary_vectors)
Performs read_in_vectors for a list of directory names and data names.
void libMesh::RBEvaluation::read_in_vectors_from_multiple_files ( System sys,
std::vector< std::vector< NumericVector< Number > * > * >  multiple_vectors,
const std::vector< std::string > &  multiple_directory_names,
const std::vector< std::string > &  multiple_data_names,
const bool  read_binary_vectors 
)
inherited

Performs read_in_vectors for a list of directory names and data names.

Reading in vectors requires us to renumber the dofs in a partition-independent way. This function only renumbers the dofs once at the start (and reverts it at the end), which can save a lot of work compared to renumbering on every read.

Definition at line 1005 of file rb_evaluation.C.

References libMesh::RBEvaluation::assert_file_exists(), libMesh::Parallel::Communicator::barrier(), libMesh::NumericVector< T >::build(), libMesh::ParallelObject::comm(), libMesh::Xdr::data(), libMesh::DECODE, libMesh::MeshBase::fix_broken_node_and_element_numbering(), libMesh::System::get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::libmesh_assert(), libMesh::System::n_dofs(), libMesh::System::n_local_dofs(), libMesh::PARALLEL, libMesh::ParallelObject::processor_id(), libMesh::READ, libMesh::System::read_header(), and libMesh::System::read_serialized_vectors().

Referenced by libMesh::RBEvaluation::read_in_vectors(), and libMesh::RBEvaluation::set_n_basis_functions().

1010 {
1011  LOG_SCOPE("read_in_vectors_from_multiple_files()", "RBEvaluation");
1012 
1013  unsigned int n_files = multiple_vectors.size();
1014  unsigned int n_directories = multiple_directory_names.size();
1015  libmesh_assert((n_files == n_directories) && (n_files == multiple_data_names.size()));
1016 
1017  if (n_files == 0)
1018  return;
1019 
1020  // Make sure processors are synced up before we begin
1021  this->comm().barrier();
1022 
1023  std::ostringstream file_name;
1024  const std::string basis_function_suffix = (read_binary_vectors ? ".xdr" : ".dat");
1025 
1026  // Following EquationSystemsIO::read, we use a temporary numbering (node major)
1027  // before writing out the data. For the sake of efficiency, we do this once for
1028  // all the vectors that we read in.
1030 
1031  for (unsigned int data_index=0; data_index<n_directories; data_index++)
1032  {
1033  std::vector<NumericVector<Number> *> & vectors = *multiple_vectors[data_index];
1034 
1035  // Allocate storage for each vector
1036  for (std::size_t i=0; i<vectors.size(); i++)
1037  {
1038  // vectors should all be NULL, otherwise we get a memory leak when
1039  // we create the new vectors in RBEvaluation::read_in_vectors.
1040  if (vectors[i])
1041  libmesh_error_msg("Non-NULL vector passed to read_in_vectors_from_multiple_files");
1042 
1043  vectors[i] = NumericVector<Number>::build(sys.comm()).release();
1044 
1045  vectors[i]->init (sys.n_dofs(),
1046  sys.n_local_dofs(),
1047  false,
1048  PARALLEL);
1049  }
1050 
1051  file_name.str("");
1052  file_name << multiple_directory_names[data_index]
1053  << "/" << multiple_data_names[data_index]
1054  << "_data" << basis_function_suffix;
1055 
1056  // On processor zero check to be sure the file exists
1057  if (this->processor_id() == 0)
1058  {
1059  struct stat stat_info;
1060  int stat_result = stat(file_name.str().c_str(), &stat_info);
1061 
1062  if (stat_result != 0)
1063  libmesh_error_msg("File does not exist: " << file_name.str());
1064  }
1065 
1066  assert_file_exists(file_name.str());
1067  Xdr vector_data(file_name.str(),
1068  read_binary_vectors ? DECODE : READ);
1069 
1070  // Read the header data. This block of code is based on EquationSystems::_read_impl.
1071  {
1072  std::string version;
1073  vector_data.data(version);
1074 
1075  const std::string libMesh_label = "libMesh-";
1076  std::string::size_type lm_pos = version.find(libMesh_label);
1077  if (lm_pos==std::string::npos)
1078  {
1079  libmesh_error_msg("version info missing in Xdr header");
1080  }
1081 
1082  std::istringstream iss(version.substr(lm_pos + libMesh_label.size()));
1083  int ver_major = 0, ver_minor = 0, ver_patch = 0;
1084  char dot;
1085  iss >> ver_major >> dot >> ver_minor >> dot >> ver_patch;
1086  vector_data.set_version(LIBMESH_VERSION_ID(ver_major, ver_minor, ver_patch));
1087 
1088  // Actually read the header data. When we do this, set read_header=false
1089  // so taht we do not reinit sys, since we assume that it has already been
1090  // set up properly (e.g. the appropriate variables have already been added).
1091  sys.read_header(vector_data, version, /*read_header=*/false, /*read_additional_data=*/false);
1092  }
1093 
1094  sys.read_serialized_vectors (vector_data, vectors);
1095  }
1096 
1097  // Undo the temporary renumbering
1099 }
ImplicitSystem & sys
virtual void fix_broken_node_and_element_numbering()=0
There is no reason for a user to ever call this function.
libmesh_assert(j)
static UniquePtr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
const MeshBase & get_mesh() const
Definition: system.h:2014
void read_header(Xdr &io, const std::string &version, const bool read_header=true, const bool read_additional_data=true, const bool read_legacy_format=false)
Reads the basic data header for this System.
Definition: system_io.C:115
void barrier() const
Pause execution until all processors reach a certain point.
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:1968
dof_id_type n_local_dofs() const
Definition: system.C:185
void assert_file_exists(const std::string &file_name)
Helper function that checks if file_name exists.
const Parallel::Communicator & comm() const
std::size_t read_serialized_vectors(Xdr &io, const std::vector< NumericVector< Number > * > &vectors) const
Read a number of identically distributed vectors.
Definition: system_io.C:2236
dof_id_type n_dofs() const
Definition: system.C:148
processor_id_type processor_id() const
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 301 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::RBEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files().

304 {
305  RBParameters param_min;
306  RBParameters param_max;
307  read_parameter_ranges_from_file(continuous_param_file_name,
308  read_binary_data,
309  param_min,
310  param_max);
311 
312  std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
313  read_discrete_parameter_values_from_file(discrete_param_file_name,
314  read_binary_data,
315  discrete_parameter_values_in);
316 
317  initialize_parameters(param_min, param_max, discrete_parameter_values_in);
318 }
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.
Real libMesh::RBEvaluation::residual_scaling_denom ( Real  alpha_LB)
virtualinherited

Specifies the residual scaling on the denominator to be used in the a posteriori error bound.

Override in subclass in order to obtain the desired error bound.

Definition at line 386 of file rb_evaluation.C.

Referenced by libMesh::TransientRBEvaluation::rb_solve(), and libMesh::RBEvaluation::rb_solve().

387 {
388  // Here we implement the residual scaling for a coercive
389  // problem.
390  return alpha_LB;
391 }
void RBEIMEvaluation::resize_data_structures ( const unsigned int  Nmax,
bool  resize_error_bound_data = true 
)
virtual

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

Reimplemented from libMesh::RBEvaluation.

Definition at line 76 of file rb_eim_evaluation.C.

References interpolation_matrix, interpolation_points, interpolation_points_elem, interpolation_points_var, libMesh::DenseMatrix< T >::resize(), and libMesh::RBEvaluation::resize_data_structures().

78 {
79  Parent::resize_data_structures(Nmax, resize_error_bound_data);
80 
81  // Resize the data structures relevant to the EIM system
82  interpolation_points.clear();
85  interpolation_matrix.resize(Nmax,Nmax);
86 }
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true)
Resize and clear the data vectors corresponding to the value of Nmax.
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified...
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
virtual void libMesh::RBEvaluation::set_n_basis_functions ( unsigned int  n_bfs)
virtualinherited
void libMesh::RBParametrized::set_parameters ( const RBParameters params)
inherited

Set the current parameters to params.

Definition at line 163 of file rb_parametrized.C.

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

Referenced by libMesh::RBConstructionBase< Base >::broadcast_parameters(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), 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(), libMesh::RBConstructionBase< Base >::set_params_from_training_set(), and libMesh::RBEIMConstruction::truth_solve().

164 {
166  libmesh_error_msg("Error: parameters not initialized in RBParametrized::set_current_parameters");
167 
168  valid_params(params); // Terminates if params has the wrong number of parameters
169 
170  // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
171  this->parameters = params;
172 }
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
bool valid_params(const RBParameters &params)
Helper function to check that params is valid.
RBParameters parameters
Vector storing the current parameters.
void libMesh::RBEvaluation::set_rb_theta_expansion ( RBThetaExpansion rb_theta_expansion_in)
inherited

Set the RBThetaExpansion object.

Definition at line 84 of file rb_evaluation.C.

References libMesh::RBEvaluation::rb_theta_expansion.

Referenced by RBEIMEvaluation(), and SimpleRBEvaluation::SimpleRBEvaluation().

85 {
86  rb_theta_expansion = &rb_theta_expansion_in;
87 }
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.
void libMesh::RBEvaluation::write_out_basis_functions ( System sys,
const std::string &  directory_name = "offline_data",
const bool  write_binary_basis_functions = true 
)
virtualinherited

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 expect binary or ASCII data

Definition at line 900 of file rb_evaluation.C.

References libMesh::RBEvaluation::basis_functions, and libMesh::RBEvaluation::write_out_vectors().

Referenced by main(), and libMesh::RBEvaluation::set_n_basis_functions().

903 {
904  LOG_SCOPE("write_out_basis_functions()", "RBEvaluation");
905 
908  directory_name,
909  "bf",
910  write_binary_basis_functions);
911 }
std::vector< NumericVector< Number > * > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
ImplicitSystem & sys
virtual 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...
void libMesh::RBEvaluation::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 
)
virtualinherited

Same as write_out_basis_functions, except in this case we pass in the vectors to be written.

Definition at line 913 of file rb_evaluation.C.

References libMesh::Parallel::Communicator::barrier(), libMesh::ParallelObject::comm(), libMesh::ENCODE, libMesh::MeshBase::fix_broken_node_and_element_numbering(), libMesh::get_io_compatibility_version(), libMesh::System::get_mesh(), libMesh::MeshTools::Private::globally_renumber_nodes_and_elements(), libMesh::Utility::mkdir(), libMesh::ParallelObject::processor_id(), libMesh::WRITE, libMesh::System::write_header(), and libMesh::System::write_serialized_vectors().

Referenced by libMesh::RBEvaluation::set_n_basis_functions(), and libMesh::RBEvaluation::write_out_basis_functions().

918 {
919  LOG_SCOPE("write_out_vectors()", "RBEvaluation");
920 
921  if (this->processor_id() == 0)
922  {
923  // Make a directory to store all the data files
924  Utility::mkdir(directory_name.c_str());
925  }
926 
927  // Make sure processors are synced up before we begin
928  this->comm().barrier();
929 
930  std::ostringstream file_name;
931  const std::string basis_function_suffix = (write_binary_vectors ? ".xdr" : ".dat");
932 
933  file_name << directory_name << "/" << data_name << "_data" << basis_function_suffix;
934  Xdr bf_data(file_name.str(),
935  write_binary_vectors ? ENCODE : WRITE);
936 
937  std::string version("libMesh-" + libMesh::get_io_compatibility_version());
938 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
939  version += " with infinite elements";
940 #endif
941  bf_data.data(version ,"# File Format Identifier");
942 
943  sys.write_header(bf_data, /*(unused arg)*/ version, /*write_additional_data=*/false);
944 
945  // Following EquationSystemsIO::write, we use a temporary numbering (node major)
946  // before writing out the data
948 
949  // Write all vectors at once.
950  {
951  // Note the API wants pointers to constant vectors, hence this...
952  std::vector<const NumericVector<Number> *> bf_out(vectors.begin(),
953  vectors.end());
954  // for (std::size_t i=0; i<vectors.size(); i++)
955  // bf_out.push_back(vectors[i]);
956  sys.write_serialized_vectors (bf_data, bf_out);
957  }
958 
959 
960  // set the current version
961  bf_data.set_version(LIBMESH_VERSION_ID(LIBMESH_MAJOR_VERSION,
962  LIBMESH_MINOR_VERSION,
963  LIBMESH_MICRO_VERSION));
964 
965 
966  // Undo the temporary renumbering
968 }
ImplicitSystem & sys
virtual void fix_broken_node_and_element_numbering()=0
There is no reason for a user to ever call this function.
int mkdir(const char *pathname)
Create a directory.
Definition: utility.C:140
std::size_t write_serialized_vectors(Xdr &io, const std::vector< const NumericVector< Number > * > &vectors) const
Serialize & write a number of identically distributed vectors.
Definition: system_io.C:2330
const MeshBase & get_mesh() const
Definition: system.h:2014
void write_header(Xdr &io, const std::string &version, const bool write_additional_data) const
Writes the basic data header for this System.
Definition: system_io.C:1313
std::string get_io_compatibility_version()
Specifier for I/O file compatibility features.
void barrier() const
Pause execution until all processors reach a certain point.
void globally_renumber_nodes_and_elements(MeshBase &)
There is no reason for a user to ever call this function.
Definition: mesh_tools.C:1968
const Parallel::Communicator & comm() const
processor_id_type processor_id() const
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 222 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::RBEvaluation::legacy_write_offline_data_to_files(), and libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files().

225 {
226  write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
227  write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
228 }
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

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts
staticprotectedinherited
RBThetaExpansion libMesh::RBEIMEvaluation::_empty_rb_theta_expansion
private

We initialize RBEIMEvaluation so that it has an "empty" RBThetaExpansion, because this isn't used at all in the EIM.

Definition at line 226 of file rb_eim_evaluation.h.

Referenced by RBEIMEvaluation().

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().

ReplicatedMesh libMesh::RBEIMEvaluation::_interpolation_points_mesh
private

Mesh object that we use to store copies of the elements associated with interpolation points.

Definition at line 250 of file rb_eim_evaluation.h.

Referenced by clear(), get_interpolation_points_mesh(), legacy_read_in_interpolation_points_elem(), legacy_write_out_interpolation_points_elem(), and RBEIMEvaluation().

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.

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().

std::vector<RBParametrizedFunction *> libMesh::RBEIMEvaluation::_parametrized_functions
private

This vector stores the parametrized functions that will be approximated in this EIM system.

Definition at line 214 of file rb_eim_evaluation.h.

Referenced by attach_parametrized_function(), evaluate_parametrized_function(), and get_n_parametrized_functions().

Real libMesh::RBEIMEvaluation::_previous_error_bound
private

Store the previous error bound returned by rb_solve (so we can return it if we are avoiding an unnecessary repeat solve).

Definition at line 244 of file rb_eim_evaluation.h.

Referenced by rb_solve().

unsigned int libMesh::RBEIMEvaluation::_previous_N
private

Store the number of basis functions used for the previous solve (so we can avoid an unnecessary repeat solve).

Definition at line 238 of file rb_eim_evaluation.h.

Referenced by rb_solve().

RBParameters libMesh::RBEIMEvaluation::_previous_parameters
private

Store the parameters at which the previous solve was performed (so we can avoid an unnecessary repeat solve).

Definition at line 232 of file rb_eim_evaluation.h.

Referenced by rb_solve().

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

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

Definition at line 220 of file rb_eim_evaluation.h.

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

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Aq_Aq_representor_innerprods
inherited
std::vector<std::vector<NumericVector<Number> *> > libMesh::RBEvaluation::Aq_representor
inherited

Vector storing the residual representors associated with the left-hand side.

These are basis dependent and hence stored here, whereas the Fq_representors are stored in RBSystem.

Definition at line 317 of file rb_evaluation.h.

Referenced by libMesh::RBEvaluation::clear_riesz_representors(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::RBEvaluation::resize_data_structures(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), and libMesh::RBConstruction::write_riesz_representors_to_files().

std::vector<NumericVector<Number> *> libMesh::RBEvaluation::basis_functions
inherited
bool libMesh::RBEvaluation::compute_RB_inner_product
inherited
bool libMesh::RBEvaluation::evaluate_RB_error_bound
inherited

Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called.

Definition at line 323 of file rb_evaluation.h.

Referenced by libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), and rb_solve().

std::vector<std::vector<std::vector<Number> > > libMesh::RBEvaluation::Fq_Aq_representor_innerprods
inherited
std::vector<Number> libMesh::RBEvaluation::Fq_representor_innerprods
inherited
std::vector<RBParameters> libMesh::RBEvaluation::greedy_param_list
inherited
DenseMatrix<Number> libMesh::RBEIMEvaluation::interpolation_matrix
std::vector<Point> libMesh::RBEIMEvaluation::interpolation_points
std::vector<Elem *> libMesh::RBEIMEvaluation::interpolation_points_elem
std::vector<unsigned int> libMesh::RBEIMEvaluation::interpolation_points_var
std::vector<std::vector<Number > > libMesh::RBEvaluation::output_dual_innerprods
inherited
std::vector<DenseMatrix<Number> > libMesh::RBEvaluation::RB_Aq_vector
inherited
std::vector<DenseVector<Number> > libMesh::RBEvaluation::RB_Fq_vector
inherited
DenseMatrix<Number> libMesh::RBEvaluation::RB_inner_product_matrix
inherited
std::vector<Real > libMesh::RBEvaluation::RB_output_error_bounds
inherited
std::vector<std::vector<DenseVector<Number> > > libMesh::RBEvaluation::RB_output_vectors
inherited
std::vector<Number > libMesh::RBEvaluation::RB_outputs
inherited

The vectors storing the RB output values and corresponding error bounds.

Definition at line 282 of file rb_evaluation.h.

Referenced by libMesh::RBEvaluation::rb_solve(), and libMesh::RBEvaluation::resize_data_structures().

DenseVector<Number> libMesh::RBEvaluation::RB_solution
inherited
bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 170 of file rb_parametrized.h.

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


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