libMesh
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
libMesh::RBSCMEvaluation Class Reference

This class is part of the rbOOmit framework. More...

#include <rb_scm_evaluation.h>

Inheritance diagram for libMesh::RBSCMEvaluation:
[legend]

Public Member Functions

 RBSCMEvaluation (const Parallel::Communicator &comm)
 Constructor.
 
virtual ~RBSCMEvaluation ()
 Destructor.
 
void set_rb_theta_expansion (RBThetaExpansion &rb_theta_expansion_in)
 Set the RBThetaExpansion object.
 
RBThetaExpansionget_rb_theta_expansion ()
 Get a reference to the rb_theta_expansion.
 
virtual Real get_SCM_LB ()
 Evaluate single SCM lower bound.
 
virtual Real get_SCM_UB ()
 Evaluate single SCM upper bound.
 
Real get_C_J_stability_constraint (unsigned int j) const
 Get stability constraints (i.e.
 
void set_C_J_stability_constraint (unsigned int j, Real stability_constraint_in)
 Set stability constraints (i.e.
 
Real get_SCM_UB_vector (unsigned int j, unsigned int q)
 Get entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors for the elements of C_J.
 
void set_SCM_UB_vector (unsigned int j, unsigned int q, Real y_q)
 Set entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors for the elements of C_J.
 
unsigned int get_C_J_size ()
 Get size of the set C_J.
 
const RBParametersget_C_J_entry (unsigned int j)
 Get entry of C_J.
 
Real get_C_J_stability_value (unsigned int j)
 Get entry of C_J_stability_vector.
 
Real get_B_min (unsigned int i) const
 Get B_min and B_max.
 
Real get_B_max (unsigned int i) const
 
void set_B_min (unsigned int i, Real B_min_val)
 Set B_min and B_max.
 
void set_B_max (unsigned int i, Real B_max_val)
 
virtual void save_current_parameters ()
 Helper function to save current_parameters in saved_parameters.
 
virtual void reload_current_parameters ()
 Helper function to (re)load current_parameters from saved_parameters.
 
virtual void set_current_parameters_from_C_J (unsigned int C_J_index)
 Set parameters based on values saved in "C_J".
 
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.
 
virtual void legacy_read_offline_data_from_files (const std::string &directory_name="offline_data", const bool read_binary_data=true)
 Read in the saved Offline reduced basis data to initialize the system for Online solves.
 
virtual void clear ()
 Clear all the data structures associated with the system.
 
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.
 
void initialize_parameters (const RBParametrized &rb_parametrized)
 Initialize the parameter ranges and set current_parameters.
 
unsigned int get_n_params () const
 Get the number of parameters.
 
unsigned int get_n_continuous_params () const
 Get the number of continuous parameters.
 
unsigned int get_n_discrete_params () const
 Get the number of discrete parameters.
 
const RBParametersget_parameters () const
 Get the current parameters.
 
bool set_parameters (const RBParameters &params)
 Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected.
 
const RBParametersget_parameters_min () const
 Get an RBParameters object that specifies the minimum allowable value for each parameter.
 
const RBParametersget_parameters_max () const
 Get an RBParameters object that specifies the maximum allowable value for each parameter.
 
Real get_parameter_min (const std::string &param_name) const
 Get minimum allowable value of parameter param_name.
 
Real get_parameter_max (const std::string &param_name) const
 Get maximum allowable value of parameter param_name.
 
void print_parameters () const
 Print the current parameters.
 
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.
 
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.
 
bool is_discrete_parameter (const std::string &mu_name) const
 Is parameter mu_name discrete?
 
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values () const
 Get a const reference to the discrete parameter values.
 
void print_discrete_parameter_values () const
 Print out all the discrete parameter values.
 
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.
 
static void print_info (std::ostream &out_stream=libMesh::out)
 Prints the reference information, by default to libMesh::out.
 
static unsigned int n_objects ()
 Prints the number of outstanding (created, but not yet destroyed) objects.
 
static void enable_print_counter_info ()
 Methods to enable/disable the reference counter output from print_info().
 
static void disable_print_counter_info ()
 

Public Attributes

std::vector< RealB_min
 B_min, B_max define the bounding box.
 
std::vector< RealB_max
 
std::vector< RBParametersC_J
 Vector storing the greedily selected parameters during SCM training.
 
std::vector< RealC_J_stability_vector
 Vector storing the (truth) stability values at the parameters in C_J.
 
std::vector< std::vector< Real > > SCM_UB_vectors
 This matrix stores the infimizing vectors y_1( \( \mu \)),...,y_Q_a( \( \mu \)), for each \( \mu \) in C_J, which are used in computing the SCM upper bounds.
 
bool verbose_mode
 Public boolean to toggle verbose mode.
 

Protected Types

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

Protected Member Functions

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

Protected Attributes

const Parallel::Communicator_communicator
 

Static Protected Attributes

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

Private Member Functions

void write_parameter_ranges_to_file (const std::string &file_name, const bool write_binary)
 Write out the parameter ranges to file.
 
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 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.
 
bool check_if_valid_params (const RBParameters &params) const
 Helper function to check that params is valid:
 

Static Private Member Functions

static bool is_value_in_list (Real value, const std::vector< Real > &list_of_values, Real tol)
 Helper function to check if the specified value is in the list of values (within a tolerance given by tol).
 

Private Attributes

RBParameters saved_parameters
 Vector in which to save a parameter set.
 
RBThetaExpansionrb_theta_expansion
 A pointer to to the object that stores the theta expansion.
 
bool parameters_initialized
 Flag indicating whether the parameters have been initialized.
 
RBParameters parameters
 Vector storing the current parameters.
 
RBParameters parameters_min
 Vectors that define the ranges (min and max) for the parameters.
 
RBParameters parameters_max
 
std::map< std::string, std::vector< Real > > _discrete_parameter_values
 Map that defines the allowable values of any discrete parameters.
 

Detailed Description

This class is part of the rbOOmit framework.

RBSCMEvaluation encapsulates the functionality required to evaluate the Successive Constraint Method for associated with a reduced basis model.

Author
David J. Knezevic
Date
2011

Definition at line 52 of file rb_scm_evaluation.h.

Member Typedef Documentation

◆ Counts

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

Data structure to log the information.

The log is identified by the class name.

Definition at line 119 of file reference_counter.h.

Constructor & Destructor Documentation

◆ RBSCMEvaluation()

libMesh::RBSCMEvaluation::RBSCMEvaluation ( const Parallel::Communicator comm)

Constructor.

Definition at line 52 of file rb_scm_evaluation.C.

52 :
53 ParallelObject(comm_in)
54{
55 // Clear SCM data vectors
56 B_min.clear();
57 B_max.clear();
58 C_J.clear();
60 SCM_UB_vectors.clear();
61}
ParallelObject(const Parallel::Communicator &comm_in)
Constructor.
std::vector< Real > B_max
std::vector< Real > C_J_stability_vector
Vector storing the (truth) stability values at the parameters in C_J.
std::vector< Real > B_min
B_min, B_max define the bounding box.
std::vector< std::vector< Real > > SCM_UB_vectors
This matrix stores the infimizing vectors y_1( ),...,y_Q_a( ), for each in C_J, which are used in co...
std::vector< RBParameters > C_J
Vector storing the greedily selected parameters during SCM training.

References B_max, B_min, C_J, C_J_stability_vector, and SCM_UB_vectors.

◆ ~RBSCMEvaluation()

libMesh::RBSCMEvaluation::~RBSCMEvaluation ( )
virtualdefault

Destructor.

Member Function Documentation

◆ check_if_valid_params()

bool libMesh::RBParametrized::check_if_valid_params ( const RBParameters params) const
privateinherited

Helper function to check that params is valid:

  • same number of parameters (error)
  • parameter values are within the min/max range (warning)
  • discrete values are correctly discrete within tolerance (warning) Warnings are only printed if "verbose_mode" is true.

Definition at line 378 of file rb_parametrized.C.

379{
380 // Check if number of parameters are correct.
381 libmesh_error_msg_if(params.n_parameters() != get_n_params(),
382 "Error: Number of parameters don't match; found "
383 << params.n_parameters() << ", expected "
384 << get_n_params());
385
386 bool is_valid = true;
387 std::string prev_param_name = "";
388 for (const auto & [param_name, sample_vec] : params)
389 {
390 std::size_t sample_idx = 0;
391 const Real & min_value = get_parameter_min(param_name);
392 const Real & max_value = get_parameter_max(param_name);
393 for (const auto & value_vec : sample_vec)
394 {
395 for (const auto & value : value_vec)
396 {
397 // Check every parameter value (including across samples and vector-values)
398 // to ensure it's within the min/max range.
399 const bool outside_range = ((value < min_value) || (value > max_value));
400 is_valid = is_valid && !outside_range;
401 if (outside_range && verbose_mode)
402 {
403 libMesh::out << "Warning: parameter " << param_name << " value="
404 << value << " outside acceptable range: ("
405 << min_value << ", " << max_value << ")";
406 }
407
408 // For discrete params, make sure params.get_value(param_name) is sufficiently
409 // close to one of the discrete parameter values.
410 // Note that vector-values not yet supported in discrete parameters,
411 // and the .get_sample_value() call will throw an error if the user
412 // tries to do it.
413 if (const auto it = get_discrete_parameter_values().find(param_name);
414 it != get_discrete_parameter_values().end())
415 {
416 const bool is_value_discrete =
417 is_value_in_list(params.get_sample_value(param_name, sample_idx),
418 it->second,
419 TOLERANCE);
420 is_valid = is_valid && is_value_discrete;
421 if (!is_value_discrete && verbose_mode)
422 libMesh::out << "Warning: parameter " << param_name << " value="
423 << value << " is not in discrete value list.";
424 }
425 }
426 ++sample_idx;
427 }
428 }
429 return is_valid;
430}
unsigned int get_n_params() const
Get the number of parameters.
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
static bool is_value_in_list(Real value, const std::vector< Real > &list_of_values, Real tol)
Helper function to check if the specified value is in the list of values (within a tolerance given by...
Real get_parameter_max(const std::string &param_name) const
Get maximum allowable value of parameter param_name.
Real get_parameter_min(const std::string &param_name) const
Get minimum allowable value of parameter param_name.
bool verbose_mode
Public boolean to toggle verbose mode.
OStreamProxy out
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const bool value
Definition xdr_io.C:55

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::get_n_params(), libMesh::RBParametrized::get_parameter_max(), libMesh::RBParametrized::get_parameter_min(), libMesh::RBParameters::get_sample_value(), libMesh::RBParametrized::is_value_in_list(), libMesh::RBParameters::n_parameters(), libMesh::out, libMesh::Real, libMesh::TOLERANCE, value, and libMesh::RBParametrized::verbose_mode.

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

◆ clear()

void libMesh::RBParametrized::clear ( )
virtualinherited

Clear all the data structures associated with the system.

Reimplemented in libMesh::RBConstructionBase< Base >, libMesh::RBConstructionBase< CondensedEigenSystem >, libMesh::RBConstructionBase< LinearImplicitSystem >, libMesh::RBConstructionBase< System >, libMesh::RBConstruction, libMesh::RBEIMConstruction, libMesh::RBEIMEvaluation, libMesh::RBEvaluation, libMesh::RBSCMConstruction, libMesh::TransientRBConstruction, libMesh::TransientRBEvaluation, and libMesh::TransientSystem< RBConstruction >.

Definition at line 45 of file rb_parametrized.C.

46{
51}
void clear()
Clear this object.
RBParameters parameters
Vector storing the current parameters.
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
bool parameters_initialized
Flag indicating whether the parameters have been initialized.

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

◆ comm()

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

Definition at line 97 of file parallel_object.h.

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

References libMesh::ParallelObject::_communicator.

Referenced by libMesh::__libmesh_petsc_diff_solver_jacobian(), libMesh::__libmesh_petsc_diff_solver_monitor(), libMesh::__libmesh_petsc_diff_solver_residual(), libMesh::ExactSolution::_compute_error(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::Partitioner::_find_global_index_by_pid_map(), 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::DofMap::add_constraints_to_send_list(), add_cube_convex_hull_to_mesh(), libMesh::PetscDMWrapper::add_dofs_helper(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::TransientRBConstruction::add_IC_to_RB_space(), libMesh::RBEIMEvaluation::add_interpolation_data(), libMesh::CondensedEigenSystem::add_matrices(), libMesh::EigenSystem::add_matrices(), libMesh::System::add_matrix(), libMesh::System::add_matrix(), libMesh::System::add_matrix(), libMesh::RBConstruction::add_scaled_matrix_and_vector(), libMesh::System::add_vector(), libMesh::MeshTools::Modification::all_tri(), libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::DofMap::allgather_recursive_constraints(), libMesh::RBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::allocate_data_structures(), libMesh::TransientRBConstruction::assemble_affine_expansion(), libMesh::AdvectionSystem::assemble_claw_rhs(), libMesh::FEMSystem::assemble_qoi(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::MeshCommunication::assign_global_indices(), libMesh::Partitioner::assign_partitioning(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::PetscDMWrapper::build_section(), libMesh::PetscDMWrapper::build_sf(), libMesh::MeshBase::cache_elem_data(), libMesh::DofMap::check_dirichlet_bcid_consistency(), libMesh::MeshTetInterface::check_hull_integrity(), libMesh::MeshBase::complete_preparation(), libMesh::RBConstruction::compute_Fq_representor_innerprods(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::RBConstruction::compute_output_dual_innerprods(), libMesh::RBConstruction::compute_residual_dual_norm_slow(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::DofMap::computed_sparsity_already(), libMesh::Problem_Interface::computeJacobian(), libMesh::Problem_Interface::computePreconditioner(), PetscSolverConfiguration::configure_solver(), libMesh::ContinuationSystem::ContinuationSystem(), libMesh::MeshBase::copy_constraint_rows(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::CondensedEigenSystem::copy_super_to_sub(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::MeshTools::create_bounding_box(), libMesh::DofMap::create_dof_constraints(), libMesh::MeshTools::create_nodal_bounding_box(), libMesh::MeshRefinement::create_parent_error_vector(), libMesh::MeshTools::create_processor_bounding_box(), libMesh::MeshTools::create_subdomain_bounding_box(), libMesh::PetscMatrix< T >::create_submatrix_nosort(), create_wrapped_function(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::MeshBase::detect_interior_parents(), libMesh::RBEIMEvaluation::distribute_bfs(), DMlibMeshFunction(), DMlibMeshJacobian(), DMlibMeshSetSystem_libMesh(), DMVariableBounds_libMesh(), libMesh::DTKSolutionTransfer::DTKSolutionTransfer(), libMesh::MeshRefinement::eliminate_unrefined_patches(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::TransientRBConstruction::enrich_RB_space(), libMesh::EpetraVector< T >::EpetraVector(), AssembleOptimization::equality_constraints(), libMesh::AdjointRefinementEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::WeightedPatchRecoveryErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::MeshRefinement::flag_elements_by_error_tolerance(), libMesh::MeshRefinement::flag_elements_by_mean_stddev(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::DofMap::gather_constraints(), libMesh::MeshfreeInterpolation::gather_remote_data(), libMesh::CondensedEigenSystem::get_eigenpair(), libMesh::RBEIMEvaluation::get_eim_basis_function_node_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_side_value(), libMesh::RBEIMEvaluation::get_eim_basis_function_value(), libMesh::MeshBase::get_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::ImplicitSystem::get_linear_solver(), libMesh::RBEIMConstruction::get_max_abs_value(), libMesh::RBEIMConstruction::get_node_max_abs_value(), libMesh::RBEIMEvaluation::get_parametrized_function_node_value(), libMesh::RBEIMEvaluation::get_parametrized_function_side_value(), libMesh::RBEIMEvaluation::get_parametrized_function_value(), libMesh::RBEIMConstruction::get_random_point(), libMesh::RBEIMConstruction::get_random_point(), libMesh::RBEIMConstruction::get_random_point(), libMesh::MeshTetInterface::improve_hull_integrity(), AssembleOptimization::inequality_constraints(), AssembleOptimization::inequality_constraints_jacobian(), libMesh::StaticCondensation::init(), libMesh::TimeSolver::init(), libMesh::SystemSubsetBySubdomain::init(), libMesh::LocationMap< T >::init(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), libMesh::PetscDMWrapper::init_and_attach_petscdm(), ElasticitySystem::init_data(), libMesh::AdvectionSystem::init_data(), libMesh::ClawSystem::init_data(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::OptimizationSystem::initialize_equality_constraints_storage(), libMesh::OptimizationSystem::initialize_inequality_constraints_storage(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBEIMConstruction::inner_product(), integrate_function(), libMesh::MeshTools::Modification::interpolate_surface(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_equal_connectivity(), libMesh::MeshTools::libmesh_assert_equal_points(), libMesh::MeshTools::libmesh_assert_parallel_consistent_new_node_procids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_topology_consistent_procids< Node >(), libMesh::MeshTools::libmesh_assert_valid_boundary_ids(), libMesh::MeshTools::libmesh_assert_valid_constraint_rows(), libMesh::MeshTools::libmesh_assert_valid_dof_ids(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_flags(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_p_levels(), libMesh::MeshTools::libmesh_assert_valid_refinement_flags(), libMesh::MeshTools::libmesh_assert_valid_unique_ids(), libMesh::libmesh_petsc_linesearch_shellfunc(), libMesh::libmesh_petsc_preconditioner_apply(), libMesh::libmesh_petsc_snes_mffd_interface(), libMesh::libmesh_petsc_snes_postcheck(), libMesh::MeshRefinement::limit_level_mismatch_at_edge(), libMesh::MeshRefinement::limit_level_mismatch_at_node(), libMesh::MeshRefinement::limit_overrefined_boundary(), libMesh::MeshRefinement::limit_underrefined_boundary(), libMesh::LinearImplicitSystem::LinearImplicitSystem(), main(), libMesh::MeshCommunication::make_elems_parallel_consistent(), libMesh::MeshCommunication::make_new_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_new_nodes_parallel_consistent(), libMesh::MeshCommunication::make_node_bcids_parallel_consistent(), libMesh::MeshCommunication::make_node_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_proc_ids_parallel_consistent(), libMesh::MeshCommunication::make_node_unique_ids_parallel_consistent(), libMesh::MeshCommunication::make_nodes_parallel_consistent(), libMesh::MeshCommunication::make_p_levels_parallel_consistent(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::FEMSystem::mesh_position_set(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), LinearElasticityWithContact::move_mesh(), libMesh::DistributedMesh::n_active_elem(), libMesh::MeshTools::n_active_levels(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::DofMap::n_constrained_dofs(), libMesh::MeshBase::n_constraint_rows(), libMesh::DofMap::n_dofs(), libMesh::DofMap::n_dofs_per_processor(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::CondensedEigenSystem::n_global_non_condensed_dofs(), libMesh::MeshTools::n_levels(), MixedOrderTest::n_neighbor_links(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::SparsityPattern::Build::n_nonzeros(), libMesh::MeshTools::n_p_levels(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::RBEIMConstruction::node_inner_product(), libMesh::PetscVector< T >::operator=(), libMesh::MeshBase::operator==(), libMesh::DistributedMesh::parallel_max_elem_id(), libMesh::DistributedMesh::parallel_max_node_id(), libMesh::DistributedMesh::parallel_max_unique_id(), libMesh::ReplicatedMesh::parallel_max_unique_id(), libMesh::DistributedMesh::parallel_n_elem(), libMesh::DistributedMesh::parallel_n_nodes(), libMesh::SparsityPattern::Build::parallel_sync(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshTools::paranoid_n_levels(), libMesh::Partitioner::partition(), libMesh::Partitioner::partition_unpartitioned_elements(), libMesh::petsc_auto_fieldsplit(), LaplaceSystem::postprocess(), PoissonSystem::postprocess(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Partitioner::processor_pairs_to_interface_nodes(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::XdrIO::read(), libMesh::Nemesis_IO::read(), FEMParameters::read(), libMesh::EquationSystems::read(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::read_header(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), libMesh::RBEvaluation::read_in_vectors_from_multiple_files(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), MeshFunctionTest::read_variable_info_from_output_data(), libMesh::MeshBase::recalculate_n_partitions(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::BoundaryInfo::remove_edge_id(), libMesh::BoundaryInfo::remove_node_id(), libMesh::BoundaryInfo::remove_shellface_id(), libMesh::BoundaryInfo::remove_side_id(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), LinearElasticityWithContact::residual_and_jacobian(), OverlappingAlgebraicGhostingTest::run_ghosting_test(), OverlappingCouplingGhostingTest::run_sparsity_pattern_test(), scale_mesh_and_plot(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::send_and_insert_dof_values(), libMesh::TransientRBConstruction::set_error_temporal_data(), libMesh::Partitioner::set_interface_node_processor_ids_BFS(), libMesh::Partitioner::set_interface_node_processor_ids_linear(), libMesh::Partitioner::set_interface_node_processor_ids_petscpartitioner(), libMesh::Partitioner::set_node_processor_ids(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::Partitioner::set_parent_processor_ids(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::PetscDiffSolver::setup_petsc_data(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::RBEIMConstruction::side_inner_product(), libMesh::Partitioner::single_partition(), libMesh::LaplaceMeshSmoother::smooth(), libMesh::VariationalMeshSmoother::smooth(), libMesh::NoxNonlinearSolver< Number >::solve(), libMesh::ClawSystem::solve_conservation_law(), libMesh::split_mesh(), libMesh::RBEIMConstruction::store_eim_solutions_for_training_set(), libMesh::MeshBase::subdomain_ids(), libMesh::BoundaryInfo::sync(), libMesh::MeshBase::sync_subdomain_name_map(), ConstraintOperatorTest::test1DCoarseningNewNodes(), ConstraintOperatorTest::test1DCoarseningOperator(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), MeshfunctionDFEM::test_mesh_function_dfem(), MeshfunctionDFEM::test_mesh_function_dfem_grad(), MeshFunctionTest::test_p_level(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), DofMapTest::testBadElemFECombo(), SystemsTest::testBlockRestrictedVarNDofs(), BoundaryInfoTest::testBoundaryOnChildrenErrors(), CheckpointIOTest::testC0PolygonCheckpoint(), VolumeTest::testC0PolygonMethods(), CheckpointIOTest::testC0PolyhedronCheckpoint(), VolumeTest::testC0PolyhedronMethods(), ConstraintOperatorTest::testCoreform(), ConnectedComponentsTest::testEdge(), MeshInputTest::testExodusIGASidesets(), MeshTriangulationTest::testFoundCenters(), PointLocatorTest::testLocator(), BoundaryInfoTest::testMesh(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), PointLocatorTest::testPlanar(), MeshTriangulationTest::testPoly2TriEdge3ToTri7CenterFixup(), MeshTriangulationTest::testPoly2TriRefinementBase(), SystemsTest::testProjectCubeWithMeshFunction(), SystemsTest::testProjectScalarCoarsening(), BoundaryInfoTest::testRenumber(), BoundaryInfoTest::testSelectiveRenumber(), BoundaryMeshSubdomainTest::testSingleSubdomain(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshTriangulationTest::testTriangulatorInterp(), MeshTriangulationTest::testTriangulatorMeshedHoles(), MeshTriangulationTest::testTriangulatorRoundHole(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::RBConstruction::train_reduced_basis_with_POD(), libMesh::MeshfreeSolutionTransfer::transfer(), libMesh::MeshFunctionSolutionTransfer::transfer(), libMesh::Poly2TriTriangulator::triangulate(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_assembly(), update_current_local_solution(), libMesh::TransientRBConstruction::update_RB_initial_condition_all_N(), libMesh::RBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_RB_system_matrices(), libMesh::TransientRBConstruction::update_residual_terms(), libMesh::RBConstruction::update_residual_terms(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::write(), libMesh::VTKIO::write_nodal_data(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::RBEvaluation::write_out_vectors(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::TransientRBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::TransientRBEvaluationSerialization::write_to_file(), libMesh::RBDataSerialization::RBEIMEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 100 of file reference_counter.C.

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

References libMesh::ReferenceCounter::_enable_print_counter.

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Enabled by default.

Definition at line 94 of file reference_counter.C.

95{
97 return;
98}

References libMesh::ReferenceCounter::_enable_print_counter.

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

◆ get_B_max()

Real libMesh::RBSCMEvaluation::get_B_max ( unsigned int  i) const

Definition at line 130 of file rb_scm_evaluation.C.

131{
132 libmesh_error_msg_if(q >= B_max.size(), "Error: q is too large in get_B_max.");
133
134 return B_max[q];
135}

References B_max.

Referenced by libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), libMesh::RBSCMConstruction::compute_SCM_bounding_box(), and legacy_write_offline_data_to_files().

◆ get_B_min()

Real libMesh::RBSCMEvaluation::get_B_min ( unsigned int  i) const

Get B_min and B_max.

Definition at line 122 of file rb_scm_evaluation.C.

123{
124 libmesh_error_msg_if(q >= B_min.size(), "Error: q is too large in get_B_min.");
125
126 return B_min[q];
127}

References B_min.

Referenced by libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), libMesh::RBSCMConstruction::compute_SCM_bounding_box(), and legacy_write_offline_data_to_files().

◆ get_C_J_entry()

const RBParameters & libMesh::RBSCMEvaluation::get_C_J_entry ( unsigned int  j)

Get entry of C_J.

Definition at line 115 of file rb_scm_evaluation.C.

116{
117 libmesh_error_msg_if(j >= C_J.size(), "Error: Input parameter j is too large in get_C_J.");
118
119 return C_J[j];
120}

References C_J.

◆ get_C_J_size()

unsigned int libMesh::RBSCMEvaluation::get_C_J_size ( )
inline

Get size of the set C_J.

Definition at line 120 of file rb_scm_evaluation.h.

121 { return cast_int<unsigned int>(C_J.size()); }

References C_J.

◆ get_C_J_stability_constraint()

Real libMesh::RBSCMEvaluation::get_C_J_stability_constraint ( unsigned int  j) const

Get stability constraints (i.e.

the values of coercivity/ inf-sup/stability constants at the parameter values chosen during the greedy); we store one constraint for each element of C_J.

Definition at line 88 of file rb_scm_evaluation.C.

89{
90 libmesh_error_msg_if(j >= C_J_stability_vector.size(), "Error: Input parameter j is too large in get_C_J_stability_constraint.");
91
92 return C_J_stability_vector[j];
93}

References C_J_stability_vector.

Referenced by libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), libMesh::RBSCMConstruction::evaluate_stability_constant(), and legacy_write_offline_data_to_files().

◆ get_C_J_stability_value()

Real libMesh::RBSCMEvaluation::get_C_J_stability_value ( unsigned int  j)
inline

Get entry of C_J_stability_vector.

Definition at line 131 of file rb_scm_evaluation.h.

131{ return C_J_stability_vector[j]; }

References C_J_stability_vector.

◆ get_closest_value()

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

Definition at line 432 of file rb_parametrized.C.

433{
434 libmesh_error_msg_if(list_of_values.empty(), "Error: list_of_values is empty.");
435
436 Real min_distance = std::numeric_limits<Real>::max();
437 Real closest_val = 0.;
438 for (const auto & current_value : list_of_values)
439 {
440 Real distance = std::abs(value - current_value);
441 if (distance < min_distance)
442 {
443 min_distance = distance;
444 closest_val = current_value;
445 }
446 }
447
448 return closest_val;
449}
Real distance(const Point &p)

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

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

◆ get_discrete_parameter_values()

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

Get a const reference to the discrete parameter values.

Definition at line 359 of file rb_parametrized.C.

360{
361 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_discrete_parameter_values");
362
364}
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.

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

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

◆ get_info()

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

Gets a string containing the reference information.

Definition at line 47 of file reference_counter.C.

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

References libMesh::ReferenceCounter::_counts.

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

◆ get_n_continuous_params()

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

Get the number of continuous parameters.

Definition at line 112 of file rb_parametrized.C.

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

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

◆ get_n_discrete_params()

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

Get the number of discrete parameters.

Definition at line 121 of file rb_parametrized.C.

122{
123 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_n_discrete_params");
124
125 return cast_int<unsigned int>
127}

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

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

◆ get_n_params()

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

◆ get_parameter_max()

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

Get maximum allowable value of parameter param_name.

Definition at line 171 of file rb_parametrized.C.

172{
173 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_max");
174
175 return parameters_max.get_value(param_name);
176}
Real get_value(const std::string &param_name) const
Get the value of the specified parameter, throw an error if it does not exist.

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

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

◆ get_parameter_min()

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

Get minimum allowable value of parameter param_name.

Definition at line 164 of file rb_parametrized.C.

165{
166 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameter_min");
167
168 return parameters_min.get_value(param_name);
169}

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

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

◆ get_parameters()

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

Get the current parameters.

Definition at line 143 of file rb_parametrized.C.

144{
145 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::get_parameters");
146
147 return parameters;
148}

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

Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::TransientRBEvaluation::cache_online_residual_terms(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBEvaluation::eval_output_dual_norm(), libMesh::RBSCMConstruction::evaluate_stability_constant(), libMesh::RBConstruction::get_RB_error_bound(), get_SCM_LB(), get_SCM_UB(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBConstruction::greedy_termination_test(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), legacy_read_offline_data_from_files(), main(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBConstruction::preevaluate_thetas(), libMesh::RBEIMConstruction::print_info(), 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(), save_current_parameters(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().

◆ get_parameters_max()

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

◆ get_parameters_min()

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

◆ get_rb_theta_expansion()

RBThetaExpansion & libMesh::RBSCMEvaluation::get_rb_theta_expansion ( )

Get a reference to the rb_theta_expansion.

Definition at line 70 of file rb_scm_evaluation.C.

71{
72 libmesh_error_msg_if(!rb_theta_expansion, "Error: rb_theta_expansion hasn't been initialized yet");
73
74 return *rb_theta_expansion;
75}
RBThetaExpansion * rb_theta_expansion
A pointer to to the object that stores the theta expansion.

References rb_theta_expansion.

Referenced by libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), libMesh::RBSCMConstruction::get_rb_theta_expansion(), and libMesh::RBDataDeserialization::load_rb_scm_evaluation_data().

◆ get_SCM_LB()

Real libMesh::RBSCMEvaluation::get_SCM_LB ( )
virtual

Evaluate single SCM lower bound.

Definition at line 151 of file rb_scm_evaluation.C.

152{
153 LOG_SCOPE("get_SCM_LB()", "RBSCMEvaluation");
154
155 // Initialize the LP
156 glp_prob * lp;
157 lp = glp_create_prob();
158 glp_set_obj_dir(lp,GLP_MIN);
159
160 // Add columns to the LP: corresponds to
161 // the variables y_1,...y_Q_a.
162 // These are the same for each \mu in the SCM
163 // training set, hence can do this up front.
164 glp_add_cols(lp,rb_theta_expansion->get_n_A_terms());
165
166 for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
167 {
168 if (B_max[q] < B_min[q]) // Invalid bound, set as free variable
169 {
170 // GLPK indexing is not zero based!
171 glp_set_col_bnds(lp, q+1, GLP_FR, 0., 0.);
172 }
173 else
174 {
175 // GLPK indexing is not zero based!
176 glp_set_col_bnds(lp, q+1, GLP_DB, double(B_min[q]), double(B_max[q]));
177 }
178
179 // If B_max is not defined, just set lower bounds...
180 // glp_set_col_bnds(lp, q+1, GLP_LO, B_min[q], 0.);
181 }
182
183
184 // Add rows to the LP: corresponds to the auxiliary
185 // variables that define the constraints at each
186 // mu \in C_J_M
187 unsigned int n_rows = cast_int<unsigned int>(C_J.size());
188 glp_add_rows(lp, n_rows);
189
190 // Now put current_parameters in saved_parameters
192
193 unsigned int matrix_size = n_rows*rb_theta_expansion->get_n_A_terms();
194 std::vector<int> ia(matrix_size+1);
195 std::vector<int> ja(matrix_size+1);
196 std::vector<double> ar(matrix_size+1);
197 unsigned int count=0;
198 for (unsigned int m=0; m<n_rows; m++)
199 {
201
202 // Set the lower bound on the auxiliary variable
203 // due to the stability constant at mu_index
204 glp_set_row_bnds(lp, m+1, GLP_LO, double(C_J_stability_vector[m]), 0.);
205
206 // Now define the matrix that relates the y's
207 // to the auxiliary variables at the current
208 // value of mu.
209 for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
210 {
211 count++;
212
213 ia[count] = m+1;
214 ja[count] = q+1;
215
216 // This can only handle Reals right now
217 ar[count] = double(libmesh_real( rb_theta_expansion->eval_A_theta(q,get_parameters()) ));
218 }
219 }
220
221 // Now load the original parameters back into current_parameters
222 // in order to set the coefficients of the objective function
224
225 glp_load_matrix(lp, matrix_size, ia.data(), ja.data(), ar.data());
226
227 for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
228 {
229 glp_set_obj_coef(lp,q+1, double(libmesh_real( rb_theta_expansion->eval_A_theta(q,get_parameters()) )) );
230 }
231
232 // Use this command to initialize the basis for the LP
233 // since default behavior is to use the basis from
234 // the previous solve, but that might become singular
235 // if we switch the order of constraints (as can
236 // happen when we generate a new C_J_M)
237 //lpx_cpx_basis(lp); //glp_cpx_basis(lp);
238
239 glp_smcp parm;
240 glp_init_smcp(&parm);
241 parm.msg_lev = GLP_MSG_ERR;
242 parm.meth = GLP_DUAL;
243
244
245 // use the simplex method and solve the LP
246 glp_simplex(lp, &parm);
247
248 Real min_J_obj = glp_get_obj_val(lp);
249
250 // int simplex_status = glp_get_status(lp);
251 // if (simplex_status == GLP_UNBND)
252 // {
253 // libMesh::out << "Simplex method gave unbounded solution." << std::endl;
254 // min_J_obj = std::numeric_limits<Real>::quiet_NaN();
255 // }
256 // else
257 // {
258 // min_J_obj = glp_get_obj_val(lp);
259 // }
260
261 // Destroy the LP
262 glp_delete_prob(lp);
263
264 return min_J_obj;
265}
const RBParameters & get_parameters() const
Get the current parameters.
virtual void set_current_parameters_from_C_J(unsigned int C_J_index)
Set parameters based on values saved in "C_J".
virtual void reload_current_parameters()
Helper function to (re)load current_parameters from saved_parameters.
virtual void save_current_parameters()
Helper function to save current_parameters in saved_parameters.
unsigned int get_n_A_terms() const
Get Q_a, the number of terms in the affine expansion for the bilinear form.
virtual Number eval_A_theta(unsigned int q, const RBParameters &mu) const
Evaluate theta_q_a at the current parameter.
T libmesh_real(T a)

References B_max, B_min, C_J, C_J_stability_vector, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBParametrized::get_parameters(), libMesh::libmesh_real(), rb_theta_expansion, libMesh::Real, reload_current_parameters(), save_current_parameters(), and set_current_parameters_from_C_J().

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), and SimpleRBEvaluation::get_stability_lower_bound().

◆ get_SCM_UB()

Real libMesh::RBSCMEvaluation::get_SCM_UB ( )
virtual

Evaluate single SCM upper bound.

Definition at line 267 of file rb_scm_evaluation.C.

268{
269 LOG_SCOPE("get_SCM_UB()", "RBSCMEvaluation");
270
271 // Add rows to the LP: corresponds to the auxiliary
272 // variables that define the constraints at each
273 // mu \in C_J
274 unsigned int n_rows = cast_int<unsigned int>(C_J.size());
275
276 // For each mu, we just find the minimum of J_obj over
277 // the subset of vectors in SCM_UB_vectors corresponding
278 // to C_J_M (SCM_UB_vectors contains vectors for all of
279 // C_J).
280 Real min_J_obj = 0.;
281 for (unsigned int m=0; m<n_rows; m++)
282 {
283 const std::vector<Real> UB_vector = SCM_UB_vectors[m];
284
285 Real J_obj = 0.;
286 for (unsigned int q=0; q<rb_theta_expansion->get_n_A_terms(); q++)
287 {
288 J_obj += libmesh_real( rb_theta_expansion->eval_A_theta(q,get_parameters()) )*UB_vector[q];
289 }
290
291 if ((m==0) || (J_obj < min_J_obj))
292 {
293 min_J_obj = J_obj;
294 }
295 }
296
297 return min_J_obj;
298}

References C_J, libMesh::RBThetaExpansion::eval_A_theta(), libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBParametrized::get_parameters(), libMesh::libmesh_real(), rb_theta_expansion, libMesh::Real, and SCM_UB_vectors.

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set().

◆ get_SCM_UB_vector()

Real libMesh::RBSCMEvaluation::get_SCM_UB_vector ( unsigned int  j,
unsigned int  q 
)

Get entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors for the elements of C_J.

Definition at line 106 of file rb_scm_evaluation.C.

107{
108 // First make sure that j <= J
109 libmesh_error_msg_if(j >= SCM_UB_vectors.size(), "Error: We must have j < J in get_SCM_UB_vector.");
110 libmesh_error_msg_if(q >= SCM_UB_vectors[0].size(), "Error: q is too large in get_SCM_UB_vector.");
111
112 return SCM_UB_vectors[j][q];
113}

References SCM_UB_vectors.

Referenced by libMesh::RBDataSerialization::add_rb_scm_evaluation_data_to_builder(), and legacy_write_offline_data_to_files().

◆ increment_constructor_count()

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

Increments the construction counter.

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

Definition at line 183 of file reference_counter.h.

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

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

Referenced by libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), libMesh::ReferenceCountedObject< T >::ReferenceCountedObject(), and libMesh::ReferenceCountedObject< T >::ReferenceCountedObject().

◆ increment_destructor_count()

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

Increments the destruction counter.

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

Definition at line 207 of file reference_counter.h.

208{
209 libmesh_try
210 {
211 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
212 std::pair<unsigned int, unsigned int> & p = _counts[name];
213 p.second++;
214 }
215 libmesh_catch (...)
216 {
217 auto stream = libMesh::err.get();
218 stream->exceptions(stream->goodbit); // stream must not throw
219 libMesh::err << "Encountered unrecoverable error while calling "
220 << "ReferenceCounter::increment_destructor_count() "
221 << "for a(n) " << name << " object." << std::endl;
222 std::terminate();
223 }
224}

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

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

◆ initialize_parameters() [1/2]

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

Initialize the parameter ranges and set current_parameters.

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

Definition at line 53 of file rb_parametrized.C.

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

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

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

◆ initialize_parameters() [2/2]

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

Initialize the parameter ranges and set current_parameters.

Definition at line 96 of file rb_parametrized.C.

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

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

◆ is_discrete_parameter()

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

Is parameter mu_name discrete?

Definition at line 351 of file rb_parametrized.C.

352{
353 libmesh_error_msg_if(!parameters_initialized,
354 "Error: parameters not initialized in RBParametrized::is_discrete_parameter");
355
356 return _discrete_parameter_values.count(mu_name);
357}

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

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

◆ is_value_in_list()

bool libMesh::RBParametrized::is_value_in_list ( Real  value,
const std::vector< Real > &  list_of_values,
Real  tol 
)
staticprivateinherited

Helper function to check if the specified value is in the list of values (within a tolerance given by tol).

Definition at line 451 of file rb_parametrized.C.

452{
453 Real closest_value = get_closest_value(value, list_of_values);
454
455 // Check if relative tolerance is satisfied
456 Real rel_error = std::abs(value - closest_value) / std::abs(value);
457 if (rel_error <= tol)
458 {
459 return true;
460 }
461
462 // If relative tolerance isn't satisfied, we should still check an absolute
463 // error, since relative tolerance can be misleading if value is close to zero
464 Real abs_error = std::abs(value - closest_value);
465 return (abs_error <= tol);
466}
static Real get_closest_value(Real value, const std::vector< Real > &list_of_values)

References libMesh::RBParametrized::get_closest_value(), libMesh::Real, and value.

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

◆ legacy_read_offline_data_from_files()

void libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files ( const std::string &  directory_name = "offline_data",
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.

Definition at line 432 of file rb_scm_evaluation.C.

434{
435 LOG_SCOPE("legacy_read_offline_data_from_files()", "RBSCMEvaluation");
436
437 // The reading mode: DECODE for binary, READ for ASCII
438 XdrMODE mode = read_binary_data ? DECODE : READ;
439
440 // The suffix to use for all the files that are written out
441 const std::string suffix = read_binary_data ? ".xdr" : ".dat";
442
443 // The string stream we'll use to make the file names
444 std::ostringstream file_name;
445
446 // Read in the parameter ranges
447 file_name.str("");
448 file_name << directory_name << "/parameter_ranges" << suffix;
449 std::string continuous_param_file_name = file_name.str();
450
451 // Read in the discrete parameter values
452 file_name.str("");
453 file_name << directory_name << "/discrete_parameter_values" << suffix;
454 std::string discrete_param_file_name = file_name.str();
455 read_parameter_data_from_files(continuous_param_file_name,
456 discrete_param_file_name,
457 read_binary_data);
458
459 // Read in the bounding box min values
460 // Note that there are Q_a values
461 file_name.str("");
462 file_name << directory_name << "/B_min" << suffix;
463 Xdr B_min_in(file_name.str(), mode);
464
465 B_min.clear();
466 for (unsigned int i=0; i<rb_theta_expansion->get_n_A_terms(); i++)
467 {
468 Real B_min_val;
469 B_min_in >> B_min_val;
470 B_min.push_back(B_min_val);
471 }
472 B_min_in.close();
473
474
475 // Read in the bounding box max values
476 // Note that there are Q_a values
477 file_name.str("");
478 file_name << directory_name << "/B_max" << suffix;
479 Xdr B_max_in(file_name.str(), mode);
480
481 B_max.clear();
482 for (unsigned int i=0; i<rb_theta_expansion->get_n_A_terms(); i++)
483 {
484 Real B_max_val;
485 B_max_in >> B_max_val;
486 B_max.push_back(B_max_val);
487 }
488
489 // Read in the length of the C_J data
490 file_name.str("");
491 file_name << directory_name << "/C_J_length" << suffix;
492 Xdr C_J_length_in(file_name.str(), mode);
493
494 unsigned int C_J_length;
495 C_J_length_in >> C_J_length;
496 C_J_length_in.close();
497
498 // Read in C_J_stability_vector
499 file_name.str("");
500 file_name << directory_name << "/C_J_stability_vector" << suffix;
501 Xdr C_J_stability_vector_in(file_name.str(), mode);
502
503 C_J_stability_vector.clear();
504 for (unsigned int i=0; i<C_J_length; i++)
505 {
506 Real C_J_stability_val;
507 C_J_stability_vector_in >> C_J_stability_val;
508 C_J_stability_vector.push_back(C_J_stability_val);
509 }
510 C_J_stability_vector_in.close();
511
512 // Read in C_J
513 file_name.str("");
514 file_name << directory_name << "/C_J" << suffix;
515 Xdr C_J_in(file_name.str(), mode);
516
517 // Resize C_J based on C_J_stability_vector and Q_a
518 C_J.resize( C_J_length );
519 for (auto & params : C_J)
520 for (const auto & pr : get_parameters())
521 {
522 const std::string & param_name = pr.first;
523 Real param_value;
524 C_J_in >> param_value;
525 params.set_value(param_name, param_value);
526 }
527 C_J_in.close();
528
529
530 // Read in SCM_UB_vectors get_SCM_UB_vector
531 file_name.str("");
532 file_name << directory_name << "/SCM_UB_vectors" << suffix;
533 Xdr SCM_UB_vectors_in(file_name.str(), mode);
534
535 // Resize SCM_UB_vectors based on C_J_stability_vector and Q_a
536 SCM_UB_vectors.resize( C_J_stability_vector.size() );
537 for (auto i : index_range(SCM_UB_vectors))
538 {
540 for (unsigned int j=0; j<rb_theta_expansion->get_n_A_terms(); j++)
541 {
542 SCM_UB_vectors_in >> SCM_UB_vectors[i][j];
543 }
544 }
545 SCM_UB_vectors_in.close();
546}
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.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition int_range.h:153
XdrMODE
Defines an enum for read/write mode in Xdr format.

References B_max, B_min, C_J, C_J_stability_vector, libMesh::Xdr::close(), libMesh::DECODE, libMesh::RBThetaExpansion::get_n_A_terms(), libMesh::RBParametrized::get_parameters(), libMesh::index_range(), rb_theta_expansion, libMesh::READ, libMesh::RBParametrized::read_parameter_data_from_files(), libMesh::Real, and SCM_UB_vectors.

Referenced by main().

◆ legacy_write_offline_data_to_files()

void libMesh::RBSCMEvaluation::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.

Definition at line 315 of file rb_scm_evaluation.C.

317{
318 LOG_SCOPE("legacy_write_offline_data_to_files()", "RBSCMEvaluation");
319
320 if (this->processor_id() == 0)
321 {
322 // Make a directory to store all the data files
323 if (mkdir(directory_name.c_str(), 0777) == -1)
324 {
325 libMesh::out << "In RBSCMEvaluation::write_offline_data_to_files, directory "
326 << directory_name << " already exists, overwriting contents." << std::endl;
327 }
328
329 // The writing mode: ENCODE for binary, WRITE for ASCII
330 XdrMODE mode = write_binary_data ? ENCODE : WRITE;
331
332 // The suffix to use for all the files that are written out
333 const std::string suffix = write_binary_data ? ".xdr" : ".dat";
334
335 // Stream for building the file names
336 std::ostringstream file_name;
337
338 // Write out the parameter ranges
339 file_name.str("");
340 file_name << directory_name << "/parameter_ranges" << suffix;
341 std::string continuous_param_file_name = file_name.str();
342
343 // Write out the discrete parameter values
344 file_name.str("");
345 file_name << directory_name << "/discrete_parameter_values" << suffix;
346 std::string discrete_param_file_name = file_name.str();
347
348 write_parameter_data_to_files(continuous_param_file_name,
349 discrete_param_file_name,
350 write_binary_data);
351
352 // Write out the bounding box min values
353 file_name.str("");
354 file_name << directory_name << "/B_min" << suffix;
355 Xdr B_min_out(file_name.str(), mode);
356
357 for (auto i : make_range(B_min.size()))
358 {
359 Real B_min_i = get_B_min(i);
360 B_min_out << B_min_i;
361 }
362 B_min_out.close();
363
364
365 // Write out the bounding box max values
366 file_name.str("");
367 file_name << directory_name << "/B_max" << suffix;
368 Xdr B_max_out(file_name.str(), mode);
369
370 for (auto i : make_range(B_max.size()))
371 {
372 Real B_max_i = get_B_max(i);
373 B_max_out << B_max_i;
374 }
375 B_max_out.close();
376
377 // Write out the length of the C_J data
378 file_name.str("");
379 file_name << directory_name << "/C_J_length" << suffix;
380 Xdr C_J_length_out(file_name.str(), mode);
381
382 unsigned int C_J_length = cast_int<unsigned int>(C_J.size());
383 C_J_length_out << C_J_length;
384 C_J_length_out.close();
385
386 // Write out C_J_stability_vector
387 file_name.str("");
388 file_name << directory_name << "/C_J_stability_vector" << suffix;
389 Xdr C_J_stability_vector_out(file_name.str(), mode);
390
391 for (auto i : make_range(C_J_stability_vector.size()))
392 {
393 Real C_J_stability_constraint_i = get_C_J_stability_constraint(i);
394 C_J_stability_vector_out << C_J_stability_constraint_i;
395 }
396 C_J_stability_vector_out.close();
397
398 // Write out C_J
399 file_name.str("");
400 file_name << directory_name << "/C_J" << suffix;
401 Xdr C_J_out(file_name.str(), mode);
402
403 for (const auto & param : C_J)
404 for (const auto & pr : param)
405 for (const auto & value_vector : pr.second)
406 {
407 // Need to make a copy of the value so that it's not const
408 // Xdr is not templated on const's
409 libmesh_error_msg_if(value_vector.size() != 1,
410 "Error: multi-value RB parameters are not yet supported here.");
411 Real param_value = value_vector[0];
412 C_J_out << param_value;
413 }
414 C_J_out.close();
415
416 // Write out SCM_UB_vectors get_SCM_UB_vector
417 file_name.str("");
418 file_name << directory_name << "/SCM_UB_vectors" << suffix;
419 Xdr SCM_UB_vectors_out(file_name.str(), mode);
420
421 for (auto i : make_range(SCM_UB_vectors.size()))
422 for (auto j : make_range(rb_theta_expansion->get_n_A_terms()))
423 {
424 Real SCM_UB_vector_ij = get_SCM_UB_vector(i,j);
425 SCM_UB_vectors_out << SCM_UB_vector_ij;
426 }
427 SCM_UB_vectors_out.close();
428 }
429}
processor_id_type processor_id() const
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.
Real get_B_min(unsigned int i) const
Get B_min and B_max.
Real get_C_J_stability_constraint(unsigned int j) const
Get stability constraints (i.e.
Real get_SCM_UB_vector(unsigned int j, unsigned int q)
Get entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors...
Real get_B_max(unsigned int i) const
int mkdir(const char *pathname)
Create a directory.
Definition utility.C:152
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
Definition int_range.h:176

References B_max, B_min, C_J, C_J_stability_vector, libMesh::Xdr::close(), libMesh::ENCODE, get_B_max(), get_B_min(), get_C_J_stability_constraint(), libMesh::RBThetaExpansion::get_n_A_terms(), get_SCM_UB_vector(), libMesh::make_range(), libMesh::out, libMesh::ParallelObject::processor_id(), rb_theta_expansion, libMesh::Real, SCM_UB_vectors, libMesh::WRITE, and libMesh::RBParametrized::write_parameter_data_to_files().

◆ n_objects()

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

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

Definition at line 85 of file reference_counter.h.

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

References libMesh::ReferenceCounter::_n_objects.

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

◆ n_processors()

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

Definition at line 103 of file parallel_object.h.

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

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

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

◆ print_discrete_parameter_values()

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

Print out all the discrete parameter values.

Definition at line 366 of file rb_parametrized.C.

367{
368 for (const auto & [name, values] : get_discrete_parameter_values())
369 {
370 libMesh::out << "Discrete parameter " << name << ", values: ";
371
372 for (const auto & value : values)
373 libMesh::out << value << " ";
374 libMesh::out << std::endl;
375 }
376}
The libMesh namespace provides an interface to certain functionality in the library.

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

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

◆ print_info()

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

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

Definition at line 81 of file reference_counter.C.

82{
84 out_stream << ReferenceCounter::get_info();
85}
static std::string get_info()
Gets a string containing the reference information.

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

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

◆ print_parameters()

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

Print the current parameters.

Definition at line 178 of file rb_parametrized.C.

179{
180 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::print_current_parameters");
181
183}
void print(unsigned precision=6, int max_values=5) const
Print the parameters.

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

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

◆ processor_id()

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

Definition at line 114 of file parallel_object.h.

115 { return cast_int<processor_id_type>(_communicator.rank()); }
processor_id_type rank() const

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

Referenced by libMesh::BoundaryInfo::_find_id_maps(), libMesh::PetscDMWrapper::add_dofs_to_section(), libMesh::DistributedMesh::add_elem(), libMesh::BoundaryInfo::add_elements(), libMesh::DistributedMesh::add_node(), libMesh::MeshTools::Modification::all_tri(), libMesh::FEMSystem::assembly(), libMesh::Nemesis_IO::assert_symmetric_cmaps(), libMesh::Partitioner::assign_partitioning(), libMesh::Nemesis_IO_Helper::build_element_and_node_maps(), libMesh::Partitioner::build_graph(), libMesh::InfElemBuilder::build_inf_elem(), libMesh::BoundaryInfo::build_node_list_from_side_list(), libMesh::EquationSystems::build_parallel_elemental_solution_vector(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::MeshFunction::check_found_elem(), libMesh::DistributedMesh::clear(), libMesh::DistributedMesh::clear_elems(), libMesh::ExodusII_IO_Helper::close(), libMesh::Nemesis_IO_Helper::compute_border_node_ids(), libMesh::Nemesis_IO_Helper::compute_communication_map_parameters(), libMesh::Nemesis_IO_Helper::compute_internal_and_border_elems_and_internal_nodes(), libMesh::RBConstruction::compute_max_error_bound(), libMesh::Nemesis_IO_Helper::compute_node_communication_maps(), libMesh::Nemesis_IO_Helper::compute_num_global_elem_blocks(), libMesh::Nemesis_IO_Helper::compute_num_global_nodesets(), libMesh::Nemesis_IO_Helper::compute_num_global_sidesets(), libMesh::Nemesis_IO_Helper::construct_nemesis_filename(), libMesh::ExodusII_IO::copy_elemental_solution(), libMesh::ExodusII_IO::copy_nodal_solution(), libMesh::ExodusII_IO::copy_scalar_solution(), libMesh::Nemesis_IO::copy_scalar_solution(), libMesh::MeshTools::correct_node_proc_ids(), libMesh::ExodusII_IO_Helper::create(), libMesh::MeshCommunication::delete_remote_elements(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DistributedMesh::DistributedMesh(), libMesh::DofMapBase::end_dof(), libMesh::DofMapBase::end_old_dof(), libMesh::EnsightIO::EnsightIO(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::find_dofs_to_send(), libMesh::UnstructuredMesh::find_neighbors(), libMesh::DofMapBase::first_dof(), libMesh::DofMapBase::first_old_dof(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::Nemesis_IO_Helper::get_cmap_params(), libMesh::Nemesis_IO_Helper::get_eb_info_global(), libMesh::Nemesis_IO_Helper::get_elem_cmap(), libMesh::Nemesis_IO_Helper::get_elem_map(), libMesh::MeshBase::get_info(), libMesh::Nemesis_IO_Helper::get_init_global(), libMesh::Nemesis_IO_Helper::get_init_info(), libMesh::RBEIMEvaluation::get_interior_basis_functions_as_vecs(), libMesh::Nemesis_IO_Helper::get_loadbal_param(), libMesh::DofMap::get_local_constraints(), libMesh::MeshBase::get_local_constraints(), libMesh::Nemesis_IO_Helper::get_node_cmap(), libMesh::Nemesis_IO_Helper::get_node_map(), libMesh::Nemesis_IO_Helper::get_ns_param_global(), libMesh::Nemesis_IO_Helper::get_ss_param_global(), libMesh::SparsityPattern::Build::handle_vi_vj(), libMesh::LaplaceMeshSmoother::init(), libMesh::SystemSubsetBySubdomain::init(), HeatSystem::init_data(), libMesh::ExodusII_IO_Helper::initialize(), libMesh::ExodusII_IO_Helper::initialize_element_variables(), libMesh::ExodusII_IO_Helper::initialize_global_variables(), libMesh::ExodusII_IO_Helper::initialize_nodal_variables(), libMesh::DistributedMesh::insert_elem(), libMesh::MeshTools::Modification::interpolate_surface(), libMesh::SparsityPattern::Build::join(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), legacy_write_offline_data_to_files(), libMesh::TransientRBEvaluation::legacy_write_offline_data_to_files(), libMesh::MeshTools::libmesh_assert_consistent_distributed(), libMesh::MeshTools::libmesh_assert_consistent_distributed_nodes(), libMesh::MeshTools::libmesh_assert_contiguous_dof_ids(), libMesh::MeshTools::libmesh_assert_parallel_consistent_procids< Elem >(), libMesh::MeshTools::libmesh_assert_valid_neighbors(), libMesh::DistributedMesh::libmesh_assert_valid_parallel_object_ids(), main(), AugmentSparsityOnInterface::mesh_reinit(), libMesh::TriangulatorInterface::MeshedHole::MeshedHole(), libMesh::MeshBase::n_active_local_elem(), libMesh::BoundaryInfo::n_boundary_conds(), libMesh::MeshTools::n_connected_components(), libMesh::MeshBase::n_constraint_rows(), libMesh::BoundaryInfo::n_edge_conds(), libMesh::DofMapBase::n_local_dofs(), libMesh::MeshBase::n_local_elem(), libMesh::MeshBase::n_local_nodes(), libMesh::BoundaryInfo::n_nodeset_conds(), libMesh::BoundaryInfo::n_shellface_conds(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::DistributedMesh::own_node(), libMesh::BoundaryInfo::parallel_sync_node_ids(), libMesh::BoundaryInfo::parallel_sync_side_ids(), libMesh::MeshBase::print_constraint_rows(), libMesh::DofMap::print_dof_constraints(), libMesh::DofMap::process_mesh_constraint_rows(), libMesh::Nemesis_IO_Helper::put_cmap_params(), libMesh::Nemesis_IO_Helper::put_elem_cmap(), libMesh::Nemesis_IO_Helper::put_elem_map(), libMesh::Nemesis_IO_Helper::put_loadbal_param(), libMesh::Nemesis_IO_Helper::put_node_cmap(), libMesh::Nemesis_IO_Helper::put_node_map(), libMesh::XdrIO::read(), libMesh::Nemesis_IO::read(), libMesh::CheckpointIO::read(), libMesh::NameBasedIO::read(), libMesh::EquationSystems::read(), libMesh::EquationSystems::read(), libMesh::ExodusII_IO_Helper::read_elem_num_map(), libMesh::ExodusII_IO_Helper::read_global_values(), libMesh::CheckpointIO::read_header(), libMesh::ExodusII_IO::read_header(), libMesh::System::read_header(), libMesh::XdrIO::read_header(), libMesh::DynaIO::read_mesh(), libMesh::ExodusII_IO_Helper::read_node_num_map(), libMesh::System::read_parallel_data(), libMesh::RBConstruction::read_riesz_representors_from_files(), libMesh::TransientRBConstruction::read_riesz_representors_from_files(), libMesh::System::read_SCALAR_dofs(), libMesh::XdrIO::read_serialized_bc_names(), libMesh::XdrIO::read_serialized_bcs_helper(), libMesh::System::read_serialized_blocked_dof_objects(), libMesh::XdrIO::read_serialized_connectivity(), libMesh::System::read_serialized_data(), libMesh::XdrIO::read_serialized_nodes(), libMesh::XdrIO::read_serialized_nodesets(), libMesh::XdrIO::read_serialized_subdomain_names(), libMesh::System::read_serialized_vector(), libMesh::System::read_serialized_vectors(), libMesh::Nemesis_IO_Helper::read_var_names_impl(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::SimplexRefiner::refine_via_edges(), libMesh::StaticCondensationDofMap::reinit(), libMesh::DistributedMesh::renumber_dof_objects(), libMesh::DistributedMesh::renumber_nodes_and_elements(), libMesh::DofMap::scatter_constraints(), libMesh::CheckpointIO::select_split_config(), libMesh::DistributedMesh::set_next_unique_id(), libMesh::DofMap::set_nonlocal_dof_objects(), libMesh::PetscDMWrapper::set_point_range_in_section(), libMesh::RBEIMEvaluation::side_gather_bfs(), MeshFunctionTest::test_bad_gradient_var_with_out_of_mesh_value(), MeshFunctionTest::test_bad_hessian_var_with_out_of_mesh_value(), ExodusTest< elem_type >::test_read_gold(), ExodusTest< elem_type >::test_write(), ExodusC0PolyhedronTest::test_write_and_read_hexagonal_prism(), ExodusC0PolygonTest::test_write_and_read_pentagon(), MeshInputTest::testAbaqusRead(), MeshInputTest::testBadGmsh(), BoundaryInfoTest::testBoundaryIDs(), MeshInputTest::testCopyElementSolutionImpl(), MeshInputTest::testCopyElementVectorImpl(), MeshInputTest::testCopyNodalSolutionImpl(), DefaultCouplingTest::testCoupling(), PointNeighborCouplingTest::testCoupling(), MeshInputTest::testDynaFileMappings(), MeshInputTest::testDynaNoSplines(), MeshInputTest::testDynaReadElem(), MeshInputTest::testDynaReadPatch(), MeshInputTest::testExodusFileMappings(), MeshInputTest::testExodusIGASidesets(), MeshInputTest::testExodusWriteElementDataFromDiscontinuousNodalData(), MeshInputTest::testGmshBCIDOverlap(), MeshInputTest::testGoodGmsh(), MeshInputTest::testGoodSTL(), MeshInputTest::testGoodSTLBinary(), BoundaryInfoTest::testInternalBoundary(), MeshInputTest::testLowOrderEdgeBlocks(), BoundaryMeshSubdomainTest::testPerBoundarySubdomain(), SystemsTest::testProjectMatrix3D(), BoundaryInfoTest::testShellFaceConstraints(), MeshInputTest::testSingleElementImpl(), BoundaryMeshSubdomainTest::testSingleSubdomain(), WriteVecAndScalar::testSolution(), CheckpointIOTest::testSplitter(), MeshInputTest::testTetgenIO(), MeshSmootherTest::testVariationalSmoother(), libMesh::MeshTools::total_weight(), libMesh::NetGenMeshInterface::triangulate(), libMesh::Parallel::Packing< Elem * >::unpack(), libMesh::Parallel::Packing< Node * >::unpack(), libMesh::DistributedMesh::update_parallel_id_counts(), libMesh::DTKAdapter::update_variable_values(), libMesh::MeshTools::volume(), libMesh::STLIO::write(), libMesh::XdrIO::write(), libMesh::NameBasedIO::write(), libMesh::CheckpointIO::write(), libMesh::EquationSystems::write(), libMesh::EquationSystems::write(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::ExodusII_IO::write_element_data(), libMesh::ExodusII_IO::write_element_data_from_discontinuous_nodal_data(), libMesh::ExodusII_IO_Helper::write_element_values(), libMesh::ExodusII_IO_Helper::write_element_values_element_major(), libMesh::ExodusII_IO_Helper::write_elements(), libMesh::ExodusII_IO_Helper::write_elemset_data(), libMesh::ExodusII_IO_Helper::write_elemsets(), libMesh::ExodusII_IO::write_global_data(), libMesh::ExodusII_IO_Helper::write_global_values(), libMesh::System::write_header(), libMesh::ExodusII_IO::write_information_records(), libMesh::ExodusII_IO_Helper::write_information_records(), libMesh::ExodusII_IO_Helper::write_nodal_coordinates(), libMesh::ExodusII_IO::write_nodal_data(), libMesh::VTKIO::write_nodal_data(), libMesh::UCDIO::write_nodal_data(), libMesh::ExodusII_IO::write_nodal_data_common(), libMesh::ExodusII_IO::write_nodal_data_discontinuous(), libMesh::ExodusII_IO_Helper::write_nodal_values(), libMesh::ExodusII_IO_Helper::write_nodeset_data(), libMesh::ExodusII_IO_Helper::write_nodesets(), libMesh::Nemesis_IO_Helper::write_nodesets(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), write_output_solvedata(), libMesh::System::write_parallel_data(), libMesh::RBConstruction::write_riesz_representors_to_files(), libMesh::System::write_SCALAR_dofs(), libMesh::XdrIO::write_serialized_bc_names(), libMesh::XdrIO::write_serialized_bcs_helper(), libMesh::System::write_serialized_blocked_dof_objects(), libMesh::XdrIO::write_serialized_connectivity(), libMesh::System::write_serialized_data(), libMesh::XdrIO::write_serialized_nodes(), libMesh::XdrIO::write_serialized_nodesets(), libMesh::XdrIO::write_serialized_subdomain_names(), libMesh::System::write_serialized_vector(), libMesh::System::write_serialized_vectors(), libMesh::ExodusII_IO_Helper::write_sideset_data(), libMesh::ExodusII_IO_Helper::write_sidesets(), libMesh::Nemesis_IO_Helper::write_sidesets(), libMesh::ExodusII_IO::write_timestep(), libMesh::ExodusII_IO_Helper::write_timestep(), and libMesh::ExodusII_IO::write_timestep_discontinuous().

◆ read_discrete_parameter_values_from_file()

void libMesh::RBParametrized::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 
)
privateinherited

Read in the discrete parameter values from file, if we have any.

Definition at line 318 of file rb_parametrized.C.

321{
322 // read in the discrete parameters, if we have any
323 std::ifstream check_if_file_exists(file_name.c_str());
324 if (check_if_file_exists.good())
325 {
326 // The reading mode: DECODE for binary, READ for ASCII
327 XdrMODE mode = read_binary_data ? DECODE : READ;
328
329 // Read in the parameter ranges
330 Xdr discrete_parameter_values_in(file_name, mode);
331 unsigned int n_discrete_params;
332 discrete_parameter_values_in >> n_discrete_params;
333
334 for (unsigned int i=0; i<n_discrete_params; i++)
335 {
336 std::string param_name;
337 discrete_parameter_values_in >> param_name;
338
339 unsigned int n_discrete_values;
340 discrete_parameter_values_in >> n_discrete_values;
341
342 std::vector<Real> discrete_values(n_discrete_values);
343 for (auto & val : discrete_values)
344 discrete_parameter_values_in >> val;
345
346 discrete_parameter_values[param_name] = discrete_values;
347 }
348 }
349}

References libMesh::DECODE, and libMesh::READ.

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

◆ read_parameter_data_from_files()

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

Read in the parameter ranges from files.

Definition at line 262 of file rb_parametrized.C.

265{
266 RBParameters param_min;
267 RBParameters param_max;
268 read_parameter_ranges_from_file(continuous_param_file_name,
269 read_binary_data,
270 param_min,
271 param_max);
272
273 std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
274 read_discrete_parameter_values_from_file(discrete_param_file_name,
275 read_binary_data,
276 discrete_parameter_values_in);
277
278 initialize_parameters(param_min, param_max, discrete_parameter_values_in);
279}
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 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.

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

◆ read_parameter_ranges_from_file()

void libMesh::RBParametrized::read_parameter_ranges_from_file ( const std::string &  file_name,
const bool  read_binary,
RBParameters param_min,
RBParameters param_max 
)
privateinherited

Read in the parameter ranges from file.

Initialize parameters to the "minimum" parameter values.

Definition at line 281 of file rb_parametrized.C.

285{
286 // The reading mode: DECODE for binary, READ for ASCII
287 XdrMODE mode = read_binary_data ? DECODE : READ;
288
289 // Read in the parameter ranges
290 Xdr parameter_ranges_in(file_name, mode);
291 unsigned int n_continuous_params;
292 parameter_ranges_in >> n_continuous_params;
293
294 for (unsigned int i=0; i<n_continuous_params; i++)
295 {
296 std::string param_name;
297 Real param_value;
298
299 parameter_ranges_in >> param_name;
300 parameter_ranges_in >> param_value;
301
302 param_min.set_value(param_name, param_value);
303 }
304 for (unsigned int i=0; i<n_continuous_params; i++)
305 {
306 std::string param_name;
307 Real param_value;
308
309 parameter_ranges_in >> param_name;
310 parameter_ranges_in >> param_value;
311
312 param_max.set_value(param_name, param_value);
313 }
314
315 parameter_ranges_in.close();
316}

References libMesh::Xdr::close(), libMesh::DECODE, libMesh::READ, libMesh::Real, and libMesh::RBParameters::set_value().

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

◆ reload_current_parameters()

void libMesh::RBSCMEvaluation::reload_current_parameters ( )
virtual

Helper function to (re)load current_parameters from saved_parameters.

Definition at line 310 of file rb_scm_evaluation.C.

311{
313}
RBParameters saved_parameters
Vector in which to save a parameter set.

References saved_parameters, and libMesh::RBParametrized::set_parameters().

Referenced by get_SCM_LB().

◆ save_current_parameters()

void libMesh::RBSCMEvaluation::save_current_parameters ( )
virtual

Helper function to save current_parameters in saved_parameters.

Definition at line 305 of file rb_scm_evaluation.C.

306{
308}

References libMesh::RBParametrized::get_parameters(), and saved_parameters.

Referenced by get_SCM_LB().

◆ set_B_max()

void libMesh::RBSCMEvaluation::set_B_max ( unsigned int  i,
Real  B_max_val 
)

Definition at line 144 of file rb_scm_evaluation.C.

145{
146 libmesh_error_msg_if(q >= B_max.size(), "Error: q is too large in set_B_max.");
147
148 B_max[q] = B_max_val;
149}

References B_max.

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounding_box().

◆ set_B_min()

void libMesh::RBSCMEvaluation::set_B_min ( unsigned int  i,
Real  B_min_val 
)

Set B_min and B_max.

Definition at line 137 of file rb_scm_evaluation.C.

138{
139 libmesh_error_msg_if(q >= B_min.size(), "Error: q is too large in set_B_min.");
140
141 B_min[q] = B_min_val;
142}

References B_min.

Referenced by libMesh::RBSCMConstruction::compute_SCM_bounding_box().

◆ set_C_J_stability_constraint()

void libMesh::RBSCMEvaluation::set_C_J_stability_constraint ( unsigned int  j,
Real  stability_constraint_in 
)

Set stability constraints (i.e.

the values of coercivity/ inf-sup/stability constants at the parameter values chosen during the greedy); we store one constraint for each element of C_J.

Definition at line 77 of file rb_scm_evaluation.C.

78{
79 libmesh_error_msg_if(j >= C_J_stability_vector.size(), "Error: Input parameter j is too large in set_C_J_stability_constraint.");
80
81 // we assume that C_J_stability_vector is resized elsewhere
82 // to be the same size as C_J.
83 libmesh_assert_equal_to (C_J_stability_vector.size(), C_J.size());
84
85 C_J_stability_vector[j] = stability_const_in;
86}

References C_J, and C_J_stability_vector.

Referenced by libMesh::RBSCMConstruction::evaluate_stability_constant().

◆ set_current_parameters_from_C_J()

void libMesh::RBSCMEvaluation::set_current_parameters_from_C_J ( unsigned int  C_J_index)
virtual

Set parameters based on values saved in "C_J".

Definition at line 300 of file rb_scm_evaluation.C.

301{
302 set_parameters(C_J[C_J_index]);
303}

References C_J, and libMesh::RBParametrized::set_parameters().

Referenced by get_SCM_LB().

◆ set_parameters()

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

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

We

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

Definition at line 129 of file rb_parametrized.C.

130{
131 libmesh_error_msg_if(!parameters_initialized, "Error: parameters not initialized in RBParametrized::set_parameters");
132
133 // Terminate if params has the wrong number of parameters or samples.
134 // If the parameters are outside the min/max range, return false.
135 const bool valid_params = check_if_valid_params(params);
136
137 // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
138 this->parameters = params;
139
140 return valid_params;
141}
bool check_if_valid_params(const RBParameters &params) const
Helper function to check that params is valid:

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

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

◆ set_rb_theta_expansion()

void libMesh::RBSCMEvaluation::set_rb_theta_expansion ( RBThetaExpansion rb_theta_expansion_in)

Set the RBThetaExpansion object.

Definition at line 65 of file rb_scm_evaluation.C.

66{
67 rb_theta_expansion = &rb_theta_expansion_in;
68}

References rb_theta_expansion.

Referenced by main().

◆ set_SCM_UB_vector()

void libMesh::RBSCMEvaluation::set_SCM_UB_vector ( unsigned int  j,
unsigned int  q,
Real  y_q 
)

Set entries of SCM_UB_vector, which stores the vector y, corresponding to the minimizing eigenvectors for the elements of C_J.

Definition at line 95 of file rb_scm_evaluation.C.

96{
97 // First make sure that j <= J
98 libmesh_error_msg_if(j >= SCM_UB_vectors.size(), "Error: We must have j < J in set_SCM_UB_vector.");
99
100 // Next make sure that q <= Q_a or Q_a_hat
101 libmesh_error_msg_if(q >= SCM_UB_vectors[0].size(), "Error: q is too large in set_SCM_UB_vector.");
102
103 SCM_UB_vectors[j][q] = y_q;
104}

References SCM_UB_vectors.

Referenced by libMesh::RBSCMConstruction::evaluate_stability_constant().

◆ write_discrete_parameter_values_to_file()

void libMesh::RBParametrized::write_discrete_parameter_values_to_file ( const std::string &  file_name,
const bool  write_binary_data 
)
privateinherited

Write out the discrete parameter values to file.

Definition at line 230 of file rb_parametrized.C.

232{
233 // write out the discrete parameters, if we have any
234 if (get_n_discrete_params() > 0)
235 {
236 // The writing mode: ENCODE for binary, WRITE for ASCII
237 XdrMODE mode = write_binary_data ? ENCODE : WRITE;
238
239 Xdr discrete_parameters_out(file_name, mode);
240 unsigned int n_discrete_params = get_n_discrete_params();
241 discrete_parameters_out << n_discrete_params;
242
243 // Note: the following loops are not candidates for structured
244 // bindings syntax because the Xdr APIs which they call are not
245 // defined for const references. We must therefore make copies
246 // to call these functions.
247 for (const auto & pr : get_discrete_parameter_values())
248 {
249 std::string param_name = pr.first;
250 auto n_discrete_values = cast_int<unsigned int>(pr.second.size());
251 discrete_parameters_out << param_name << n_discrete_values;
252
253 for (unsigned int i=0; i<n_discrete_values; i++)
254 {
255 Real discrete_value = pr.second[i];
256 discrete_parameters_out << discrete_value;
257 }
258 }
259 }
260}

References libMesh::ENCODE, libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::get_n_discrete_params(), libMesh::Real, and libMesh::WRITE.

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

◆ write_parameter_data_to_files()

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

Write out the parameter ranges to files.

Definition at line 185 of file rb_parametrized.C.

188{
189 write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
190 write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
191}
void write_parameter_ranges_to_file(const std::string &file_name, const bool write_binary)
Write out the parameter ranges to file.
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.

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

◆ write_parameter_ranges_to_file()

void libMesh::RBParametrized::write_parameter_ranges_to_file ( const std::string &  file_name,
const bool  write_binary 
)
privateinherited

Write out the parameter ranges to file.

Definition at line 193 of file rb_parametrized.C.

195{
196 // The writing mode: ENCODE for binary, WRITE for ASCII
197 XdrMODE mode = write_binary_data ? ENCODE : WRITE;
198
199 // Write out the parameter ranges
200 Xdr parameter_ranges_out(file_name, mode);
201 unsigned int n_continuous_params = get_n_continuous_params();
202 parameter_ranges_out << n_continuous_params;
203
204 // Note: the following loops are not candidates for structured
205 // bindings syntax because the Xdr APIs which they call are not
206 // defined for const references. We must therefore make copies to
207 // call these functions.
208 for (const auto & pr : get_parameters_min())
209 {
210 std::string param_name = pr.first;
211 if (!is_discrete_parameter(param_name))
212 {
213 Real param_value = get_parameters_min().get_value(param_name);
214 parameter_ranges_out << param_name << param_value;
215 }
216 }
217 for (const auto & pr : get_parameters_max())
218 {
219 std::string param_name = pr.first;
220 if (!is_discrete_parameter(param_name))
221 {
222 Real param_value = get_parameters_max().get_value(param_name);
223 parameter_ranges_out << param_name << param_value;
224 }
225 }
226
227 parameter_ranges_out.close();
228}
const RBParameters & get_parameters_max() const
Get an RBParameters object that specifies the maximum allowable value for each parameter.
const RBParameters & get_parameters_min() const
Get an RBParameters object that specifies the minimum allowable value for each parameter.
unsigned int get_n_continuous_params() const
Get the number of continuous parameters.
bool is_discrete_parameter(const std::string &mu_name) const
Is parameter mu_name discrete?

References libMesh::Xdr::close(), libMesh::ENCODE, libMesh::RBParametrized::get_n_continuous_params(), libMesh::RBParametrized::get_parameters_max(), libMesh::RBParametrized::get_parameters_min(), libMesh::RBParameters::get_value(), libMesh::RBParametrized::is_discrete_parameter(), libMesh::Real, and libMesh::WRITE.

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

Member Data Documentation

◆ _communicator

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

◆ _counts

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

Actually holds the data.

Definition at line 124 of file reference_counter.h.

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

◆ _discrete_parameter_values

std::map<std::string, std::vector<Real> > libMesh::RBParametrized::_discrete_parameter_values
privateinherited

Map that defines the allowable values of any discrete parameters.

Definition at line 250 of file rb_parametrized.h.

Referenced by libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::initialize_parameters(), and libMesh::RBParametrized::is_discrete_parameter().

◆ _enable_print_counter

bool libMesh::ReferenceCounter::_enable_print_counter = true
staticprotectedinherited

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

Definition at line 143 of file reference_counter.h.

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

◆ _mutex

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 137 of file reference_counter.h.

◆ _n_objects

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

◆ B_max

std::vector<Real> libMesh::RBSCMEvaluation::B_max

◆ B_min

std::vector<Real> libMesh::RBSCMEvaluation::B_min

◆ C_J

std::vector<RBParameters > libMesh::RBSCMEvaluation::C_J

◆ C_J_stability_vector

std::vector<Real> libMesh::RBSCMEvaluation::C_J_stability_vector

◆ parameters

RBParameters libMesh::RBParametrized::parameters
privateinherited

Vector storing the current parameters.

Definition at line 239 of file rb_parametrized.h.

Referenced by libMesh::RBParametrized::clear(), libMesh::RBParametrized::get_parameters(), and libMesh::RBParametrized::set_parameters().

◆ parameters_initialized

bool libMesh::RBParametrized::parameters_initialized
privateinherited

◆ parameters_max

RBParameters libMesh::RBParametrized::parameters_max
privateinherited

◆ parameters_min

RBParameters libMesh::RBParametrized::parameters_min
privateinherited

◆ rb_theta_expansion

RBThetaExpansion* libMesh::RBSCMEvaluation::rb_theta_expansion
private

A pointer to to the object that stores the theta expansion.

This is not a std::unique_ptr since we may want to share it.

Note
A shared_ptr would be a good option here.

Definition at line 222 of file rb_scm_evaluation.h.

Referenced by get_rb_theta_expansion(), get_SCM_LB(), get_SCM_UB(), legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), and set_rb_theta_expansion().

◆ saved_parameters

RBParameters libMesh::RBSCMEvaluation::saved_parameters
private

Vector in which to save a parameter set.

Useful in get_SCM_LB, for example.

Definition at line 214 of file rb_scm_evaluation.h.

Referenced by reload_current_parameters(), and save_current_parameters().

◆ SCM_UB_vectors

std::vector<std::vector<Real> > libMesh::RBSCMEvaluation::SCM_UB_vectors

This matrix stores the infimizing vectors y_1( \( \mu \)),...,y_Q_a( \( \mu \)), for each \( \mu \) in C_J, which are used in computing the SCM upper bounds.

Definition at line 206 of file rb_scm_evaluation.h.

Referenced by libMesh::RBSCMConstruction::enrich_C_J(), get_SCM_UB(), get_SCM_UB_vector(), legacy_read_offline_data_from_files(), legacy_write_offline_data_to_files(), libMesh::RBDataDeserialization::load_rb_scm_evaluation_data(), RBSCMEvaluation(), libMesh::RBSCMConstruction::resize_SCM_vectors(), and set_SCM_UB_vector().

◆ verbose_mode

bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 181 of file rb_parametrized.h.

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


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