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 ()=default
 The special functions can be defaulted for this class, as it does not manage any memory itself. More...
 
 RBParameters (RBParameters &&)=default
 
 RBParameters (const RBParameters &)=default
 
RBParametersoperator= (const RBParameters &)=default
 
RBParametersoperator= (RBParameters &&)=default
 
 ~RBParameters ()=default
 
 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...
 
Real get_extra_value (const std::string &param_name) const
 Get the value of the specific extra parameter. More...
 
void set_extra_value (const std::string &param_name, Real value)
 Set the value of the specified extra 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...
 
void get_extra_parameter_names (std::set< std::string > &param_names) const
 Fill param_names with the names of the extra parameters. More...
 
const_iterator begin () const
 Get const_iterator access to the parameters stored in this RBParameters object. More...
 
const_iterator end () const
 
const_iterator extra_begin () const
 Get const_iterator access to the extra parameters stored in this RBParameters object. More...
 
const_iterator extra_end () const
 
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...
 
std::map< std::string, Real_extra_parameters
 The map that stores extra parameters not used for RB training, 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

◆ const_iterator

Definition at line 63 of file rb_parameters.h.

Constructor & Destructor Documentation

◆ RBParameters() [1/4]

libMesh::RBParameters::RBParameters ( )
default

The special functions can be defaulted for this class, as it does not manage any memory itself.

◆ RBParameters() [2/4]

libMesh::RBParameters::RBParameters ( RBParameters &&  )
default

◆ RBParameters() [3/4]

libMesh::RBParameters::RBParameters ( const RBParameters )
default

◆ ~RBParameters()

libMesh::RBParameters::~RBParameters ( )
default

◆ RBParameters() [4/4]

libMesh::RBParameters::RBParameters ( const std::map< std::string, Real > &  parameter_map)

Constructor.

Set parameters based on the std::map parameter_map.

Definition at line 30 of file rb_parameters.C.

31 {
32  _parameters = parameter_map;
33 }

References _parameters.

Member Function Documentation

◆ begin()

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

Get const_iterator access to the parameters stored in this RBParameters object.

Definition at line 89 of file rb_parameters.C.

90 {
91  return _parameters.begin();
92 }

References _parameters.

Referenced by libMesh::RBConstructionBase< CondensedEigenSystem >::generate_training_parameters_deterministic().

◆ clear()

void libMesh::RBParameters::clear ( )

Clear this object.

Definition at line 35 of file rb_parameters.C.

36 {
37  _parameters.clear();
38  _extra_parameters.clear();
39 }

References _extra_parameters, and _parameters.

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

◆ end()

RBParameters::const_iterator libMesh::RBParameters::end ( ) const

Definition at line 94 of file rb_parameters.C.

95 {
96  return _parameters.end();
97 }

References _parameters.

◆ extra_begin()

RBParameters::const_iterator libMesh::RBParameters::extra_begin ( ) const

Get const_iterator access to the extra parameters stored in this RBParameters object.

Definition at line 99 of file rb_parameters.C.

100 {
101  return _extra_parameters.begin();
102 }

References _extra_parameters.

◆ extra_end()

RBParameters::const_iterator libMesh::RBParameters::extra_end ( ) const

Definition at line 104 of file rb_parameters.C.

105 {
106  return _extra_parameters.end();
107 }

References _extra_parameters.

◆ get_extra_parameter_names()

void libMesh::RBParameters::get_extra_parameter_names ( std::set< std::string > &  param_names) const

Fill param_names with the names of the extra parameters.

Definition at line 81 of file rb_parameters.C.

82 {
83  param_names.clear();
84 
85  for (const auto & pr : _extra_parameters)
86  param_names.insert(pr.first);
87 }

References _extra_parameters.

◆ get_extra_value()

Real libMesh::RBParameters::get_extra_value ( const std::string &  param_name) const

Get the value of the specific extra parameter.

