libMesh
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
libMesh::RBConstructionBase< Base > Class Template Reference

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

#include <rb_construction_base.h>

Inheritance diagram for libMesh::RBConstructionBase< Base >:
[legend]

Public Types

typedef RBConstructionBase< Base > sys_type
 The type of system. More...
 

Public Member Functions

 RBConstructionBase (EquationSystems &es, const std::string &name, const unsigned int number)
 Constructor. More...
 
virtual ~RBConstructionBase ()
 Destructor. More...
 
sys_typesystem ()
 
virtual void clear ()
 Clear all the data structures associated with the system. More...
 
void set_quiet_mode (bool quiet_mode_in)
 Set the quiet_mode flag. More...
 
bool is_quiet () const
 Is the system in quiet mode? More...
 
numeric_index_type get_n_training_samples () const
 Get the total number of training samples. More...
 
numeric_index_type get_local_n_training_samples () const
 Get the total number of training samples local to this processor. More...
 
numeric_index_type get_first_local_training_index () const
 Get the first local index of the training parameters. More...
 
numeric_index_type get_last_local_training_index () const
 Get the last local index of the training parameters. More...
 
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)
 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. More...
 
virtual void load_training_set (std::map< std::string, std::vector< Number >> &new_training_set)
 Overwrite the training parameters with new_training_set. More...
 
void broadcast_parameters (unsigned int proc_id)
 Broadcasts parameters on processor proc_id to all processors. More...
 
void set_training_random_seed (unsigned int seed)
 Set the seed that is used to randomly generate training parameters. More...
 
void 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. More...
 
const std::string & get_deterministic_training_parameter_name () const
 Get the name of the parameter that we will generate deterministic training parameters for. More...
 
void set_deterministic_training_parameter_repeats (unsigned int repeats)
 Set the number of times each sample of the deterministic training parameter is repeated. More...
 
unsigned int get_deterministic_training_parameter_repeats () const
 Get the number of times each sample of the deterministic training parameter is repeated. 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 RBParametersget_parameters () const
 Get the current parameters. More...
 
void set_parameters (const RBParameters &params)
 Set the current parameters to params. More...
 
const RBParametersget_parameters_min () const
 Get an RBParameters object that specifies the minimum allowable value for each parameter. More...
 
const RBParametersget_parameters_max () const
 Get an RBParameters object that specifies the maximum allowable value for each parameter. More...
 
Real get_parameter_min (const std::string &param_name) const
 Get minimum allowable value of parameter param_name. More...
 
Real get_parameter_max (const std::string &param_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

virtual void init_data ()
 Initializes the member data fields associated with the system, so that, e.g., assemble() may be used. More...
 
RBParameters get_params_from_training_set (unsigned int index)
 Return the RBParameters in index index of training set. More...
 
void set_params_from_training_set (unsigned int index)
 Set parameters to the RBParameters stored in index index of the training set. More...
 
virtual void set_params_from_training_set_and_broadcast (unsigned int index)
 Load the specified training parameter and then broadcast to all processors. More...
 
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 Member Functions

static void get_global_max_error_pair (const Parallel::Communicator &communicator, std::pair< numeric_index_type, Real > &error_pair)
 Static function to return the error pair (index,error) that is corresponds to the largest error on all processors. More...
 
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 helper function for generating a randomized set of parameters. More...
 
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)
 Static helper function for generating a deterministic set of parameters. More...
 

Protected Attributes

bool quiet_mode
 Flag to indicate whether we print out extra information during the Offline stage. More...
 
bool serial_training_set
 This boolean flag indicates whether or not the training set should be the same on all processors. More...
 
std::unique_ptr< NumericVector< Number > > inner_product_storage_vector
 We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary memory allocation/deallocation). 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 &param_min, RBParameters &param_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 &params)
 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 training_parameters_initialized
 Boolean flag to indicate whether or not the parameter ranges have been initialized. More...
 
std::map< std::string, std::unique_ptr< NumericVector< Number > > > training_parameters
 The training samples. More...
 
int training_parameters_random_seed
 If < 0, use std::time() * processor_id() to seed the random number generator for the training parameters (default). More...
 
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...
 

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.

Author
David J. Knezevic
Date
2009

Definition at line 54 of file rb_construction_base.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 117 of file reference_counter.h.

◆ sys_type

template<class Base>
typedef RBConstructionBase<Base> libMesh::RBConstructionBase< Base >::sys_type

The type of system.

Definition at line 74 of file rb_construction_base.h.

Constructor & Destructor Documentation

◆ RBConstructionBase()

template<class Base >
libMesh::RBConstructionBase< Base >::RBConstructionBase ( EquationSystems es,
const std::string &  name,
const unsigned int  number 
)

Constructor.

Initializes required data structures.

Definition at line 46 of file rb_construction_base.C.

49  : Base(es, name_in, number_in),
50  quiet_mode(true),
51  serial_training_set(false),
53  training_parameters_random_seed(-1) // by default, use std::time to seed RNG
54 {
55  training_parameters.clear();
56 }

◆ ~RBConstructionBase()

template<class Base >
libMesh::RBConstructionBase< Base >::~RBConstructionBase ( )
virtual

Destructor.

Definition at line 59 of file rb_construction_base.C.

60 {
61  this->clear();
62 }

Member Function Documentation

◆ broadcast_parameters()

template<class Base >
void libMesh::RBConstructionBase< Base >::broadcast_parameters ( unsigned int  proc_id)

Broadcasts parameters on processor proc_id to all processors.

Definition at line 600 of file rb_construction_base.C.

601 {
602  libmesh_assert_less (proc_id, this->n_processors());
603 
604  // create a copy of the current parameters
605  RBParameters current_parameters = get_parameters();
606 
607  // copy current_parameters to current_parameters_vector in order to broadcast
608  std::vector<Real> current_parameters_vector;
609 
610  for (const auto & pr : current_parameters)
611  current_parameters_vector.push_back(pr.second);
612 
613  // do the broadcast
614  this->comm().broadcast(current_parameters_vector, proc_id);
615 
616  // update the copy of the RBParameters object
617  unsigned int count = 0;
618  for (const auto & pr : current_parameters)
619  {
620  const std::string & param_name = pr.first;
621  current_parameters.set_value(param_name, current_parameters_vector[count]);
622  count++;
623  }
624 
625  // set the parameters globally
626  set_parameters(current_parameters);
627 }

◆ clear()

template<class Base >
void libMesh::RBConstructionBase< Base >::clear ( )
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.

Definition at line 65 of file rb_construction_base.C.

66 {
67  // clear the parent data
68  Base::clear();
70  training_parameters.clear();
71 }

