libMesh
Public Types | Public Member Functions | Private Attributes | List of all members
libMesh::RBParameters Class Reference

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

#include <rb_parameters.h>

Public Types

typedef std::map< std::string, Real >::const_iterator const_iterator
 

Public Member Functions

 RBParameters ()
 Constructor. More...
 
 RBParameters (const std::map< std::string, Real > &parameter_map)
 Constructor. More...
 
void clear ()
 Clear this object. More...
 
Real get_value (const std::string &param_name) const
 Get the value of the specific parameter. More...
 
void set_value (const std::string &param_name, Real value)
 Set the value of the specified parameter. More...
 
unsigned int n_parameters () const
 Get the number of parameters that have been added. More...
 
void get_parameter_names (std::set< std::string > &param_names) const
 Fill param_names with the names of the parameters. More...
 
const_iterator begin () const
 Get a constant iterator to beginning of this RBParameters object. More...
 
const_iterator end () const
 Get a constant iterator to the end of this RBParameters object. More...
 
bool operator== (const RBParameters &rhs) const
 Two RBParameters are equal if they have the same _parameters map. More...
 
bool operator!= (const RBParameters &node) const
 
std::string get_string (unsigned int precision=6) const
 Get a string that specifies the contents of this RBParameters object. More...
 
void print () const
 Print the parameters. More...
 

Private Attributes

std::map< std::string, Real_parameters
 The map that stores the actual parameters, indexed by names. More...
 

Detailed Description

This class is part of the rbOOmit framework.

This class defines a set of parameters index by strings.

Author
David J. Knezevic
Date
2012

Definition at line 42 of file rb_parameters.h.

Member Typedef Documentation

Definition at line 57 of file rb_parameters.h.

Constructor & Destructor Documentation

libMesh::RBParameters::RBParameters ( )

Constructor.

Definition at line 31 of file rb_parameters.C.

32 {
33 }
libMesh::RBParameters::RBParameters ( const std::map< std::string, Real > &  parameter_map)

Constructor.

Set parameters based on the std::map parameter_map.

Definition at line 35 of file rb_parameters.C.

References _parameters.

36 {
37  _parameters = parameter_map;
38 }
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.

Member Function Documentation

RBParameters::const_iterator libMesh::RBParameters::begin ( ) const
void libMesh::RBParameters::clear ( )

Clear this object.

Definition at line 40 of file rb_parameters.C.

References _parameters.

Referenced by libMesh::RBParametrized::clear(), and libMesh::RBParametrized::RBParametrized().

41 {
42  _parameters.clear();
43 }
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
RBParameters::const_iterator libMesh::RBParameters::end ( ) const
void libMesh::RBParameters::get_parameter_names ( std::set< std::string > &  param_names) const

Fill param_names with the names of the parameters.

Definition at line 68 of file rb_parameters.C.

References _parameters.

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

69 {
70  param_names.clear();
71 
72  const_iterator it = _parameters.begin();
73  const_iterator it_end = _parameters.end();
74  for ( ; it != it_end; ++it)
75  {
76  param_names.insert( it->first );
77  }
78 }
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
std::string libMesh::RBParameters::get_string ( unsigned int  precision = 6) const

Get a string that specifies the contents of this RBParameters object.

precision specifies the number of digits of precision we use in scientific notation in the string.

Definition at line 100 of file rb_parameters.C.

References _parameters.

Referenced by print().

101 {
102  std::stringstream param_stringstream;
103  param_stringstream.precision(precision);
104 
105  const_iterator it = _parameters.begin();
106  const_iterator it_end = _parameters.end();
107  for ( ; it != it_end; ++it)
108  {
109  param_stringstream << it->first << ": " << std::scientific << it->second << std::endl;
110  }
111  return param_stringstream.str();
112 }
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
Real libMesh::RBParameters::get_value ( const std::string &  param_name) const

Get the value of the specific parameter.

Definition at line 45 of file rb_parameters.C.

References _parameters.