Definition at line 52 of file rb_parameters.C.

53 {
54  // find the parameter value, throwing an error if it doesn't exist.
55  return libmesh_map_find(_extra_parameters, param_name);
56 }

References _extra_parameters.

◆ get_parameter_names()

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 69 of file rb_parameters.C.

70 {
71  param_names.clear();
72 
73  const_iterator it = _parameters.begin();
74  const_iterator it_end = _parameters.end();
75  for ( ; it != it_end; ++it)
76  {
77  param_names.insert( it->first );
78  }
79 }

References _parameters.

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

◆ get_string()

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 120 of file rb_parameters.C.

121 {
122  std::stringstream param_stringstream;
123  param_stringstream.precision(precision);
124 
125  const_iterator it = _parameters.begin();
126  const_iterator it_end = _parameters.end();
127  for ( ; it != it_end; ++it)
128  {
129  param_stringstream << it->first << ": " << std::scientific << it->second << std::endl;
130  }
131  return param_stringstream.str();
132 }

References _parameters.

Referenced by print().

◆ get_value()

Real libMesh::RBParameters::get_value ( const std::string &  param_name) const

◆ n_parameters()

unsigned int libMesh::RBParameters::n_parameters ( ) const

◆ operator!=()

bool libMesh::RBParameters::operator!= ( const RBParameters node) const
Returns
!(*this == rhs).

Definition at line 115 of file rb_parameters.C.

116 {
117  return !(*this == rhs);
118 }

◆ operator=() [1/2]

RBParameters& libMesh::RBParameters::operator= ( const RBParameters )
default

◆ operator=() [2/2]

RBParameters& libMesh::RBParameters::operator= ( RBParameters &&  )
default

◆ operator==()

bool libMesh::RBParameters::operator== ( const RBParameters rhs) const

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

Definition at line 109 of file rb_parameters.C.

110 {
111  return (this->_parameters == rhs._parameters &&
112  this->_extra_parameters == rhs._extra_parameters);
113 }

References _extra_parameters, and _parameters.

◆ print()

void libMesh::RBParameters::print ( ) const

Print the parameters.

Definition at line 134 of file rb_parameters.C.

135 {
136  libMesh::out << get_string() << std::endl;
137 }

References get_string(), and libMesh::out.

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

◆ set_extra_value()

void libMesh::RBParameters::set_extra_value ( const std::string &  param_name,
Real  value 
)

Set the value of the specified extra parameter.

If param_name doesn't already exist, it is added to the extra parameters.

Definition at line 58 of file rb_parameters.C.

59 {
60  _extra_parameters[param_name] = value;
61 }

References _extra_parameters, and value.

Referenced by libMesh::RBConstructionBase< CondensedEigenSystem >::get_params_from_training_set().

◆ set_value()

void libMesh::RBParameters::set_value ( const std::string &  param_name,
Real  value 
)

Member Data Documentation

◆ _extra_parameters

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

The map that stores extra parameters not used for RB training, indexed by names.

Definition at line 151 of file rb_parameters.h.

Referenced by clear(), extra_begin(), extra_end(), get_extra_parameter_names(), get_extra_value(), operator==(), and set_extra_value().

◆ _parameters

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

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

Definition at line 146 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:
libMesh::RBParameters::_extra_parameters
std::map< std::string, Real > _extra_parameters
The map that stores extra parameters not used for RB training, indexed by names.
Definition: rb_parameters.h:151
libMesh::RBParameters::get_string
std::string get_string(unsigned int precision=6) const
Get a string that specifies the contents of this RBParameters object.
Definition: rb_parameters.C:120
libMesh::RBParameters::const_iterator
std::map< std::string, Real >::const_iterator const_iterator
Definition: rb_parameters.h:63
value
static const bool value
Definition: xdr_io.C:56
libMesh::out
OStreamProxy out
libMesh::RBParameters::_parameters
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
Definition: rb_parameters.h:146