◆ disable_print_counter_info()

void libMesh::ReferenceCounter::disable_print_counter_info ( )
staticinherited

Definition at line 106 of file reference_counter.C.

107 {
108  _enable_print_counter = false;
109  return;
110 }

References libMesh::ReferenceCounter::_enable_print_counter.

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

◆ enable_print_counter_info()

void libMesh::ReferenceCounter::enable_print_counter_info ( )
staticinherited

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

Definition at line 100 of file reference_counter.C.

101 {
102  _enable_print_counter = true;
103  return;
104 }

References libMesh::ReferenceCounter::_enable_print_counter.

◆ generate_training_parameters_deterministic()

template<class Base >
void libMesh::RBConstructionBase< Base >::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 
)
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.

Definition at line 412 of file rb_construction_base.C.

419 {
420  libmesh_assert_equal_to ( min_parameters.n_parameters(), max_parameters.n_parameters() );
421  const unsigned int num_params = min_parameters.n_parameters();
422 
423  if (num_params == 0)
424  return;
425 
426  if (num_params > 2)
427  {
428  libMesh::out << "ERROR: Deterministic training sample generation "
429  << " not implemented for more than two parameters." << std::endl;
430  libmesh_not_implemented();
431  }
432 
433  // Clear training_parameters_in (but don't remove existing keys!)
434  for (auto & pr : training_parameters_in)
435  pr.second.reset(nullptr);
436 
437  // Initialize training_parameters_in
438  for (const auto & pr : min_parameters)
439  {
440  const std::string & param_name = pr.first;
441  training_parameters_in[param_name] = NumericVector<Number>::build(communicator);
442 
443  if (!serial_training_set)
444  {
445  // Calculate the number of training parameters local to this processor
446  unsigned int n_local_training_samples;
447  unsigned int quotient = n_training_samples_in/communicator.size();
448  unsigned int remainder = n_training_samples_in%communicator.size();
449  if (communicator.rank() < remainder)
450  n_local_training_samples = (quotient + 1);
451  else
452  n_local_training_samples = quotient;
453 
454  training_parameters_in[param_name]->init(n_training_samples_in, n_local_training_samples, false, PARALLEL);
455  }
456  else
457  {
458  training_parameters_in[param_name]->init(n_training_samples_in, false, SERIAL);
459  }
460  }
461 
462  if (num_params == 1)
463  {
464  NumericVector<Number> * training_vector = training_parameters_in.begin()->second.get();
465  bool use_log_scaling = log_param_scale.begin()->second;
466  Real min_param = min_parameters.begin()->second;
467  Real max_param = max_parameters.begin()->second;
468 
469  numeric_index_type first_index = training_vector->first_local_index();
470  for (auto i : IntRange<numeric_index_type>(0, training_vector->local_size()))
471  {
472  numeric_index_type index = first_index+i;
473  if (use_log_scaling)
474  {
475  Real epsilon = 1.e-6; // Prevent rounding errors triggering asserts
476  Real log_min = log10(min_param + epsilon);
477  Real log_range = log10( (max_param-epsilon) / (min_param+epsilon) );
478  Real step_size = log_range /
479  std::max((unsigned int)1,(n_training_samples_in-1));
480 
481  if (index<(n_training_samples_in-1))
482  {
483  training_vector->set(index, pow(10., log_min + index*step_size ));
484  }
485  else
486  {
487  // due to rounding error, the last parameter can be slightly
488  // bigger than max_parameters, hence snap back to the max
489  training_vector->set(index, max_param);
490  }
491  }
492  else
493  {
494  // Generate linearly scaled training parameters
495  Real step_size = (max_param - min_param) /
496  std::max((unsigned int)1,(n_training_samples_in-1));
497  training_vector->set(index, index*step_size + min_param);
498  }
499  }
500  }
501 
502 
503  // This is for two parameters
504  if (num_params == 2)
505  {
506  // First make sure n_training_samples_in is a square number
507  unsigned int n_training_parameters_per_var = static_cast<unsigned int>( std::sqrt(static_cast<Real>(n_training_samples_in)) );
508  if ((n_training_parameters_per_var*n_training_parameters_per_var) != n_training_samples_in)
509  libmesh_error_msg("Error: Number of training parameters = " \
510  << n_training_samples_in \
511  << ".\n" \
512  << "Deterministic training set generation with two parameters requires\n " \
513  << "the number of training parameters to be a perfect square.");
514 
515  // make a matrix to store all the parameters, put them in vector form afterwards
516  std::vector<std::vector<Real>> training_parameters_matrix(num_params);
517 
518  unsigned int i = 0;
519  for (const auto & pr : min_parameters)
520  {
521  const std::string & param_name = pr.first;
522  Real min_param = pr.second;
523  bool use_log_scaling = log_param_scale[param_name];
524  Real max_param = max_parameters.get_value(param_name);
525 
526  training_parameters_matrix[i].resize(n_training_parameters_per_var);
527 
528  for (unsigned int j=0; j<n_training_parameters_per_var; j++)
529  {
530  // Generate log10 scaled training parameters
531  if (use_log_scaling)
532  {
533  Real epsilon = 1.e-6; // Prevent rounding errors triggering asserts
534  Real log_min = log10(min_param + epsilon);
535  Real log_range = log10( (max_param-epsilon) / (min_param+epsilon) );
536  Real step_size = log_range /
537  std::max((unsigned int)1,(n_training_parameters_per_var-1));
538 
539  if (j<(n_training_parameters_per_var-1))
540  {
541  training_parameters_matrix[i][j] = pow(10., log_min + j*step_size );
542  }
543  else
544  {
545  // due to rounding error, the last parameter can be slightly
546  // bigger than max_parameters, hence snap back to the max
547  training_parameters_matrix[i][j] = max_param;
548  }
549  }
550  else
551  {
552  // Generate linearly scaled training parameters
553  Real step_size = (max_param - min_param) /
554  std::max((unsigned int)1,(n_training_parameters_per_var-1));
555  training_parameters_matrix[i][j] = j*step_size + min_param;
556  }
557 
558  }
559  i++;
560  }
561 
562  // now load into training_samples_in:
563  std::map<std::string, std::unique_ptr<NumericVector<Number>>>::iterator new_it = training_parameters_in.begin();
564 
565  NumericVector<Number> * training_vector_0 = new_it->second.get();
566  ++new_it;
567  NumericVector<Number> * training_vector_1 = new_it->second.get();
568 
569  for (unsigned int index1=0; index1<n_training_parameters_per_var; index1++)
570  {
571  for (unsigned int index2=0; index2<n_training_parameters_per_var; index2++)
572  {
573  unsigned int index = index1*n_training_parameters_per_var + index2;
574 
575  if ((training_vector_0->first_local_index() <= index) &&
576  (index < training_vector_0->last_local_index()))
577  {
578  training_vector_0->set(index, training_parameters_matrix[0][index1]);
579  training_vector_1->set(index, training_parameters_matrix[1][index2]);
580  }
581  }
582  }
583 
584  // libMesh::out << "n_training_samples = " << n_training_samples_in << std::endl;
585  // for (unsigned int index=0; index<n_training_samples_in; index++)
586  // {
587  // libMesh::out << "training parameters for index="<<index<<":"<<std::endl;
588  // for (unsigned int param=0; param<num_params; param++)
589  // {
590  // libMesh::out << " " << (*training_parameters_in[param])(index);
591  // }
592  // libMesh::out << std::endl << std::endl;
593  // }
594 
595  }
596 }