Referenced by libMesh::RBDataSerialization::add_parameter_ranges_to_builder(), libMesh::RBSCMConstruction::enrich_C_J(), ThetaA1::evaluate(), ThetaA2::evaluate(), ShiftedGaussian::evaluate(), Gx::evaluate(), libMesh::RBEIMTheta::evaluate(), Gy::evaluate(), ThetaA3::evaluate(), Gz::evaluate(), ThetaA0::evaluate(), ThetaF0::evaluate(), ThetaF1::evaluate(), ThetaF2::evaluate(), ThetaPointLoadX::evaluate(), ThetaPointLoadY::evaluate(), ThetaPointLoadZ::evaluate(), ThetaEIM::evaluate(), libMesh::RBConstructionBase< Base >::generate_training_parameters_deterministic(), libMesh::RBConstructionBase< Base >::generate_training_parameters_random(), libMesh::RBParametrized::get_parameter_max(), libMesh::RBParametrized::get_parameter_min(), libMesh::RBParametrized::initialize_parameters(), scale_mesh_and_plot(), and libMesh::RBParametrized::valid_params().

46 {
47  // find the parameter value
48  const_iterator it = _parameters.find(param_name);
49 
50  // throw and error if the parameter doesn't exist
51  if (it == _parameters.end())
52  libmesh_error_msg("Error: parameter " << param_name << " does not exist in RBParameters object.");
53 
54  return it->second;
55 }
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:57
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
unsigned int libMesh::RBParameters::n_parameters ( ) const

Get the number of parameters that have been added.

Definition at line 62 of file rb_parameters.C.

References _parameters.

Referenced by libMesh::RBEIMTheta::evaluate(), libMesh::RBConstructionBase< Base >::generate_training_parameters_deterministic(), libMesh::RBConstructionBase< Base >::generate_training_parameters_random(), libMesh::RBParametrized::get_n_params(), libMesh::RBParametrized::initialize_parameters(), and libMesh::RBParametrized::valid_params().

63 {
64  return cast_int<unsigned int>
65  (_parameters.size());
66 }
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
bool libMesh::RBParameters::operator!= ( const RBParameters node) const
Returns
!(*this == rhs).

Definition at line 95 of file rb_parameters.C.

96 {
97  return !(*this == rhs);
98 }
bool libMesh::RBParameters::operator== ( const RBParameters rhs) const

Two RBParameters are equal if they have the same _parameters map.

Definition at line 90 of file rb_parameters.C.

References _parameters.

91 {
92  return this->_parameters == rhs._parameters;
93 }
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
void libMesh::RBParameters::print ( ) const

Print the parameters.

Definition at line 114 of file rb_parameters.C.

References get_string(), and libMesh::out.

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

115 {
116  libMesh::out << get_string() << std::endl;
117 }
std::string get_string(unsigned int precision=6) const
Get a string that specifies the contents of this RBParameters object.
OStreamProxy out
void libMesh::RBParameters::set_value ( const std::string &  param_name,
Real  value 
)

Set the value of the specified parameter.

If param_name doesn't already exist, it is added to the RBParameters object.

Definition at line 57 of file rb_parameters.C.

References _parameters, and value.

Referenced by libMesh::RBConstructionBase< Base >::broadcast_parameters(), libMesh::RBEIMTheta::evaluate(), libMesh::RBConstructionBase< Base >::get_params_from_training_set(), libMesh::RBParametrized::initialize_parameters(), libMesh::RBDataDeserialization::load_parameter_ranges(), main(), libMesh::RBSCMConstruction::process_parameters_file(), libMesh::RBConstruction::process_parameters_file(), and libMesh::RBParametrized::read_parameter_ranges_from_file().

58 {
59  _parameters[param_name] = value;
60 }
static const bool value
Definition: xdr_io.C:108
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.

Member Data Documentation

std::map<std::string, Real> libMesh::RBParameters::_parameters
private

The map that stores the actual parameters, indexed by names.

Definition at line 122 of file rb_parameters.h.

Referenced by begin(), clear(), end(), get_parameter_names(), get_string(), get_value(), n_parameters(), operator==(), RBParameters(), and set_value().


The documentation for this class was generated from the following files: