#include <rb_construction_base.h>
Public Types | |
typedef RBConstructionBase< Base > | sys_type |
Public Member Functions | |
RBConstructionBase (EquationSystems &es, const std::string &name, const unsigned int number) | |
virtual | ~RBConstructionBase () |
sys_type & | system () |
virtual void | clear () |
void | set_quiet_mode (bool quiet_mode_in) |
bool | is_quiet () const |
numeric_index_type | get_n_training_samples () const |
numeric_index_type | get_local_n_training_samples () const |
numeric_index_type | get_first_local_training_index () const |
numeric_index_type | get_last_local_training_index () const |
virtual void | initialize_training_parameters (const RBParameters &mu_min, const RBParameters &mu_max, unsigned int n_training_parameters, std::map< std::string, bool > log_param_scale, bool deterministic=true) |
virtual void | load_training_set (std::map< std::string, std::vector< Number >> &new_training_set) |
void | broadcast_parameters (unsigned int proc_id) |
void | set_training_random_seed (unsigned int seed) |
void | set_deterministic_training_parameter_name (const std::string &name) |
const std::string & | get_deterministic_training_parameter_name () const |
void | set_deterministic_training_parameter_repeats (unsigned int repeats) |
unsigned int | get_deterministic_training_parameter_repeats () const |
void | initialize_parameters (const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values) |
void | initialize_parameters (const RBParametrized &rb_parametrized) |
unsigned int | get_n_params () const |
unsigned int | get_n_continuous_params () const |
unsigned int | get_n_discrete_params () const |
std::set< std::string > | get_parameter_names () const |
const RBParameters & | get_parameters () const |
void | set_parameters (const RBParameters ¶ms) |
const RBParameters & | get_parameters_min () const |
const RBParameters & | get_parameters_max () const |
Real | get_parameter_min (const std::string ¶m_name) const |
Real | get_parameter_max (const std::string ¶m_name) const |
void | print_parameters () 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) |
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) |
bool | is_discrete_parameter (const std::string &mu_name) const |
const std::map< std::string, std::vector< Real > > & | get_discrete_parameter_values () const |
void | print_discrete_parameter_values () const |
Static Public Member Functions | |
static Real | get_closest_value (Real value, const std::vector< Real > &list_of_values) |
static std::string | get_info () |
static void | print_info (std::ostream &out=libMesh::out) |
static unsigned int | n_objects () |
static void | enable_print_counter_info () |
static void | disable_print_counter_info () |
Public Attributes | |
bool | verbose_mode |
Protected Types | |
typedef std::map< std::string, std::pair< unsigned int, unsigned int > > | Counts |
Protected Member Functions | |
virtual void | init_data () |
RBParameters | get_params_from_training_set (unsigned int index) |
void | set_params_from_training_set (unsigned int index) |
virtual void | set_params_from_training_set_and_broadcast (unsigned int index) |
void | increment_constructor_count (const std::string &name) |
void | increment_destructor_count (const std::string &name) |
Static Protected Member Functions | |
static void | get_global_max_error_pair (const Parallel::Communicator &communicator, std::pair< numeric_index_type, Real > &error_pair) |
static void | generate_training_parameters_random (const Parallel::Communicator &communicator, std::map< std::string, bool > log_param_scale, std::map< std::string, std::unique_ptr< NumericVector< Number >>> &training_parameters_in, unsigned int n_training_samples_in, const RBParameters &min_parameters, const RBParameters &max_parameters, int training_parameters_random_seed=-1, bool serial_training_set=false) |
static void | generate_training_parameters_deterministic (const Parallel::Communicator &communicator, std::map< std::string, bool > log_param_scale, std::map< std::string, std::unique_ptr< NumericVector< Number >>> &training_parameters_in, unsigned int n_training_samples_in, const RBParameters &min_parameters, const RBParameters &max_parameters, bool serial_training_set=false) |
Protected Attributes | |
bool | quiet_mode |
bool | serial_training_set |
std::unique_ptr< NumericVector< Number > > | inner_product_storage_vector |
Static Protected Attributes | |
static Counts | _counts |
static Threads::atomic< unsigned int > | _n_objects |
static Threads::spin_mutex | _mutex |
static bool | _enable_print_counter = true |
Private Attributes | |
bool | training_parameters_initialized |
std::map< std::string, std::unique_ptr< NumericVector< Number > > > | training_parameters |
int | training_parameters_random_seed |
This class is part of the rbOOmit framework.
This is the base class for the Construction stage of the certified reduced basis (RB) method. We template the Base class so that we can derive from the appropriate libMesh System type (e.g. LinearImplicitSystem for standard reduced basis, EigenSystem for SCM) at compile time.
Definition at line 54 of file rb_construction_base.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.
typedef RBConstructionBase<Base> libMesh::RBConstructionBase< Base >::sys_type |
The type of system.
Definition at line 74 of file rb_construction_base.h.
libMesh::RBConstructionBase< Base >::RBConstructionBase | ( | EquationSystems & | es, |
const std::string & | name, | ||
const unsigned int | number | ||
) |
Constructor. Initializes required data structures.
|
virtual |
Destructor.
void libMesh::RBConstructionBase< Base >::broadcast_parameters | ( | unsigned int | proc_id | ) |
Broadcasts parameters on processor proc_id to all processors.
|
virtual |
Clear all the data structures associated with the system.
Reimplemented from libMesh::RBParametrized.
Reimplemented in libMesh::RBConstruction, libMesh::TransientSystem< RBConstruction >, libMesh::RBSCMConstruction, libMesh::RBEIMConstruction, and libMesh::TransientRBConstruction.
|
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.
|
staticprotected |
Static helper function for generating a deterministic set of parameters. Only works with 1 or 2 parameters (as defined by the lengths of min/max parameters vectors), otherwise throws an error.
|
staticprotected |
Static helper function for generating a randomized set of parameters.
|
staticinherited |
value
from list_of_values
. const std::string& libMesh::RBConstructionBase< Base >::get_deterministic_training_parameter_name | ( | ) | const |
Get the name of the parameter that we will generate deterministic training parameters for.
unsigned int libMesh::RBConstructionBase< Base >::get_deterministic_training_parameter_repeats | ( | ) | const |
Get the number of times each sample of the deterministic training parameter is repeated.
|
inherited |
Get a const reference to the discrete parameter values.
numeric_index_type libMesh::RBConstructionBase< Base >::get_first_local_training_index | ( | ) | const |
Get the first local index of the training parameters.
|
staticprotected |
Static function to return the error pair (index,error) that is corresponds to the largest error on all processors.
|
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().
numeric_index_type libMesh::RBConstructionBase< Base >::get_last_local_training_index | ( | ) | const |
Get the last local index of the training parameters.
numeric_index_type libMesh::RBConstructionBase< Base >::get_local_n_training_samples | ( | ) | const |
Get the total number of training samples local to this processor.
|
inherited |
Get the number of continuous parameters.
|
inherited |
Get the number of discrete parameters.
|
inherited |
Get the number of parameters.
numeric_index_type libMesh::RBConstructionBase< Base >::get_n_training_samples | ( | ) | const |
Get the total number of training samples.
|
inherited |
Get maximum allowable value of parameter param_name
.
|
inherited |
Get minimum allowable value of parameter param_name
.
|
inherited |
Get a set that stores the parameter names.
|
inherited |
Get the current parameters.
|
inherited |
Get an RBParameters object that specifies the maximum allowable value for each parameter.
|
inherited |
Get an RBParameters object that specifies the minimum allowable value for each parameter.
|
protected |
Return the RBParameters in index index
of training set.
|
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().
|
protectedvirtual |
Initializes the member data fields associated with the system, so that, e.g., assemble()
may be used.
Reimplemented in libMesh::RBEIMConstruction.
|
inherited |
Initialize the parameter ranges and set current_parameters.
|
inherited |
Initialize the parameter ranges and set current_parameters.
|
virtual |
Initialize the parameter ranges and indicate whether deterministic or random training parameters should be used and whether or not we want the parameters to be scaled logarithmically.
|
inherited |
Is parameter mu_name
discrete?
|
inline |
|
virtual |
Overwrite the training parameters with new_training_set.
|
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.
|
inherited |
Print out all the discrete parameter values.
|
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().
|
inherited |
Print the current parameters.
|
inherited |
Read in the parameter ranges from files.
void libMesh::RBConstructionBase< Base >::set_deterministic_training_parameter_name | ( | const std::string & | name | ) |
In some cases we only want to allow discrete parameter values, instead of parameters that may take any value in a specified interval. Here we provide a method to set the d Set the discrete values for parameter mu
that are allowed in the training set. This must be called before the training set is generated. Set the name of the parameter that we will generate deterministic training parameters for. Defaults to "NONE".
void libMesh::RBConstructionBase< Base >::set_deterministic_training_parameter_repeats | ( | unsigned int | repeats | ) |
Set the number of times each sample of the deterministic training parameter is repeated.
|
inherited |
Set the current parameters to params
|
protected |
Set parameters to the RBParameters stored in index index
of the training set.
|
protectedvirtual |
Load the specified training parameter and then broadcast to all processors.
|
inline |
Set the quiet_mode flag. If quiet == false then we print out a lot of extra information during the Offline stage.
Definition at line 92 of file rb_construction_base.h.
void libMesh::RBConstructionBase< Base >::set_training_random_seed | ( | unsigned int | seed | ) |
Set the seed that is used to randomly generate training parameters.
|
inline |
Definition at line 79 of file rb_construction_base.h.
|
inherited |
Write out the parameter ranges 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().
|
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().
|
protected |
We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary memory allocation/deallocation).
Definition at line 254 of file rb_construction_base.h.
|
protected |
Flag to indicate whether we print out extra information during the Offline stage.
Definition at line 239 of file rb_construction_base.h.
Referenced by libMesh::RBConstructionBase< CondensedEigenSystem >::is_quiet(), and libMesh::RBConstructionBase< CondensedEigenSystem >::set_quiet_mode().
|
protected |
This boolean flag indicates whether or not the training set should be the same on all processors. By default it is false, but in the case of the Empirical Interpolation Method (RBEIMConstruction), for example, we need the training set to be identical on all processors.
Definition at line 247 of file rb_construction_base.h.
|
private |
The training samples.
Definition at line 268 of file rb_construction_base.h.
|
private |
Boolean flag to indicate whether or not the parameter ranges have been initialized.
Definition at line 263 of file rb_construction_base.h.
|
private |
If < 0, use std::time() * processor_id() to seed the random number generator for the training parameters (default). If >= 0, use the provided value * processor_id() as the random number generator seed.
Definition at line 276 of file rb_construction_base.h.
|
inherited |
Public boolean to toggle verbose mode.
Definition at line 170 of file rb_parametrized.h.