◆ generate_training_parameters_random()

template<class Base >
void libMesh::RBConstructionBase< Base >::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 
)
staticprotected

Static helper function for generating a randomized set of parameters.

Definition at line 300 of file rb_construction_base.C.

308 {
309  libmesh_assert_equal_to ( min_parameters.n_parameters(), max_parameters.n_parameters() );
310  const unsigned int num_params = min_parameters.n_parameters();
311 
312  // Clear training_parameters_in
313  training_parameters_in.clear();
314 
315  if (num_params == 0)
316  return;
317 
319  {
320  if (!serial_training_set)
321  {
322  // seed the random number generator with the system time
323  // and the processor ID so that the seed is different
324  // on different processors
325  std::srand( static_cast<unsigned>( std::time(0)*(1+communicator.rank()) ));
326  }
327  else
328  {
329  // seed the random number generator with the system time
330  // only so that the seed is the same on all processors
331  //
332  // Note that we broadcast the time on processor 0 to make
333  // sure all processors agree.
334  unsigned int current_time = static_cast<unsigned>( std::time(0) );
335  communicator.broadcast(current_time, 0);
336  std::srand(current_time);
337  }
338  }
339  else
340  {
341  if (!serial_training_set)
342  {
343  // seed the random number generator with the provided value
344  // and the processor ID so that the seed is different
345  // on different processors
346  std::srand( static_cast<unsigned>( training_parameters_random_seed*(1+communicator.rank()) ));
347  }
348  else
349  {
350  // seed the random number generator with the provided value
351  // so that the seed is the same on all processors
352  std::srand( static_cast<unsigned>( training_parameters_random_seed ));
353  }
354  }
355 
356  // initialize training_parameters_in
357  for (const auto & pr : min_parameters)
358  {
359  const std::string & param_name = pr.first;
360  training_parameters_in[param_name] = NumericVector<Number>::build(communicator);
361 
362  if (!serial_training_set)
363  {
364  // Calculate the number of training parameters local to this processor
365  unsigned int n_local_training_samples;
366  unsigned int quotient = n_training_samples_in/communicator.size();
367  unsigned int remainder = n_training_samples_in%communicator.size();
368  if (communicator.rank() < remainder)
369  n_local_training_samples = (quotient + 1);
370  else
371  n_local_training_samples = quotient;
372 
373  training_parameters_in[param_name]->init(n_training_samples_in, n_local_training_samples, false, PARALLEL);
374  }
375  else
376  {
377  training_parameters_in[param_name]->init(n_training_samples_in, false, SERIAL);
378  }
379  }
380 
381  // finally, set the values
382  for (auto & pr : training_parameters_in)
383  {
384  const std::string & param_name = pr.first;
385  NumericVector<Number> * training_vector = pr.second.get();
386 
387  numeric_index_type first_index = training_vector->first_local_index();
388  for (auto i : IntRange<numeric_index_type>(0, training_vector->local_size()))
389  {
390  numeric_index_type index = first_index + i;
391  Real random_number = static_cast<Real>(std::rand()) / RAND_MAX; // in range [0,1]
392 
393  // Generate log10 scaled training parameters
394  if (log_param_scale[param_name])
395  {
396  Real log_min = log10(min_parameters.get_value(param_name));
397  Real log_range = log10(max_parameters.get_value(param_name) / min_parameters.get_value(param_name));
398 
399  training_vector->set(index, pow(10., log_min + random_number*log_range ) );
400  }
401  // Generate linearly scaled training parameters
402  else
403  {
404  training_vector->set(index, random_number*(max_parameters.get_value(param_name) - min_parameters.get_value(param_name))
405  + min_parameters.get_value(param_name));
406  }
407  }
408  }
409 }

◆ 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 433 of file rb_parametrized.C.

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

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

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

◆ get_deterministic_training_parameter_name()

template<class Base>
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.

◆ get_deterministic_training_parameter_repeats()

template<class Base>
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.

◆ get_discrete_parameter_values()

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

◆ get_first_local_training_index()

template<class Base >
numeric_index_type libMesh::RBConstructionBase< Base >::get_first_local_training_index ( ) const

Get the first local index of the training parameters.

Definition at line 116 of file rb_construction_base.C.

117 {
119  return training_parameters.begin()->second->first_local_index();
120 }

◆ get_global_max_error_pair()

template<class Base >
void libMesh::RBConstructionBase< Base >::get_global_max_error_pair ( const Parallel::Communicator &  communicator,
std::pair< numeric_index_type, Real > &  error_pair 
)
staticprotected

Static function to return the error pair (index,error) that is corresponds to the largest error on all processors.

Definition at line 85 of file rb_construction_base.C.

87 {
88  // Set error_pair.second to the maximum global value and also
89  // find which processor contains the maximum value
90  unsigned int proc_ID_index;
91  communicator.maxloc(error_pair.second, proc_ID_index);
92 
93  // Then broadcast error_pair.first from proc_ID_index
94  communicator.broadcast(error_pair.first, proc_ID_index);
95 }

◆ 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 & pr : _counts)
59  {
60  const std::string name(pr.first);
61  const unsigned int creations = pr.second.first;
62  const unsigned int destructions = pr.second.second;
63 
64  oss << "| " << name << " reference count information:\n"
65  << "| Creations: " << creations << '\n'
66  << "| Destructions: " << destructions << '\n';
67  }
68 
69  oss << " ---------------------------------------------------------------------------- \n";
70 
71  return oss.str();
72 
73 #else
74 
75  return "";
76 
77 #endif
78 }

References libMesh::ReferenceCounter::_counts, and libMesh::Quality::name().

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

◆ get_last_local_training_index()

