libMesh::RBConstructionBase< Base > Class Template Reference
#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 () |
| 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) |
| std::pair< std::string, std::string > | set_alternative_solver (AutoPtr< LinearSolver< Number > > &ls) |
| void | reset_alternative_solver (AutoPtr< LinearSolver< Number > > &ls, const std::pair< std::string, std::string > &orig) |
| 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 RBParameters &mu_in) |
| void | initialize_parameters (const RBParametrized &rb_parametrized) |
| virtual void | initialize_parameters (const std::string ¶meters_filename) |
| unsigned int | get_n_params () 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_ranges_to_file (const std::string &file_name, const bool write_binary) |
| void | read_parameter_ranges_from_file (const std::string &file_name, const bool read_binary) |
Static Public Member Functions | |
| 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 (std::pair< unsigned int, Real > &error_pair) |
| static void | generate_training_parameters_random (std::map< std::string, bool > log_param_scale, std::map< std::string, 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_partially_random (const std::string &deterministic_parameter_name, const unsigned int deterministic_parameter_repeats, std::map< std::string, bool > log_param_scale, std::map< std::string, NumericVector< Number > * > &training_parameters_in, unsigned int n_deterministic_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 (std::map< std::string, bool > log_param_scale, std::map< std::string, 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 | serial_training_set |
| AutoPtr< NumericVector< Number > > | inner_product_storage_vector |
| std::string | alternative_solver |
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, NumericVector< Number > * > | training_parameters |
| int | training_parameters_random_seed |
| std::string | _deterministic_training_parameter_name |
| unsigned int | _deterministic_training_parameter_repeats |
Detailed Description
template<class Base>
class libMesh::RBConstructionBase< Base >
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 57 of file rb_construction_base.h.
Member Typedef Documentation
typedef std::map<std::string, std::pair<unsigned int, unsigned int> > libMesh::ReferenceCounter::Counts [protected, inherited] |
Data structure to log the information. The log is identified by the class name.
Definition at line 113 of file reference_counter.h.
| typedef RBConstructionBase<Base> libMesh::RBConstructionBase< Base >::sys_type |
The type of system.
Reimplemented in libMesh::RBConstruction, libMesh::RBEIMConstruction, libMesh::RBSCMConstruction, libMesh::TransientRBConstruction, and libMesh::TransientSystem< RBConstruction >.
Definition at line 77 of file rb_construction_base.h.
Constructor & Destructor Documentation
| libMesh::RBConstructionBase< Base >::RBConstructionBase | ( | EquationSystems & | es, | |
| const std::string & | name, | |||
| const unsigned int | number | |||
| ) |
Constructor. Initializes required data structures.
| virtual libMesh::RBConstructionBase< Base >::~RBConstructionBase | ( | ) | [virtual] |
Destructor.
Member Function Documentation
| void libMesh::RBConstructionBase< Base >::broadcast_parameters | ( | unsigned int | proc_id | ) |
Broadcasts parameters on processor proc_id to all processors.
| virtual void libMesh::RBConstructionBase< Base >::clear | ( | ) | [virtual] |
Clear all the data structures associated with the system.
Reimplemented from libMesh::RBParametrized.
Reimplemented in libMesh::RBConstruction, libMesh::RBEIMConstruction, libMesh::RBSCMConstruction, libMesh::TransientRBConstruction, and libMesh::TransientSystem< RBConstruction >.
| void libMesh::ReferenceCounter::disable_print_counter_info | ( | ) | [static, inherited] |
Definition at line 106 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter.
00107 { 00108 _enable_print_counter = false; 00109 return; 00110 }
| void libMesh::ReferenceCounter::enable_print_counter_info | ( | ) | [static, inherited] |
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.
00101 { 00102 _enable_print_counter = true; 00103 return; 00104 }
| static void libMesh::RBConstructionBase< Base >::generate_training_parameters_deterministic | ( | std::map< std::string, bool > | log_param_scale, | |
| std::map< std::string, NumericVector< Number > * > & | training_parameters_in, | |||
| unsigned int | n_training_samples_in, | |||
| const RBParameters & | min_parameters, | |||
| const RBParameters & | max_parameters, | |||
| bool | serial_training_set = false | |||
| ) | [static, protected] |
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.
| static void libMesh::RBConstructionBase< Base >::generate_training_parameters_partially_random | ( | const std::string & | deterministic_parameter_name, | |
| const unsigned int | deterministic_parameter_repeats, | |||
| std::map< std::string, bool > | log_param_scale, | |||
| std::map< std::string, NumericVector< Number > * > & | training_parameters_in, | |||
| unsigned int | n_deterministic_training_samples_in, | |||
| const RBParameters & | min_parameters, | |||
| const RBParameters & | max_parameters, | |||
| int | training_parameters_random_seed = -1, |
|||
| bool | serial_training_set = false | |||
| ) | [static, protected] |
Static helper function for generating a "partially" random set of parameters, that is the parameter indicated by this->get_deterministic_training_parameter() will be deterministic.
| static void libMesh::RBConstructionBase< Base >::generate_training_parameters_random | ( | std::map< std::string, bool > | log_param_scale, | |
| std::map< std::string, 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, protected] |
Static helper function for generating a randomized set of parameters.
| 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.
| numeric_index_type libMesh::RBConstructionBase< Base >::get_first_local_training_index | ( | ) | const |
Get the first local index of the training parameters.
| static void libMesh::RBConstructionBase< Base >::get_global_max_error_pair | ( | std::pair< unsigned int, Real > & | error_pair | ) | [static, protected] |
Static function to return the error pair (index,error) that is corresponds to the largest error on all processors.
| std::string libMesh::ReferenceCounter::get_info | ( | ) | [static, inherited] |
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().
00048 { 00049 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG) 00050 00051 std::ostringstream oss; 00052 00053 oss << '\n' 00054 << " ---------------------------------------------------------------------------- \n" 00055 << "| Reference count information |\n" 00056 << " ---------------------------------------------------------------------------- \n"; 00057 00058 for (Counts::iterator it = _counts.begin(); 00059 it != _counts.end(); ++it) 00060 { 00061 const std::string name(it->first); 00062 const unsigned int creations = it->second.first; 00063 const unsigned int destructions = it->second.second; 00064 00065 oss << "| " << name << " reference count information:\n" 00066 << "| Creations: " << creations << '\n' 00067 << "| Destructions: " << destructions << '\n'; 00068 } 00069 00070 oss << " ---------------------------------------------------------------------------- \n"; 00071 00072 return oss.str(); 00073 00074 #else 00075 00076 return ""; 00077 00078 #endif 00079 }
| 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.
| unsigned int libMesh::RBParametrized::get_n_params | ( | ) | const [inherited] |
Get the number of parameters.
| numeric_index_type libMesh::RBConstructionBase< Base >::get_n_training_samples | ( | ) | const |
Get the total number of training samples.
| Real libMesh::RBParametrized::get_parameter_max | ( | const std::string & | param_name | ) | const [inherited] |
Get maximum allowable value of parameter param_name.
| Real libMesh::RBParametrized::get_parameter_min | ( | const std::string & | param_name | ) | const [inherited] |
Get minimum allowable value of parameter param_name.
| const RBParameters& libMesh::RBParametrized::get_parameters | ( | ) | const [inherited] |
Get the current parameters.
| const RBParameters& libMesh::RBParametrized::get_parameters_max | ( | ) | const [inherited] |
Get an RBParameters object that specifies the maximum allowable value for each parameter.
| const RBParameters& libMesh::RBParametrized::get_parameters_min | ( | ) | const [inherited] |
Get an RBParameters object that specifies the minimum allowable value for each parameter.
| RBParameters libMesh::RBConstructionBase< Base >::get_params_from_training_set | ( | unsigned int | index | ) | [protected] |
Return the RBParameters in index index of training set.
| void libMesh::ReferenceCounter::increment_constructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the construction counter. Should be called in the constructor of any derived class that will be reference counted.
Definition at line 163 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().
00164 { 00165 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00166 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00167 00168 p.first++; 00169 }
| void libMesh::ReferenceCounter::increment_destructor_count | ( | const std::string & | name | ) | [inline, protected, inherited] |
Increments the destruction counter. Should be called in the destructor of any derived class that will be reference counted.
Definition at line 176 of file reference_counter.h.
References libMesh::ReferenceCounter::_counts, and libMesh::Threads::spin_mtx.
Referenced by libMesh::ReferenceCountedObject< RBParametrized >::~ReferenceCountedObject().
00177 { 00178 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx); 00179 std::pair<unsigned int, unsigned int>& p = _counts[name]; 00180 00181 p.second++; 00182 }
| virtual void libMesh::RBConstructionBase< Base >::init_data | ( | ) | [protected, virtual] |
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Reimplemented in libMesh::RBEIMConstruction, and libMesh::TransientSystem< RBConstruction >.
| virtual void libMesh::RBParametrized::initialize_parameters | ( | const std::string & | parameters_filename | ) | [virtual, inherited] |
Initialize the parameter ranges and set current_parameters by reading in data from the file input_filename
| void libMesh::RBParametrized::initialize_parameters | ( | const RBParametrized & | rb_parametrized | ) | [inherited] |
Initialize the parameter ranges and set current_parameters.
| void libMesh::RBParametrized::initialize_parameters | ( | const RBParameters & | mu_min_in, | |
| const RBParameters & | mu_max_in, | |||
| const RBParameters & | mu_in | |||
| ) | [inherited] |
Initialize the parameter ranges and set current_parameters.
| virtual void libMesh::RBConstructionBase< Base >::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] |
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.
| virtual void libMesh::RBConstructionBase< Base >::load_training_set | ( | std::map< std::string, std::vector< Number > > & | new_training_set | ) | [virtual] |
Overwrite the training parameters with new_training_set.
| static unsigned int libMesh::ReferenceCounter::n_objects | ( | ) | [inline, static, inherited] |
Prints the number of outstanding (created, but not yet destroyed) objects.
Definition at line 79 of file reference_counter.h.
References libMesh::ReferenceCounter::_n_objects.
00080 { return _n_objects; }
| void libMesh::ReferenceCounter::print_info | ( | std::ostream & | out = libMesh::out |
) | [static, inherited] |
Prints the reference information, by default to libMesh::out.
Definition at line 88 of file reference_counter.C.
References libMesh::ReferenceCounter::_enable_print_counter, and libMesh::ReferenceCounter::get_info().
00089 { 00090 if( _enable_print_counter ) out_stream << ReferenceCounter::get_info(); 00091 }
| void libMesh::RBParametrized::print_parameters | ( | ) | const [inherited] |
Print the current parameters.
| void libMesh::RBParametrized::read_parameter_ranges_from_file | ( | const std::string & | file_name, | |
| const bool | read_binary | |||
| ) | [inherited] |
Read in the parameter ranges from file. Initialize parameters to the "minimum" parameter values.
| void libMesh::RBConstructionBase< Base >::reset_alternative_solver | ( | AutoPtr< LinearSolver< Number > > & | ls, | |
| const std::pair< std::string, std::string > & | orig | |||
| ) |
Resets the PC (and iterative solver, if desired) in the passed-in LinearSolver object to the values specified in the pair of strings passed as the second argument. If the "alternative_solver" string, defined below, is "unchanged", this function does nothing.
| std::pair<std::string,std::string> libMesh::RBConstructionBase< Base >::set_alternative_solver | ( | AutoPtr< LinearSolver< Number > > & | ls | ) |
Changes the current PC (and iterative solver, if desired) in the passed-in LinearSolver object to an alternative solver specified by the alternative_solver string stored in this class. You might use this to e.g. switch to a sparse direct solver for the multiple RHS solves executed during the update_residual_terms function. The return strings are names of the original PC and KSP objects, you can reset these using the reset_alternative_solver() function below.
| void libMesh::RBConstructionBase< Base >::set_deterministic_training_parameter_name | ( | const std::string | name | ) |
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.
| void libMesh::RBParametrized::set_parameters | ( | const RBParameters & | params | ) | [inherited] |
Set the current parameters to params
| void libMesh::RBConstructionBase< Base >::set_params_from_training_set | ( | unsigned int | index | ) | [protected] |
Set parameters to the RBParameters stored in index index of the training set.
| virtual void libMesh::RBConstructionBase< Base >::set_params_from_training_set_and_broadcast | ( | unsigned int | index | ) | [protected, virtual] |
Load the specified training parameter and then broadcast to all processors.
| void libMesh::RBConstructionBase< Base >::set_training_random_seed | ( | unsigned int | seed | ) |
Set the seed that is used to randomly generate training parameters.
| sys_type& libMesh::RBConstructionBase< Base >::system | ( | ) | [inline] |
- Returns:
- a clever pointer to the system.
Reimplemented in libMesh::RBConstruction, and libMesh::TransientSystem< RBConstruction >.
Definition at line 82 of file rb_construction_base.h.
| void libMesh::RBParametrized::write_parameter_ranges_to_file | ( | const std::string & | file_name, | |
| const bool | write_binary | |||
| ) | [inherited] |
Write out the parameter ranges to file.
Member Data Documentation
ReferenceCounter::Counts libMesh::ReferenceCounter::_counts [static, protected, inherited] |
Actually holds the data.
Definition at line 118 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::get_info(), libMesh::ReferenceCounter::increment_constructor_count(), and libMesh::ReferenceCounter::increment_destructor_count().
std::string libMesh::RBConstructionBase< Base >::_deterministic_training_parameter_name [private] |
The name of the parameter that we will generate a deterministic training parameters for in the case of a "partially random" training set.
Definition at line 304 of file rb_construction_base.h.
unsigned int libMesh::RBConstructionBase< Base >::_deterministic_training_parameter_repeats [private] |
The number of times each sample of the deterministic training parameter is repeated in generating the training set.
Definition at line 310 of file rb_construction_base.h.
bool libMesh::ReferenceCounter::_enable_print_counter = true [static, protected, inherited] |
Flag to control whether reference count information is printed when print_info is called.
Definition at line 137 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::disable_print_counter_info(), libMesh::ReferenceCounter::enable_print_counter_info(), and libMesh::ReferenceCounter::print_info().
Threads::spin_mutex libMesh::ReferenceCounter::_mutex [static, protected, inherited] |
Mutual exclusion object to enable thread-safe reference counting.
Definition at line 131 of file reference_counter.h.
Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects [static, protected, inherited] |
The number of objects. Print the reference count information when the number returns to 0.
Definition at line 126 of file reference_counter.h.
Referenced by libMesh::ReferenceCounter::n_objects(), libMesh::ReferenceCounter::ReferenceCounter(), and libMesh::ReferenceCounter::~ReferenceCounter().
std::string libMesh::RBConstructionBase< Base >::alternative_solver [protected] |
Set this string to specify an alternative solver used in the set_alternative_solver() function above. Currently-supported values are: .) unchanged, to continue using the default truth solve solver .) amg, to use the BoomerAMG from Hypre (NOT for indefinite problems!) .) mumps, to use a sparse direct solver Note1: mumps and amg will only be available if PETSc has been compiled with them. Note2: RBConstruction::process_parameters_file() is responsible for reading in this value ("rb_alternative_solver") from file for RBConstruction-derived subclasses Note3: RBSCMSystem::process_parameters_file() reads this value ("scm_alternative_solver") for RBSCMSystem-derived subclasses
Definition at line 275 of file rb_construction_base.h.
AutoPtr< NumericVector<Number> > libMesh::RBConstructionBase< Base >::inner_product_storage_vector [protected] |
We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary memory allocation/deallocation).
Definition at line 261 of file rb_construction_base.h.
bool libMesh::RBConstructionBase< Base >::serial_training_set [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 254 of file rb_construction_base.h.
std::map< std::string, NumericVector<Number>* > libMesh::RBConstructionBase< Base >::training_parameters [private] |
The training samples.
Definition at line 289 of file rb_construction_base.h.
bool libMesh::RBConstructionBase< Base >::training_parameters_initialized [private] |
Boolean flag to indicate whether or not the parameter ranges have been initialized.
Definition at line 284 of file rb_construction_base.h.
int libMesh::RBConstructionBase< Base >::training_parameters_random_seed [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 297 of file rb_construction_base.h.
bool libMesh::RBParametrized::verbose_mode [inherited] |
Public boolean to toggle verbose mode.
Definition at line 141 of file rb_parametrized.h.
The documentation for this class was generated from the following file:
Site Created By: libMesh Developers
Last modified: February 05 2013 19:55:36 UTC
Hosted By: