libMesh
|
This class is part of the rbOOmit framework. More...
#include <rb_parametrized.h>
Public Member Functions | |
RBParametrized () | |
Constructor. More... | |
virtual | ~RBParametrized () |
Destructor. More... | |
virtual void | clear () |
Clear all the data structures associated with the system. More... | |
void | initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values) |
Initialize the parameter ranges and set current_parameters. More... | |
void | initialize_parameters (const RBParametrized &rb_parametrized) |
Initialize the parameter ranges and set current_parameters. More... | |
unsigned int | get_n_params () const |
Get the number of parameters. More... | |
unsigned int | get_n_continuous_params () const |
Get the number of continuous parameters. More... | |
unsigned int | get_n_discrete_params () const |
Get the number of discrete parameters. More... | |
std::set< std::string > | get_parameter_names () const |
Get a set that stores the parameter names. More... | |
const RBParameters & | get_parameters () const |
Get the current parameters. More... | |
void | set_parameters (const RBParameters ¶ms) |
Set the current parameters to params . More... | |
const RBParameters & | get_parameters_min () const |
Get an RBParameters object that specifies the minimum allowable value for each parameter. More... | |
const RBParameters & | get_parameters_max () const |
Get an RBParameters object that specifies the maximum allowable value for each parameter. More... | |
Real | get_parameter_min (const std::string ¶m_name) const |
Get minimum allowable value of parameter param_name . More... | |
Real | get_parameter_max (const std::string ¶m_name) const |
Get maximum allowable value of parameter param_name . More... | |
void | print_parameters () const |
Print the current parameters. More... | |
void | write_parameter_data_to_files (const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool write_binary_data) |
Write out the parameter ranges to files. More... | |
void | read_parameter_data_from_files (const std::string &continuous_param_file_name, const std::string &discrete_param_file_name, const bool read_binary_data) |
Read in the parameter ranges from files. More... | |
bool | is_discrete_parameter (const std::string &mu_name) const |
Is parameter mu_name discrete? More... | |
const std::map< std::string, std::vector< Real > > & | get_discrete_parameter_values () const |
Get a const reference to the discrete parameter values. More... | |
void | print_discrete_parameter_values () const |
Print out all the discrete parameter values. More... | |
Static Public Member Functions | |
static Real | get_closest_value (Real value, const std::vector< Real > &list_of_values) |
static std::string | get_info () |
Gets a string containing the reference information. More... | |
static void | print_info (std::ostream &out=libMesh::out) |
Prints the reference information, by default to libMesh::out . More... | |
static unsigned int | n_objects () |
Prints the number of outstanding (created, but not yet destroyed) objects. More... | |
static void | enable_print_counter_info () |
Methods to enable/disable the reference counter output from print_info() More... | |
static void | disable_print_counter_info () |
Public Attributes | |
bool | verbose_mode |
Public boolean to toggle verbose mode. More... | |
Protected Types | |
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Data structure to log the information. More... | |
Protected Member Functions | |
void | increment_constructor_count (const std::string &name) |
Increments the construction counter. More... | |
void | increment_destructor_count (const std::string &name) |
Increments the destruction counter. More... | |
Static Protected Attributes | |
static Counts | _counts |
Actually holds the data. More... | |
static Threads::atomic< unsigned int > | _n_objects |
The number of objects. More... | |
static Threads::spin_mutex | _mutex |
Mutual exclusion object to enable thread-safe reference counting. More... | |
static bool | _enable_print_counter = true |
Flag to control whether reference count information is printed when print_info is called. More... | |
Private Member Functions | |
void | write_parameter_ranges_to_file (const std::string &file_name, const bool write_binary) |
Write out the parameter ranges to file. More... | |
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. More... | |
void | read_parameter_ranges_from_file (const std::string &file_name, const bool read_binary, RBParameters ¶m_min, RBParameters ¶m_max) |
Read in the parameter ranges from file. More... | |
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. More... | |
bool | valid_params (const RBParameters ¶ms) |
Helper function to check that params is valid. More... | |
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 ). More... | |
Private Attributes | |
bool | parameters_initialized |
Flag indicating whether the parameters have been initialized. More... | |
RBParameters | parameters |
Vector storing the current parameters. More... | |
RBParameters | parameters_min |
Vectors that define the ranges (min and max) for the parameters. More... | |
RBParameters | parameters_max |
std::map< std::string, std::vector< Real > > | _discrete_parameter_values |
Map that defines the allowable values of any discrete parameters. More... | |
This class is part of the rbOOmit framework.
This class defines basic functionality of a parametrized object.
Definition at line 44 of file rb_parametrized.h.
|
protectedinherited |
Data structure to log the information.
The log is identified by the class name.
Definition at line 117 of file reference_counter.h.
libMesh::RBParametrized::RBParametrized | ( | ) |
Constructor.
Definition at line 37 of file rb_parametrized.C.
References libMesh::RBParameters::clear(), parameters, parameters_max, and parameters_min.
|
virtual |
|
virtual |
Clear all the data structures associated with the system.
Reimplemented in libMesh::RBConstruction, libMesh::TransientSystem< RBConstruction >, libMesh::RBSCMConstruction, libMesh::RBEIMConstruction, libMesh::TransientRBConstruction, libMesh::RBEIMEvaluation, libMesh::TransientRBEvaluation, libMesh::RBEvaluation, libMesh::RBConstructionBase< Base >, libMesh::RBConstructionBase< LinearImplicitSystem >, and libMesh::RBConstructionBase< CondensedEigenSystem >.
Definition at line 52 of file rb_parametrized.C.
References libMesh::RBParameters::clear(), parameters, parameters_initialized, parameters_max, and parameters_min.
Referenced by ~RBParametrized().
|
staticinherited |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
Referenced by libMesh::LibMeshInit::LibMeshInit().
|
staticinherited |
Methods to enable/disable the reference counter output from print_info()
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
|
static |
value
from list_of_values
. Definition at line 433 of file rb_parametrized.C.
References std::abs(), distance(), libMesh::Real, and value.
Referenced by is_value_in_list().
const std::map< std::string, std::vector< Real > > & libMesh::RBParametrized::get_discrete_parameter_values | ( | ) | const |
Get a const reference to the discrete parameter values.
Definition at line 381 of file rb_parametrized.C.
References _discrete_parameter_values, and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), get_n_discrete_params(), initialize_parameters(), print_discrete_parameter_values(), valid_params(), and write_discrete_parameter_values_to_file().
|
staticinherited |
Gets a string containing the reference information.
Definition at line 47 of file reference_counter.C.
References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().
Referenced by libMesh::ReferenceCounter::print_info().
unsigned int libMesh::RBParametrized::get_n_continuous_params | ( | ) | const |
Get the number of continuous parameters.
Definition at line 125 of file rb_parametrized.C.
References get_n_discrete_params(), get_n_params(), libMesh::libmesh_assert(), and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), and write_parameter_ranges_to_file().
unsigned int libMesh::RBParametrized::get_n_discrete_params | ( | ) | const |
Get the number of discrete parameters.
Definition at line 135 of file rb_parametrized.C.
References get_discrete_parameter_values(), and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), get_n_continuous_params(), and write_discrete_parameter_values_to_file().
unsigned int libMesh::RBParametrized::get_n_params | ( | ) | const |
Get the number of parameters.
Definition at line 115 of file rb_parametrized.C.
References libMesh::RBParameters::n_parameters(), parameters_initialized, parameters_max, and parameters_min.
Referenced by libMesh::RBConstruction::compute_max_error_bound(), libMesh::RBEIMTheta::evaluate(), get_n_continuous_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and valid_params().
Real libMesh::RBParametrized::get_parameter_max | ( | const std::string & | param_name | ) | const |
Get maximum allowable value of parameter param_name
.
Definition at line 198 of file rb_parametrized.C.
References libMesh::RBParameters::get_value(), parameters_initialized, and parameters_max.
Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and valid_params().
Real libMesh::RBParametrized::get_parameter_min | ( | const std::string & | param_name | ) | const |
Get minimum allowable value of parameter param_name
.
Definition at line 190 of file rb_parametrized.C.
References libMesh::RBParameters::get_value(), parameters_initialized, and parameters_min.
Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), and valid_params().
std::set< std::string > libMesh::RBParametrized::get_parameter_names | ( | ) | const |
Get a set that stores the parameter names.
Definition at line 144 of file rb_parametrized.C.
References libMesh::RBParameters::get_parameter_names(), parameters_initialized, and parameters_min.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder().
const RBParameters & libMesh::RBParametrized::get_parameters | ( | ) | const |
Get the current parameters.
Definition at line 166 of file rb_parametrized.C.
References parameters, and parameters_initialized.
Referenced by libMesh::TransientRBConstruction::add_scaled_mass_matrix(), libMesh::TransientRBEvaluation::cache_online_residual_terms(), libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBEIMEvaluation::evaluate_parametrized_function(), libMesh::RBSCMConstruction::evaluate_stability_constant(), libMesh::RBConstruction::get_RB_error_bound(), libMesh::RBSCMEvaluation::get_SCM_LB(), libMesh::RBSCMEvaluation::get_SCM_UB(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBConstruction::greedy_termination_test(), libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBSCMConstruction::print_info(), libMesh::RBConstruction::print_info(), print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), libMesh::RBEIMEvaluation::rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBEIMConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().
const RBParameters & libMesh::RBParametrized::get_parameters_max | ( | ) | const |
Get an RBParameters object that specifies the maximum allowable value for each parameter.
Definition at line 182 of file rb_parametrized.C.
References parameters_initialized, and parameters_max.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and write_parameter_ranges_to_file().
const RBParameters & libMesh::RBParametrized::get_parameters_min | ( | ) | const |
Get an RBParameters object that specifies the minimum allowable value for each parameter.
Definition at line 174 of file rb_parametrized.C.
References parameters_initialized, and parameters_min.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and write_parameter_ranges_to_file().
|
inlineprotectedinherited |
Increments the construction counter.
Should be called in the constructor of any derived class that will be reference counted.
Definition at line 181 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
|
inlineprotectedinherited |
Increments the destruction counter.
Should be called in the destructor of any derived class that will be reference counted.
Definition at line 194 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
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 | ||
) |
Initialize the parameter ranges and set current_parameters.
Definition at line 60 of file rb_parametrized.C.
References _discrete_parameter_values, libMesh::RBParameters::get_value(), libMesh::RBParameters::n_parameters(), parameters_initialized, parameters_max, parameters_min, libMesh::Real, set_parameters(), and libMesh::RBParameters::set_value().
Referenced by libMesh::RBConstruction::enrich_basis_from_rhs_terms(), initialize_parameters(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), read_parameter_data_from_files(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBConstruction::train_reduced_basis().
void libMesh::RBParametrized::initialize_parameters | ( | const RBParametrized & | rb_parametrized | ) |
Initialize the parameter ranges and set current_parameters.
Definition at line 108 of file rb_parametrized.C.
References get_discrete_parameter_values(), get_parameters_max(), get_parameters_min(), and initialize_parameters().
bool libMesh::RBParametrized::is_discrete_parameter | ( | const std::string & | mu_name | ) | const |
Is parameter mu_name
discrete?
Definition at line 373 of file rb_parametrized.C.
References _discrete_parameter_values, and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBConstruction::print_info(), valid_params(), and write_parameter_ranges_to_file().
|
staticprivate |
Helper function to check if the specified value is in the list of values (within a tolerance given by tol
).
Definition at line 453 of file rb_parametrized.C.
References std::abs(), get_closest_value(), libMesh::Real, and value.
Referenced by valid_params().
|
inlinestaticinherited |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 83 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
void libMesh::RBParametrized::print_discrete_parameter_values | ( | ) | const |
Print out all the discrete parameter values.
Definition at line 389 of file rb_parametrized.C.
References get_discrete_parameter_values(), libMesh::out, and value.
Referenced by libMesh::RBSCMConstruction::print_info(), and libMesh::RBConstruction::print_info().
|
staticinherited |
Prints the reference information, by default to libMesh::out
.
Definition at line 87 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
void libMesh::RBParametrized::print_parameters | ( | ) | const |
Print the current parameters.
Definition at line 206 of file rb_parametrized.C.
References get_parameters(), parameters_initialized, and libMesh::RBParameters::print().
Referenced by libMesh::RBConstruction::train_reduced_basis().
|
private |
Read in the discrete parameter values from file, if we have any.
Definition at line 340 of file rb_parametrized.C.
References libMesh::DECODE, and libMesh::READ.
Referenced by 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 | ||
) |
Read in the parameter ranges from files.
Definition at line 284 of file rb_parametrized.C.
References initialize_parameters(), read_discrete_parameter_values_from_file(), and read_parameter_ranges_from_file().
Referenced by libMesh::RBEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files().
|
private |
Read in the parameter ranges from file.
Initialize parameters to the "minimum" parameter values.
Definition at line 303 of file rb_parametrized.C.
References libMesh::Xdr::close(), libMesh::DECODE, libMesh::READ, libMesh::Real, and libMesh::RBParameters::set_value().
Referenced by read_parameter_data_from_files().
void libMesh::RBParametrized::set_parameters | ( | const RBParameters & | params | ) |
Set the current parameters to params
.
Definition at line 155 of file rb_parametrized.C.
References parameters, parameters_initialized, and valid_params().
Referenced by libMesh::RBEIMConstruction::compute_best_fit_error(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBEIMConstruction::enrich_RB_space(), libMesh::RBEIMTheta::evaluate(), libMesh::RBConstruction::get_RB_error_bound(), SimpleRBEvaluation::get_stability_lower_bound(), initialize_parameters(), libMesh::RBSCMEvaluation::reload_current_parameters(), libMesh::RBSCMEvaluation::set_current_parameters_from_C_J(), and libMesh::RBEIMConstruction::truth_solve().
|
private |
Helper function to check that params
is valid.
Definition at line 402 of file rb_parametrized.C.
References get_discrete_parameter_values(), get_n_params(), get_parameter_max(), get_parameter_min(), is_discrete_parameter(), is_value_in_list(), libMesh::RBParameters::n_parameters(), libMesh::out, libMesh::TOLERANCE, libMesh::Quality::valid(), and verbose_mode.
Referenced by set_parameters().
|
private |
Write out the discrete parameter values to file.
Definition at line 255 of file rb_parametrized.C.
References libMesh::ENCODE, get_discrete_parameter_values(), get_n_discrete_params(), libMesh::Real, and libMesh::WRITE.
Referenced by 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 | ||
) |
Write out the parameter ranges to files.
Definition at line 214 of file rb_parametrized.C.
References write_discrete_parameter_values_to_file(), and write_parameter_ranges_to_file().
Referenced by libMesh::RBEvaluation::legacy_write_offline_data_to_files(), and libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files().
|
private |
Write out the parameter ranges to file.
Definition at line 222 of file rb_parametrized.C.
References libMesh::Xdr::close(), libMesh::ENCODE, get_n_continuous_params(), get_parameters_max(), get_parameters_min(), is_discrete_parameter(), libMesh::Real, and libMesh::WRITE.
Referenced by write_parameter_data_to_files().
|
staticprotectedinherited |
Actually holds the data.
Definition at line 122 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
|
private |
Map that defines the allowable values of any discrete parameters.
Definition at line 235 of file rb_parametrized.h.
Referenced by get_discrete_parameter_values(), initialize_parameters(), and is_discrete_parameter().
|
staticprotectedinherited |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 141 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
|
staticprotectedinherited |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 135 of file reference_counter.h.
|
staticprotectedinherited |
The number of objects.
Print the reference count information when the number returns to 0.
Definition at line 130 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
|
private |
Vector storing the current parameters.
Definition at line 224 of file rb_parametrized.h.
Referenced by clear(), get_parameters(), RBParametrized(), and set_parameters().
|
private |
Flag indicating whether the parameters have been initialized.
Definition at line 219 of file rb_parametrized.h.
Referenced by clear(), get_discrete_parameter_values(), get_n_continuous_params(), get_n_discrete_params(), get_n_params(), get_parameter_max(), get_parameter_min(), get_parameter_names(), get_parameters(), get_parameters_max(), get_parameters_min(), initialize_parameters(), is_discrete_parameter(), print_parameters(), and set_parameters().
|
private |
Definition at line 230 of file rb_parametrized.h.
Referenced by clear(), get_n_params(), get_parameter_max(), get_parameters_max(), initialize_parameters(), and RBParametrized().
|
private |
Vectors that define the ranges (min and max) for the parameters.
Definition at line 229 of file rb_parametrized.h.
Referenced by clear(), get_n_params(), get_parameter_min(), get_parameter_names(), get_parameters_min(), initialize_parameters(), and RBParametrized().
bool libMesh::RBParametrized::verbose_mode |
Public boolean to toggle verbose mode.
Definition at line 170 of file rb_parametrized.h.
Referenced by valid_params().