template<class Base >
numeric_index_type libMesh::RBConstructionBase< Base >::get_last_local_training_index ( ) const

Get the last local index of the training parameters.

Definition at line 123 of file rb_construction_base.C.

124 {
126  return training_parameters.begin()->second->last_local_index();
127 }

◆ get_local_n_training_samples()

template<class Base >
numeric_index_type libMesh::RBConstructionBase< Base >::get_local_n_training_samples ( ) const

Get the total number of training samples local to this processor.

Definition at line 109 of file rb_construction_base.C.

110 {
112  return training_parameters.begin()->second->local_size();
113 }

◆ get_n_continuous_params()

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

Get the number of continuous parameters.

Definition at line 125 of file rb_parametrized.C.

126 {
128  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_continuous_params");
129 
131 
132  return static_cast<unsigned int>(get_n_params() - get_n_discrete_params());
133 }

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 135 of file rb_parametrized.C.

136 {
138  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_n_discrete_params");
139 
140  return cast_int<unsigned int>
142 }

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

template<class Base >
numeric_index_type libMesh::RBConstructionBase< Base >::get_n_training_samples ( ) const

Get the total number of training samples.

Definition at line 98 of file rb_construction_base.C.

99 {
101 
102  if (training_parameters.empty())
103  return 0;
104 
105  return training_parameters.begin()->second->size();
106 }

◆ 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 198 of file rb_parametrized.C.

199 {
201  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_max");
202 
203  return parameters_max.get_value(param_name);
204 }

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

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

◆ 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 190 of file rb_parametrized.C.

191 {
193  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_min");
194 
195  return parameters_min.get_value(param_name);
196 }

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

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

◆ get_parameter_names()

std::set< std::string > libMesh::RBParametrized::get_parameter_names ( ) const
inherited

Get a set that stores the parameter names.

Definition at line 144 of file rb_parametrized.C.

145 {
147  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameter_names");
148 
149  std::set<std::string> parameter_names;
150  parameters_min.get_parameter_names(parameter_names);
151 
152  return parameter_names;
153 }

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

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder().

◆ get_parameters()

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

Get the current parameters.

Definition at line 166 of file rb_parametrized.C.

167 {
169  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_current_parameters");
170 
171  return parameters;
172 }

References libMesh::RBParametrized::parameters, and libMesh::RBParametrized::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(), libMesh::RBParametrized::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().

◆ get_parameters_max()

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

Get an RBParameters object that specifies the maximum allowable value for each parameter.

Definition at line 182 of file rb_parametrized.C.

183 {
185  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_max");
186 
187  return parameters_max;
188 }

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

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

◆ get_parameters_min()

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

Get an RBParameters object that specifies the minimum allowable value for each parameter.

Definition at line 174 of file rb_parametrized.C.

175 {
177  libmesh_error_msg("Error: parameters not initialized in RBParametrized::get_parameters_min");
178 
179  return parameters_min;
180 }

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

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::set_rb_construction_parameters(), and libMesh::RBParametrized::write_parameter_ranges_to_file().

◆ get_params_from_training_set()

template<class Base >
RBParameters libMesh::RBConstructionBase< Base >::get_params_from_training_set ( unsigned int  index)
protected

Return the RBParameters in index index of training set.

Definition at line 136 of file rb_construction_base.C.

137 {
139 
140  libmesh_assert( (this->get_first_local_training_index() <= index) &&
141  (index < this->get_last_local_training_index()) );
142 
143  RBParameters params;
144  for (const auto & pr : training_parameters)
145  {
146  const std::string & param_name = pr.first;
147  Real param_value = libmesh_real((*(pr.second))(index));
148  params.set_value(param_name, param_value);
149  }
150 
151  // Add potential extra values
152  const auto & mine = get_parameters();
153  for (const auto & pr : as_range(mine.extra_begin(), mine.extra_end()))
154  params.set_extra_value(pr.first, pr.second);
155 
156  return params;
157 }

◆ increment_constructor_count()

void libMesh::ReferenceCounter::increment_constructor_count ( const std::string &  name)
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.

182 {
183  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
184  std::pair<unsigned int, unsigned int> & p = _counts[name];
185 
186  p.first++;
187 }

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

Referenced by libMesh::ReferenceCountedObject< RBParametrized >::ReferenceCountedObject().

◆ increment_destructor_count()

void libMesh::ReferenceCounter::increment_destructor_count ( const std::string &  name)
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.

195 {
196  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
197  std::pair<unsigned int, unsigned int> & p = _counts[name];
198 
199  p.second++;
200 }

References libMesh::ReferenceCounter::_counts, libMesh::Quality::name(), and libMesh::Threads::spin_mtx.

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

◆ init_data()

template<class Base >
void libMesh::RBConstructionBase< Base >::init_data ( )
protectedvirtual

Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Reimplemented in libMesh::RBEIMConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, SimpleRBConstruction, and ElasticityRBConstruction.

Definition at line 74 of file rb_construction_base.C.

75 {
76  Base::init_data();
77 
78  // Initialize the inner product storage vector, which is useful for
79  // storing intermediate results when evaluating inner products
81  inner_product_storage_vector->init (this->n_dofs(), this->n_local_dofs(), false, PARALLEL);
82 }

◆ 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.

Definition at line 60 of file rb_parametrized.C.

63 {
64  // Check that the min/max vectors are valid
65  {
66  const std::string err_string = "Error: Invalid mu_min/mu_max in RBParameters constructor.";
67  bool valid_min_max = (mu_min_in.n_parameters() == mu_max_in.n_parameters());
68  if (!valid_min_max)
69  libmesh_error_msg(err_string);
70 
71  else
72  {
73  for (const auto & pr : mu_min_in)
74  {
75  const std::string & param_name = pr.first;
76  if (mu_min_in.get_value(param_name) > mu_max_in.get_value(param_name))
77  libmesh_error_msg(err_string);
78  }
79  }
80  }
81 
82  parameters_min = mu_min_in;
83  parameters_max = mu_max_in;
84 
85  // Add in min/max values due to the discrete parameters
86  for (const auto & pr : discrete_parameter_values)
87  {
88  if (pr.second.empty())
89  libmesh_error_msg("Error: List of discrete parameters for " << pr.first << " is empty.");
90 
91  Real min_val = *std::min_element(pr.second.begin(), pr.second.end());
92  Real max_val = *std::max_element(pr.second.begin(), pr.second.end());
93 
94  libmesh_assert_less_equal(min_val,max_val);
95 
96  parameters_min.set_value(pr.first, min_val);
97  parameters_max.set_value(pr.first, max_val);
98  }
99 
100  _discrete_parameter_values = discrete_parameter_values;
101 
102  parameters_initialized = true;
103 
104  // Initialize the current parameters to parameters_min
106 }

References libMesh::RBParametrized::_discrete_parameter_values, libMesh::RBParameters::get_value(), libMesh::RBParameters::n_parameters(), 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::RBEIMConstruction::initialize_parametrized_functions_in_training_set(), 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(), and libMesh::RBConstruction::train_reduced_basis().

◆ 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 108 of file rb_parametrized.C.

109 {
110  initialize_parameters(rb_parametrized.get_parameters_min(),
111  rb_parametrized.get_parameters_max(),
112  rb_parametrized.get_discrete_parameter_values());
113 }

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

◆ initialize_training_parameters()

template<class Base >
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.

Definition at line 181 of file rb_construction_base.C.

186 {
187  if(!is_quiet())
188  {
189  // Print out some info about the training set initialization
190  libMesh::out << "Initializing training parameters with "
191  << (deterministic ? "deterministic " : "random " )
192  << "training set..." << std::endl;
193 
194  for (const auto & pr : log_param_scale)
195  libMesh::out << "Parameter "
196  << pr.first
197  << ": log scaling = "
198  << pr.second
199  << std::endl;
200 
201  libMesh::out << std::endl;
202  }
203 
204  if (deterministic)
205  {
207  log_param_scale,
209  n_training_samples,
210  mu_min,
211  mu_max,
213  }
214  else
215  {
216  // Generate random training samples for all parameters
218  log_param_scale,
220  n_training_samples,
221  mu_min,
222  mu_max,
225  }
226 
227  // For each parameter that only allows discrete values, we "snap" to the nearest
228  // allowable discrete value
229  if (get_n_discrete_params() > 0)
230  {
231  for (const auto & pr : training_parameters)
232  {
233  const std::string & param_name = pr.first;
234  if (is_discrete_parameter(param_name))
235  {
236  std::vector<Real> discrete_values =
237  get_discrete_parameter_values().find(param_name)->second;
238 
239  NumericVector<Number> * training_vector = pr.second.get();
240 
241  for (numeric_index_type index=training_vector->first_local_index();
242  index<training_vector->last_local_index();
243  index++)
244  {
245  Real value = libmesh_real((*training_vector)(index));
246  Real nearest_discrete_value = get_closest_value(value, discrete_values);
247  training_vector->set(index, nearest_discrete_value);
248  }
249  }
250  }
251  }
252 
254 }

◆ is_discrete_parameter()

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

Is parameter mu_name discrete?

Definition at line 373 of file rb_parametrized.C.

374 {
376  libmesh_error_msg("Error: parameters not initialized in RBParametrized::is_discrete_parameter");
377 
378  return (_discrete_parameter_values.find(mu_name) != _discrete_parameter_values.end());
379 }

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

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

◆ is_quiet()

template<class Base>
bool libMesh::RBConstructionBase< Base >::is_quiet ( ) const
inline

Is the system in quiet mode?

Definition at line 98 of file rb_construction_base.h.

99  { return this->quiet_mode; }

◆ 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 453 of file rb_parametrized.C.

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

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

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

◆ load_training_set()

template<class Base >
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.

Definition at line 257 of file rb_construction_base.C.

258 {
259  // First, make sure that an initial training set has already been
260  // generated
262  libmesh_error_msg("Error: load_training_set cannot be used to initialize parameters");
263 
264  // Make sure that the training set has the correct number of parameters
265  if (new_training_set.size() != get_n_params())
266  libmesh_error_msg("Error: Incorrect number of parameters in load_training_set.");
267 
268  // Delete the training set vectors (but don't remove the existing keys!)
269  for (auto & pr : training_parameters)
270  pr.second.reset(nullptr);
271 
272  // Get the number of local and global training parameters
273  numeric_index_type n_local_training_samples =
274  cast_int<numeric_index_type>(new_training_set.begin()->second.size());
275  numeric_index_type n_global_training_samples = n_local_training_samples;
276  this->comm().sum(n_global_training_samples);
277 
278  for (auto & pr : training_parameters)
279  {
280  pr.second = NumericVector<Number>::build(this->comm());
281  pr.second->init(n_global_training_samples, n_local_training_samples, false, PARALLEL);
282  }
283 
284  for (auto & pr : training_parameters)
285  {
286  const std::string & param_name = pr.first;
287  NumericVector<Number> * training_vector = pr.second.get();
288 
289  numeric_index_type first_index = training_vector->first_local_index();
290  for (numeric_index_type i=0; i<n_local_training_samples; i++)
291  {
292  numeric_index_type index = first_index + i;
293  training_vector->set(index, new_training_set[param_name][i]);
294  }
295  }
296 }

◆ n_objects()

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

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

Definition at line 83 of file reference_counter.h.

84  { return _n_objects; }

References libMesh::ReferenceCounter::_n_objects.

◆ print_discrete_parameter_values()

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

Print out all the discrete parameter values.

Definition at line 389 of file rb_parametrized.C.

390 {
391  for (const auto & pr : get_discrete_parameter_values())
392  {
393  libMesh::out << "Discrete parameter " << pr.first << ", values: ";
394 
395  const std::vector<Real> & values = pr.second;
396  for (const auto & value : values)
397  libMesh::out << value << " ";
398  libMesh::out << std::endl;
399  }
400 }

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

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

◆ print_info()

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

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

Definition at line 87 of file reference_counter.C.

88 {
90  out_stream << ReferenceCounter::get_info();
91 }

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

◆ print_parameters()

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

Print the current parameters.

Definition at line 206 of file rb_parametrized.C.

207 {
209  libmesh_error_msg("Error: parameters not initialized in RBParametrized::print_current_parameters");
210 
211  get_parameters().print();
212 }

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

Referenced by libMesh::RBConstruction::train_reduced_basis().

◆ 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 340 of file rb_parametrized.C.

343 {
344  // read in the discrete parameters, if we have any
345  std::ifstream check_if_file_exists(file_name.c_str());
346  if (check_if_file_exists.good())
347  {
348  // The reading mode: DECODE for binary, READ for ASCII
349  XdrMODE mode = read_binary_data ? DECODE : READ;
350 
351  // Read in the parameter ranges
352  Xdr discrete_parameter_values_in(file_name, mode);
353  unsigned int n_discrete_params;
354  discrete_parameter_values_in >> n_discrete_params;
355 
356  for (unsigned int i=0; i<n_discrete_params; i++)
357  {
358  std::string param_name;
359  discrete_parameter_values_in >> param_name;
360 
361  unsigned int n_discrete_values;
362  discrete_parameter_values_in >> n_discrete_values;
363 
364  std::vector<Real> discrete_values(n_discrete_values);
365  for (auto & val : discrete_values)
366  discrete_parameter_values_in >> val;
367 
368  discrete_parameter_values[param_name] = discrete_values;
369  }
370  }
371 }

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 284 of file rb_parametrized.C.

287 {
288  RBParameters param_min;
289  RBParameters param_max;
290  read_parameter_ranges_from_file(continuous_param_file_name,
291  read_binary_data,
292  param_min,
293  param_max);
294 
295  std::map<std::string, std::vector<Real>> discrete_parameter_values_in;
296  read_discrete_parameter_values_from_file(discrete_param_file_name,
297  read_binary_data,
298  discrete_parameter_values_in);
299 
300  initialize_parameters(param_min, param_max, discrete_parameter_values_in);
301 }

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 libMesh::RBSCMEvaluation::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 303 of file rb_parametrized.C.

307 {
308  // The reading mode: DECODE for binary, READ for ASCII
309  XdrMODE mode = read_binary_data ? DECODE : READ;
310 
311  // Read in the parameter ranges
312  Xdr parameter_ranges_in(file_name, mode);
313  unsigned int n_continuous_params;
314  parameter_ranges_in >> n_continuous_params;
315 
316  for (unsigned int i=0; i<n_continuous_params; i++)
317  {
318  std::string param_name;
319  Real param_value;
320 
321  parameter_ranges_in >> param_name;
322  parameter_ranges_in >> param_value;
323 
324  param_min.set_value(param_name, param_value);
325  }
326  for (unsigned int i=0; i<n_continuous_params; i++)
327  {
328  std::string param_name;
329  Real param_value;
330 
331  parameter_ranges_in >> param_name;
332  parameter_ranges_in >> param_value;
333 
334  param_max.set_value(param_name, param_value);
335  }
336 
337  parameter_ranges_in.close();
338 }

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

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

◆ set_deterministic_training_parameter_name()

template<class Base>
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".

◆ set_deterministic_training_parameter_repeats()

template<class Base>
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.

◆ set_parameters()

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

Set the current parameters to params.

Definition at line 155 of file rb_parametrized.C.

156 {
158  libmesh_error_msg("Error: parameters not initialized in RBParametrized::set_current_parameters");
159 
160  valid_params(params); // Terminates if params has the wrong number of parameters
161 
162  // Make a copy of params (default assignment operator just does memberwise copy, which is sufficient here)
163  this->parameters = params;
164 }

