libMesh
rb_parameters.h
Go to the documentation of this file.
1 // rbOOmit: An implementation of the Certified Reduced Basis method.
2 // Copyright (C) 2009, 2010 David J. Knezevic
3 
4 // This file is part of rbOOmit.
5 
6 // rbOOmit is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 
11 // rbOOmit is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 #ifndef LIBMESH_RB_PARAMETERS_H
21 #define LIBMESH_RB_PARAMETERS_H
22 
23 // libMesh includes
24 #include "libmesh/libmesh_common.h"
25 
26 // C++ includes
27 #include <string>
28 #include <map>
29 #include <set>
30 
31 namespace libMesh
32 {
33 
43 {
44 public:
45 
50  RBParameters () = default;
51  RBParameters (RBParameters &&) = default;
52  RBParameters (const RBParameters &) = default;
53  RBParameters & operator= (const RBParameters &) = default;
54  RBParameters & operator= (RBParameters &&) = default;
55  ~RBParameters() = default;
56 
60  RBParameters(const std::map<std::string, Real> & parameter_map);
61 
62  // Define a constant iterator for this class
63  typedef std::map<std::string, Real>::const_iterator const_iterator;
64 
68  void clear();
69 
73  Real get_value(const std::string & param_name) const;
74 
79  void set_value(const std::string & param_name, Real value);
80 
84  Real get_extra_value(const std::string & param_name) const;
85 
90  void set_extra_value(const std::string & param_name, Real value);
91 
95  unsigned int n_parameters() const;
96 
100  void get_parameter_names(std::set<std::string> & param_names) const;
101 
105  void get_extra_parameter_names(std::set<std::string> & param_names) const;
106 
110  const_iterator begin() const;
111  const_iterator end() const;
112 
116  const_iterator extra_begin() const;
117  const_iterator extra_end() const;
118 
122  bool operator== (const RBParameters & rhs) const;
123 
127  bool operator!= (const RBParameters & node) const;
128 
134  std::string get_string(unsigned int precision=6) const;
135 
139  void print() const;
140 
141 private:
142 
146  std::map<std::string, Real> _parameters;
147 
151  std::map<std::string, Real> _extra_parameters;
152 
153 };
154 
155 } // namespace libMesh
156 
157 
158 #endif // LIBMESH_RB_PARAMETERS_H
libMesh::RBParameters::set_extra_value
void set_extra_value(const std::string &param_name, Real value)
Set the value of the specified extra parameter.
Definition: rb_parameters.C:58
libMesh::RBParameters::print
void print() const
Print the parameters.
Definition: rb_parameters.C:134
libMesh::RBParameters::operator==
bool operator==(const RBParameters &rhs) const
Two RBParameters are equal if they have the same _parameters map.
Definition: rb_parameters.C:109
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::begin
const_iterator begin() const
Get const_iterator access to the parameters stored in this RBParameters object.
Definition: rb_parameters.C:89
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::RBParameters
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
libMesh::RBParameters::n_parameters
unsigned int n_parameters() const
Get the number of parameters that have been added.
Definition: rb_parameters.C:63
libMesh::RBParameters::get_extra_parameter_names
void get_extra_parameter_names(std::set< std::string > &param_names) const
Fill param_names with the names of the extra parameters.
Definition: rb_parameters.C:81
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::operator=
RBParameters & operator=(const RBParameters &)=default
libMesh::RBParameters::~RBParameters
~RBParameters()=default
libMesh::RBParameters::RBParameters
RBParameters()=default
The special functions can be defaulted for this class, as it does not manage any memory itself.
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
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::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::RBParameters::operator!=
bool operator!=(const RBParameters &node) const
Definition: rb_parameters.C:115
libMesh::RBParameters::get_extra_value
Real get_extra_value(const std::string &param_name) const
Get the value of the specific extra parameter.
Definition: rb_parameters.C:52
libMesh::RBParameters::clear
void clear()
Clear this object.
Definition: rb_parameters.C:35
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBParameters::extra_begin
const_iterator extra_begin() const
Get const_iterator access to the extra parameters stored in this RBParameters object.
Definition: rb_parameters.C:99
libMesh::RBParameters::end
const_iterator end() const
Definition: rb_parameters.C:94
libMesh::RBParameters::_parameters
std::map< std::string, Real > _parameters
The map that stores the actual parameters, indexed by names.
Definition: rb_parameters.h:146
libMesh::RBParameters::extra_end
const_iterator extra_end() const
Definition: rb_parameters.C:104
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