libMesh
|
This class is part of the rbOOmit framework. More...
#include <rb_parametrized.h>
Public Member Functions | |
RBParametrized () | |
Constructor. More... | |
RBParametrized (RBParametrized &&)=default | |
Special functions. More... | |
RBParametrized & | operator= (RBParametrized &&)=default |
RBParametrized (const RBParametrized &)=default | |
RBParametrized & | operator= (const RBParametrized &)=default |
virtual | ~RBParametrized () |
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... | |
bool | set_parameters (const RBParameters ¶ms) |
Set the current parameters to params The parameters are checked for validity; an error is thrown if the number of parameters or samples is different than expected. More... | |
const 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_stream=libMesh::out) |
Prints the reference information, by default to libMesh::out . More... | |
static unsigned int | n_objects () |
Prints the number of outstanding (created, but not yet destroyed) objects. More... | |
static void | enable_print_counter_info () |
Methods to enable/disable the reference counter output from print_info() More... | |
static void | disable_print_counter_info () |
Public Attributes | |
bool | verbose_mode |
Public boolean to toggle verbose mode. More... | |
Protected Types | |
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Data structure to log the information. More... | |
Protected Member Functions | |
void | increment_constructor_count (const std::string &name) noexcept |
Increments the construction counter. More... | |
void | increment_destructor_count (const std::string &name) noexcept |
Increments the destruction counter. More... | |
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 | check_if_valid_params (const RBParameters ¶ms) const |
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 45 of file rb_parametrized.h.
|
protectedinherited |
Data structure to log the information.
The log is identified by the class name.
Definition at line 119 of file reference_counter.h.
libMesh::RBParametrized::RBParametrized | ( | ) |
Constructor.
Definition at line 36 of file rb_parametrized.C.
|
default |
Special functions.
|
default |
|
virtualdefault |
|
private |
Helper function to check that params
is valid:
Definition at line 389 of file rb_parametrized.C.
References get_discrete_parameter_values(), get_n_params(), get_parameter_max(), get_parameter_min(), is_value_in_list(), libMesh::RBParameters::n_parameters(), libMesh::out, libMesh::Real, libMesh::TOLERANCE, value, and verbose_mode.
Referenced by set_parameters().
|
virtual |
Clear all the data structures associated with the system.
Reimplemented in libMesh::RBConstruction, libMesh::RBEIMConstruction, libMesh::TransientSystem< RBConstruction >, libMesh::RBConstructionBase< Base >, libMesh::RBConstructionBase< LinearImplicitSystem >, libMesh::RBConstructionBase< System >, libMesh::RBConstructionBase< CondensedEigenSystem >, libMesh::RBEIMEvaluation, libMesh::RBSCMConstruction, libMesh::TransientRBConstruction, libMesh::TransientRBEvaluation, and libMesh::RBEvaluation.
Definition at line 45 of file rb_parametrized.C.
References libMesh::RBParameters::clear(), parameters, parameters_initialized, parameters_max, and parameters_min.
|
staticinherited |
Definition at line 100 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
|
staticinherited |
Methods to enable/disable the reference counter output from print_info()
Definition at line 94 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
|
static |
value
from list_of_values
. Definition at line 443 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 370 of file rb_parametrized.C.
References _discrete_parameter_values, and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), check_if_valid_params(), get_n_discrete_params(), initialize_parameters(), print_discrete_parameter_values(), 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 112 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 121 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 103 of file rb_parametrized.C.
References libMesh::RBParameters::n_parameters(), parameters_initialized, parameters_max, and parameters_min.
Referenced by check_if_valid_params(), libMesh::RBEIMConstruction::compute_max_eim_error(), libMesh::RBConstruction::compute_max_error_bound(), get_n_continuous_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), libMesh::RBEIMEvaluation::set_eim_error_indicator_active(), and libMesh::RBConstruction::train_reduced_basis_with_POD().
Real libMesh::RBParametrized::get_parameter_max | ( | const std::string & | param_name | ) | const |
Get maximum allowable value of parameter param_name
.
Definition at line 183 of file rb_parametrized.C.
References libMesh::RBParameters::get_value(), parameters_initialized, and parameters_max.
Referenced by check_if_valid_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().
Real libMesh::RBParametrized::get_parameter_min | ( | const std::string & | param_name | ) | const |
Get minimum allowable value of parameter param_name
.
Definition at line 176 of file rb_parametrized.C.
References libMesh::RBParameters::get_value(), parameters_initialized, and parameters_min.
Referenced by check_if_valid_params(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().
std::set< std::string > libMesh::RBParametrized::get_parameter_names | ( | ) | const |
Get a set that stores the parameter names.
Definition at line 129 of file rb_parametrized.C.
References parameters_initialized, and parameters_min.
const RBParameters & libMesh::RBParametrized::get_parameters | ( | ) | const |
Get the current parameters.
Definition at line 155 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::RBEvaluation::compute_residual_dual_norm(), libMesh::RBSCMConstruction::compute_SCM_bounds_on_training_set(), libMesh::RBSCMConstruction::enrich_C_J(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_nodes(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_sides(), libMesh::RBEvaluation::eval_output_dual_norm(), libMesh::RBSCMConstruction::evaluate_stability_constant(), libMesh::RBConstruction::get_RB_error_bound(), libMesh::RBSCMEvaluation::get_SCM_LB(), libMesh::RBSCMEvaluation::get_SCM_UB(), SimpleRBEvaluation::get_stability_lower_bound(), libMesh::RBConstruction::greedy_termination_test(), libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), libMesh::TransientRBConstruction::mass_matrix_scaled_matvec(), libMesh::RBConstruction::preevaluate_thetas(), libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), print_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::TransientRBEvaluation::rb_solve(), libMesh::RBEvaluation::rb_solve(), libMesh::RBSCMEvaluation::save_current_parameters(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::TransientRBConstruction::truth_assembly(), libMesh::RBConstruction::truth_assembly(), libMesh::TransientRBConstruction::truth_solve(), libMesh::RBConstruction::truth_solve(), libMesh::TransientRBEvaluation::uncached_compute_residual_dual_norm(), and libMesh::RBConstruction::update_greedy_param_list().
const RBParameters & libMesh::RBParametrized::get_parameters_max | ( | ) | const |
Get an RBParameters object that specifies the maximum allowable value for each parameter.
Definition at line 169 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::RBEIMConstruction::set_rb_construction_parameters(), 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 162 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::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), and write_parameter_ranges_to_file().
|
inlineprotectednoexceptinherited |
Increments the construction counter.
Should be called in the constructor of any derived class that will be reference counted.
Definition at line 183 of file reference_counter.h.
References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
|
inlineprotectednoexceptinherited |
Increments the destruction counter.
Should be called in the destructor of any derived class that will be reference counted.
Definition at line 207 of file reference_counter.h.
References libMesh::err, libMesh::BasicOStreamProxy< charT, traits >::get(), libMesh::Quality::name(), and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
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.
Parameter ranges are inclusive. The input min/max RBParameters should have exactly 1 sample each. Vector-valued samples are not currently supported for the min/max parameters or for discrete parameters.
Definition at line 53 of file rb_parametrized.C.
References _discrete_parameter_values, libMesh::RBParameters::begin_serialized(), libMesh::RBParameters::end_serialized(), libMesh::RBParameters::n_parameters(), libMesh::RBParameters::n_samples(), libMesh::Quality::name(), 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::RBDataDeserialization::load_parameter_ranges(), libMesh::RBSCMConstruction::perform_SCM_greedy(), libMesh::RBSCMConstruction::process_parameters_file(), read_parameter_data_from_files(), libMesh::RBEIMConstruction::set_rb_construction_parameters(), libMesh::RBConstruction::set_rb_construction_parameters(), RBParametersTest::testRBParametrized(), libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), libMesh::RBEIMConstruction::train_eim_approximation_with_POD(), libMesh::RBConstruction::train_reduced_basis_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_POD().
void libMesh::RBParametrized::initialize_parameters | ( | const RBParametrized & | rb_parametrized | ) |
Initialize the parameter ranges and set current_parameters.
Definition at line 96 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 363 of file rb_parametrized.C.
References _discrete_parameter_values, and parameters_initialized.
Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBEIMConstruction::print_info(), libMesh::RBConstruction::print_info(), 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 462 of file rb_parametrized.C.
References std::abs(), get_closest_value(), libMesh::Real, and value.
Referenced by check_if_valid_params().
|
inlinestaticinherited |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 85 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
Referenced by libMesh::LibMeshInit::~LibMeshInit().
|
default |
|
default |
void libMesh::RBParametrized::print_discrete_parameter_values | ( | ) | const |
Print out all the discrete parameter values.
Definition at line 377 of file rb_parametrized.C.
References get_discrete_parameter_values(), libMesh::Quality::name(), libMesh::out, and value.
Referenced by libMesh::RBSCMConstruction::print_info(), libMesh::RBEIMConstruction::print_info(), and libMesh::RBConstruction::print_info().
|
staticinherited |
Prints the reference information, by default to libMesh::out
.
Definition at line 81 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
Referenced by libMesh::LibMeshInit::~LibMeshInit().
void libMesh::RBParametrized::print_parameters | ( | ) | const |
Print the current parameters.
Definition at line 190 of file rb_parametrized.C.
References get_parameters(), parameters_initialized, and libMesh::RBParameters::print().
Referenced by libMesh::RBEIMConstruction::train_eim_approximation_with_greedy(), and libMesh::RBConstruction::train_reduced_basis_with_greedy().
|
private |
Read in the discrete parameter values from file, if we have any.
Definition at line 330 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 274 of file rb_parametrized.C.
References initialize_parameters(), read_discrete_parameter_values_from_file(), and read_parameter_ranges_from_file().
Referenced by libMesh::RBSCMEvaluation::legacy_read_offline_data_from_files(), and libMesh::RBEvaluation::legacy_read_offline_data_from_files().
|
private |
Read in the parameter ranges from file.
Initialize parameters to the "minimum" parameter values.
Definition at line 293 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().
bool libMesh::RBParametrized::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.
We
Definition at line 141 of file rb_parametrized.C.
References check_if_valid_params(), parameters, and 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(), initialize_parameters(), libMesh::RBSCMEvaluation::reload_current_parameters(), libMesh::RBSCMEvaluation::set_current_parameters_from_C_J(), and RBParametersTest::testRBParametrized().
|
private |
Write out the discrete parameter values to file.
Definition at line 242 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 197 of file rb_parametrized.C.
References write_discrete_parameter_values_to_file(), and write_parameter_ranges_to_file().
Referenced by libMesh::RBSCMEvaluation::legacy_write_offline_data_to_files(), and libMesh::RBEvaluation::legacy_write_offline_data_to_files().
|
private |
Write out the parameter ranges to file.
Definition at line 205 of file rb_parametrized.C.
References libMesh::Xdr::close(), libMesh::ENCODE, get_n_continuous_params(), get_parameters_max(), get_parameters_min(), libMesh::RBParameters::get_value(), is_discrete_parameter(), libMesh::Real, and libMesh::WRITE.
Referenced by write_parameter_data_to_files().
|
staticprotectedinherited |
Actually holds the data.
Definition at line 124 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info().
|
private |
Map that defines the allowable values of any discrete parameters.
Definition at line 260 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 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().
|
staticprotectedinherited |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 137 of file reference_counter.h.
|
staticprotectedinherited |
The number of objects.
Print the reference count information when the number returns to 0.
Definition at line 132 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
|
private |
Vector storing the current parameters.
Definition at line 249 of file rb_parametrized.h.
Referenced by clear(), get_parameters(), and set_parameters().
|
private |
Flag indicating whether the parameters have been initialized.
Definition at line 244 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 255 of file rb_parametrized.h.
Referenced by clear(), get_n_params(), get_parameter_max(), get_parameters_max(), and initialize_parameters().
|
private |
Vectors that define the ranges (min and max) for the parameters.
Definition at line 254 of file rb_parametrized.h.
Referenced by clear(), get_n_params(), get_parameter_min(), get_parameter_names(), get_parameters_min(), and initialize_parameters().
bool libMesh::RBParametrized::verbose_mode |
Public boolean to toggle verbose mode.
Definition at line 191 of file rb_parametrized.h.
Referenced by check_if_valid_params().