References libMesh::RBParametrized::parameters, libMesh::RBParametrized::parameters_initialized, and libMesh::RBParametrized::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(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBSCMEvaluation::reload_current_parameters(), libMesh::RBSCMEvaluation::set_current_parameters_from_C_J(), and libMesh::RBEIMConstruction::truth_solve().

◆ set_params_from_training_set()

template<class Base >
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.

Definition at line 130 of file rb_construction_base.C.

131 {
133 }

◆ set_params_from_training_set_and_broadcast()

template<class Base >
void libMesh::RBConstructionBase< Base >::set_params_from_training_set_and_broadcast ( unsigned int  index)
protectedvirtual

Load the specified training parameter and then broadcast to all processors.

Definition at line 160 of file rb_construction_base.C.

161 {
163 
164  processor_id_type root_id = 0;
165  if ((this->get_first_local_training_index() <= index) &&
166  (index < this->get_last_local_training_index()))
167  {
168  // Set parameters on only one processor
170 
171  // set root_id, only non-zero on one processor
172  root_id = this->processor_id();
173  }
174 
175  // broadcast
176  this->comm().max(root_id);
177  broadcast_parameters(root_id);
178 }

◆ set_quiet_mode()

template<class Base>
void libMesh::RBConstructionBase< Base >::set_quiet_mode ( bool  quiet_mode_in)
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.

93  { this->quiet_mode = quiet_mode_in; }

◆ set_training_random_seed()

template<class Base >
void libMesh::RBConstructionBase< Base >::set_training_random_seed ( unsigned int  seed)

Set the seed that is used to randomly generate training parameters.

Definition at line 630 of file rb_construction_base.C.

631 {
632  this->training_parameters_random_seed = seed;
633 }

◆ system()

template<class Base>
sys_type& libMesh::RBConstructionBase< Base >::system ( )
inline
Returns
A reference to *this.

Definition at line 79 of file rb_construction_base.h.

79 { return *this; }

◆ valid_params()

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

Helper function to check that params is valid.

Definition at line 402 of file rb_parametrized.C.

403 {
404  if (params.n_parameters() != get_n_params())
405  libmesh_error_msg("Error: Number of parameters don't match");
406 
407  else
408  {
409  bool valid = true;
410  for (const auto & pr : params)
411  {
412  const std::string & param_name = pr.first;
413  valid = valid && ( (get_parameter_min(param_name) <= params.get_value(param_name)) &&
414  (params.get_value(param_name) <= get_parameter_max(param_name)) );
415 
416  if (is_discrete_parameter(param_name))
417  {
418  // make sure params.get_value(param_name) is sufficiently close
419  // to one of the discrete parameter values
420  valid = valid && is_value_in_list(params.get_value(param_name),
421  get_discrete_parameter_values().find(param_name)->second,
422  TOLERANCE);
423  }
424  }
425 
426  if (!valid && verbose_mode)
427  libMesh::out << "Warning: parameter is outside parameter range" << std::endl;
428 
429  return valid;
430  }
431 }

References libMesh::RBParametrized::get_discrete_parameter_values(), libMesh::RBParametrized::get_n_params(), libMesh::RBParametrized::get_parameter_max(), libMesh::RBParametrized::get_parameter_min(), libMesh::RBParametrized::is_discrete_parameter(), libMesh::RBParametrized::is_value_in_list(), libMesh::RBParameters::n_parameters(), libMesh::out, libMesh::TOLERANCE, libMesh::Quality::valid(), and libMesh::RBParametrized::verbose_mode.

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

◆ 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 255 of file rb_parametrized.C.

257 {
258  // write out the discrete parameters, if we have any
259  if (get_n_discrete_params() > 0)
260  {
261  // The writing mode: ENCODE for binary, WRITE for ASCII
262  XdrMODE mode = write_binary_data ? ENCODE : WRITE;
263 
264  Xdr discrete_parameters_out(file_name, mode);
265  unsigned int n_discrete_params = get_n_discrete_params();
266  discrete_parameters_out << n_discrete_params;
267 
268  for (const auto & pr : get_discrete_parameter_values())
269  {
270  std::string param_name = pr.first;
271  unsigned int n_discrete_values = cast_int<unsigned int>
272  (pr.second.size());
273  discrete_parameters_out << param_name << n_discrete_values;
274 
275  for (unsigned int i=0; i<n_discrete_values; i++)
276  {
277  Real discrete_value = pr.second[i];
278  discrete_parameters_out << discrete_value;
279  }
280  }
281  }
282 }

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 214 of file rb_parametrized.C.

217 {
218  write_parameter_ranges_to_file(continuous_param_file_name, write_binary_data);
219  write_discrete_parameter_values_to_file(discrete_param_file_name, write_binary_data);
220 }

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 libMesh::RBSCMEvaluation::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 222 of file rb_parametrized.C.

224 {
225  // The writing mode: ENCODE for binary, WRITE for ASCII
226  XdrMODE mode = write_binary_data ? ENCODE : WRITE;
227 
228  // Write out the parameter ranges
229  Xdr parameter_ranges_out(file_name, mode);
230  unsigned int n_continuous_params = get_n_continuous_params();
231  parameter_ranges_out << n_continuous_params;
232 
233  for (const auto & pr : get_parameters_min())
234  {
235  std::string param_name = pr.first;
236  if (!is_discrete_parameter(param_name))
237  {
238  Real param_value = pr.second;
239  parameter_ranges_out << param_name << param_value;
240  }
241  }
242 
243  for (const auto & pr : get_parameters_max())
244  {
245  std::string param_name = pr.first;
246  if (!is_discrete_parameter(param_name))
247  {
248  Real param_value = pr.second;
249  parameter_ranges_out << param_name << param_value;
250  }
251  }
252  parameter_ranges_out.close();
253 }

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

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

Member Data Documentation

◆ _counts

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

◆ _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 235 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 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().

◆ _mutex

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

Mutual exclusion object to enable thread-safe reference counting.

Definition at line 135 of file reference_counter.h.

◆ _n_objects

Threads::atomic< unsigned int > libMesh::ReferenceCounter::_n_objects
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().

◆ inner_product_storage_vector

template<class Base>
std::unique_ptr<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 254 of file rb_construction_base.h.

◆ parameters

RBParameters libMesh::RBParametrized::parameters
privateinherited

◆ parameters_initialized

bool libMesh::RBParametrized::parameters_initialized
privateinherited

◆ parameters_max

RBParameters libMesh::RBParametrized::parameters_max
privateinherited

◆ parameters_min

RBParameters libMesh::RBParametrized::parameters_min
privateinherited

◆ quiet_mode

template<class Base>
bool libMesh::RBConstructionBase< Base >::quiet_mode
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().

◆ serial_training_set

template<class Base>
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 247 of file rb_construction_base.h.

◆ training_parameters

template<class Base>
std::map<std::string, std::unique_ptr<NumericVector<Number> > > libMesh::RBConstructionBase< Base >::training_parameters
private

The training samples.

Definition at line 268 of file rb_construction_base.h.

◆ training_parameters_initialized

template<class Base>
bool libMesh::RBConstructionBase< Base >::training_parameters_initialized
private

Boolean flag to indicate whether or not the parameter ranges have been initialized.

Definition at line 263 of file rb_construction_base.h.

◆ training_parameters_random_seed

template<class Base>
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 276 of file rb_construction_base.h.

◆ verbose_mode

bool libMesh::RBParametrized::verbose_mode
inherited

Public boolean to toggle verbose mode.

Definition at line 170 of file rb_parametrized.h.

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


The documentation for this class was generated from the following files:
libMesh::RBParametrized::get_parameters_min
const RBParameters & get_parameters_min() const
Get an RBParameters object that specifies the minimum allowable value for each parameter.
Definition: rb_parametrized.C:174
libMesh::RBConstructionBase::generate_training_parameters_random
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 helper function for generating a randomized set of parameters.
Definition: rb_construction_base.C:300
libMesh::RBConstructionBase::clear
virtual void clear()
Clear all the data structures associated with the system.
Definition: rb_construction_base.C:65
libMesh::RBParametrized::_discrete_parameter_values
std::map< std::string, std::vector< Real > > _discrete_parameter_values
Map that defines the allowable values of any discrete parameters.
Definition: rb_parametrized.h:235
libMesh::RBParameters::print
void print() const
Print the parameters.
Definition: rb_parameters.C:134
libMesh::RBConstructionBase::get_first_local_training_index
numeric_index_type get_first_local_training_index() const
Get the first local index of the training parameters.
Definition: rb_construction_base.C:116
libMesh::RBConstructionBase::inner_product_storage_vector
std::unique_ptr< NumericVector< Number > > inner_product_storage_vector
We keep an extra temporary vector that is useful for performing inner products (avoids unnecessary me...
Definition: rb_construction_base.h:254
libMesh::PARALLEL
Definition: enum_parallel_type.h:36
libMesh::RBConstructionBase::training_parameters
std::map< std::string, std::unique_ptr< NumericVector< Number > > > training_parameters
The training samples.
Definition: rb_construction_base.h:268
libMesh::RBParametrized::get_closest_value
static Real get_closest_value(Real value, const std::vector< Real > &list_of_values)
Definition: rb_parametrized.C:433
libMesh::RBParametrized::read_discrete_parameter_values_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.
Definition: rb_parametrized.C:340
libMesh::libmesh_real
T libmesh_real(T a)
Definition: libmesh_common.h:166
libMesh::RBConstructionBase::training_parameters_initialized
bool training_parameters_initialized
Boolean flag to indicate whether or not the parameter ranges have been initialized.
Definition: rb_construction_base.h:263
libMesh::SERIAL
Definition: enum_parallel_type.h:35
libMesh::RBParametrized::get_n_params
unsigned int get_n_params() const
Get the number of parameters.
Definition: rb_parametrized.C:115
libMesh::RBParametrized::verbose_mode
bool verbose_mode
Public boolean to toggle verbose mode.
Definition: rb_parametrized.h:170
libMesh::RBParametrized::clear
virtual void clear()
Clear all the data structures associated with the system.
Definition: rb_parametrized.C:52
libMesh::ReferenceCounter::_counts
static Counts _counts
Actually holds the data.
Definition: reference_counter.h:122
std::sqrt
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::ReferenceCounter::_n_objects
static Threads::atomic< unsigned int > _n_objects
The number of objects.
Definition: reference_counter.h:130
libMesh::WRITE
Definition: enum_xdr_mode.h:40
libMesh::RBParametrized::set_parameters
void set_parameters(const RBParameters &params)
Set the current parameters to params.
Definition: rb_parametrized.C:155
libMesh::RBParametrized::get_n_discrete_params
unsigned int get_n_discrete_params() const
Get the number of discrete parameters.
Definition: rb_parametrized.C:135
libMesh::ReferenceCounter::get_info
static std::string get_info()
Gets a string containing the reference information.
Definition: reference_counter.C:47
libMesh::RBParametrized::parameters_max
RBParameters parameters_max
Definition: rb_parametrized.h:230
libMesh::RBParameters::n_parameters
unsigned int n_parameters() const
Get the number of parameters that have been added.
Definition: rb_parameters.C:63
libMesh::RBParametrized::get_n_continuous_params
unsigned int get_n_continuous_params() const
Get the number of continuous parameters.
Definition: rb_parametrized.C:125
libMesh::RBParametrized::get_parameters_max
const RBParameters & get_parameters_max() const
Get an RBParameters object that specifies the maximum allowable value for each parameter.
Definition: rb_parametrized.C:182
libMesh::NumericVector::build
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
Definition: numeric_vector.C:49
libMesh::RBParametrized::get_parameters
const RBParameters & get_parameters() const
Get the current parameters.
Definition: rb_parametrized.C:166
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::RBParametrized::get_parameter_max
Real get_parameter_max(const std::string &param_name) const
Get maximum allowable value of parameter param_name.
Definition: rb_parametrized.C:198
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::RBConstructionBase::broadcast_parameters
void broadcast_parameters(unsigned int proc_id)
Broadcasts parameters on processor proc_id to all processors.
Definition: rb_construction_base.C:600
libMesh::XdrMODE
XdrMODE
Defines an enum for read/write mode in Xdr format.
Definition: enum_xdr_mode.h:35
libMesh::DECODE
Definition: enum_xdr_mode.h:39
libMesh::RBConstructionBase::get_params_from_training_set
RBParameters get_params_from_training_set(unsigned int index)
Return the RBParameters in index index of training set.
Definition: rb_construction_base.C:136
libMesh::RBConstructionBase::set_params_from_training_set
void set_params_from_training_set(unsigned int index)
Set parameters to the RBParameters stored in index index of the training set.
Definition: rb_construction_base.C:130
libMesh::Threads::spin_mtx
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
Definition: threads.C:29
libMesh::processor_id_type
uint8_t processor_id_type
Definition: id_types.h:104
libMesh::RBParameters::set_value
void set_value(const std::string &param_name, Real value)
Set the value of the specified parameter.
Definition: rb_parameters.C:47
std::pow
double pow(double a, int b)
Definition: libmesh_augment_std_namespace.h:58
libMesh::RBParametrized::parameters_min
RBParameters parameters_min
Vectors that define the ranges (min and max) for the parameters.
Definition: rb_parametrized.h:229
libMesh::as_range
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
Helper function that allows us to treat a homogenous pair as a range.
Definition: simple_range.h:57
libMesh::RBConstructionBase::is_quiet
bool is_quiet() const
Is the system in quiet mode?
Definition: rb_construction_base.h:98
libMesh::RBConstructionBase::generate_training_parameters_deterministic
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)
Static helper function for generating a deterministic set of parameters.
Definition: rb_construction_base.C:412
libMesh::READ
Definition: enum_xdr_mode.h:41
libMesh::RBParametrized::write_discrete_parameter_values_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.
Definition: rb_parametrized.C:255
libMesh::numeric_index_type
dof_id_type numeric_index_type
Definition: id_types.h:99
libMesh::RBParameters::get_parameter_names
void get_parameter_names(std::set< std::string > &param_names) const
Fill param_names with the names of the parameters.
Definition: rb_parameters.C:69
libMesh::Quality::valid
std::vector< ElemQuality > valid(const ElemType t)
Returns all valid quality metrics for element type t.
Definition: elem_quality.C:324
libMesh::ENCODE
Definition: enum_xdr_mode.h:38
distance
Real distance(const Point &p)
Definition: subdomains_ex3.C:50
libMesh::RBParametrized::initialize_parameters
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.
Definition: rb_parametrized.C:60
libMesh::RBConstructionBase::get_last_local_training_index
numeric_index_type get_last_local_training_index() const
Get the last local index of the training parameters.
Definition: rb_construction_base.C:123
libMesh::RBParametrized::read_parameter_ranges_from_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.
Definition: rb_parametrized.C:303
libMesh::RBParametrized::parameters
RBParameters parameters
Vector storing the current parameters.
Definition: rb_parametrized.h:224
libMesh::RBParametrized::valid_params
bool valid_params(const RBParameters &params)
Helper function to check that params is valid.
Definition: rb_parametrized.C:402
value
static const bool value
Definition: xdr_io.C:56
libMesh::RBConstructionBase::serial_training_set
bool serial_training_set
This boolean flag indicates whether or not the training set should be the same on all processors.
Definition: rb_construction_base.h:247
libMesh::RBParametrized::get_discrete_parameter_values
const std::map< std::string, std::vector< Real > > & get_discrete_parameter_values() const
Get a const reference to the discrete parameter values.
Definition: rb_parametrized.C:381
libMesh::RBConstructionBase::training_parameters_random_seed
int training_parameters_random_seed
If < 0, use std::time() * processor_id() to seed the random number generator for the training paramet...
Definition: rb_construction_base.h:276
libMesh::RBConstructionBase::quiet_mode
bool quiet_mode
Flag to indicate whether we print out extra information during the Offline stage.
Definition: rb_construction_base.h:239
libMesh::RBParametrized::parameters_initialized
bool parameters_initialized
Flag indicating whether the parameters have been initialized.
Definition: rb_parametrized.h:219
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBParametrized::is_value_in_list
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...
Definition: rb_parametrized.C:453
libMesh::ReferenceCounter::_enable_print_counter
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.
Definition: reference_counter.h:141
libMesh::out
OStreamProxy out
libMesh::RBParametrized::write_parameter_ranges_to_file
void write_parameter_ranges_to_file(const std::string &file_name, const bool write_binary)
Write out the parameter ranges to file.
Definition: rb_parametrized.C:222
libMesh::RBParametrized::is_discrete_parameter
bool is_discrete_parameter(const std::string &mu_name) const
Is parameter mu_name discrete?
Definition: rb_parametrized.C:373
libMesh::Quality::name
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
Definition: elem_quality.C:42
libMesh::RBParameters::get_value
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:41
libMesh::RBParametrized::get_parameter_min
Real get_parameter_min(const std::string &param_name) const
Get minimum allowable value of parameter param_name.
Definition: rb_parametrized.C:190