GRINS-0.8.0
parameter_user.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef GRINS_PARAMETER_USER_H
26 #define GRINS_PARAMETER_USER_H
27 
28 // C++
29 #include <string>
30 #include <set>
31 
32 //GRINS
33 #include "grins_config.h"
34 
35 //libMesh
36 #include "libmesh/libmesh.h"
37 #include "libmesh/vector_value.h" // forward declare Gradient instead?
38 
39 //C++
40 #include <map>
41 #include <string>
42 
43 // libMesh forward declarations
44 class GetPot;
45 namespace libMesh
46 {
47  template <typename Scalar>
48  class ParameterMultiAccessor;
49 
50  template <typename Output, typename OutputGradient>
52 
53  template <typename Output>
55 }
56 
58 namespace GRINS
59 {
61 
69  {
70 
71  public:
72 
73  ParameterUser(const std::string & user_name) : _my_name(user_name) {}
74  virtual ~ParameterUser() {}
75 
77  // file and prepare it for registration with this call.
78  virtual void set_parameter
79  ( libMesh::Number & param_variable,
80  const GetPot & input,
81  const std::string & param_name,
82  libMesh::Number param_default );
83 
85  // file and prepare its inline variables for registration with this call.
86  //
87  // Pass a default value of "DIE!" to assert that the input file
88  // contains a value for this parameter.
89  virtual void set_parameter
91  const GetPot & input,
92  const std::string & func_param_name,
93  const std::string & param_default);
94 
96  // file and prepare its inline variables for registration with this call.
97  //
98  // Pass a default value of "DIE!" to assert that the input file
99  // contains a value for this parameter.
100  virtual void set_parameter
102  const GetPot & input,
103  const std::string & func_param_name,
104  const std::string & param_default);
105 
107  //to point to the clone
108  virtual void move_parameter
109  (const libMesh::Number & old_parameter,
110  libMesh::Number & new_parameter);
111 
113  //to point to the clone
114  virtual void move_parameter
117 
119  //to point to the clone
120  virtual void move_parameter
123 
125  static std::string zero_vector_function;
126 
127  // FIXME: add set_parameter overloads for vectors
128 
130  // variable when the library makes this call.
131  // If the subclass needs to register a parameter which was not
132  // previously assigned with set_parameter, then this method will
133  // need to be overridden.
134  virtual void register_parameter
135  ( const std::string & param_name,
137  const;
138 
139  private:
140  std::map<std::string, libMesh::Number*> _my_parameters;
141 
142  std::map<std::string,
145 
146  std::map<std::string,
149 
150  // This could be more efficient as a reference now, but we'd
151  // probably inadvertently break it later.
152  std::string _my_name;
153 
154  }; // End Physics class declarations
155 
156  /* ------------------------- Inline Functions -------------------------*/
157 
158 } // End namespace GRINS
159 
160 #endif //GRINS_PARAMETER_USER_H
virtual void set_parameter(libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
std::map< std::string, libMesh::ParsedFEMFunction< libMesh::Number > * > _my_parsed_fem_functions
static std::string zero_vector_function
A parseable function string with LIBMESH_DIM components, all 0.
ParameterUser(const std::string &user_name)
std::map< std::string, libMesh::ParsedFunction< libMesh::Number, libMesh::Gradient > * > _my_parsed_functions
GRINS namespace.
std::map< std::string, libMesh::Number * > _my_parameters
ParameterUser base class. Utility methods for subclasses.
virtual void move_parameter(const libMesh::Number &old_parameter, libMesh::Number &new_parameter)
When cloning an object, we need to update parameter pointers.
virtual void register_parameter(const std::string &param_name, libMesh::ParameterMultiAccessor< libMesh::Number > &param_pointer) const
Each subclass will register its copy of an independent.

Generated on Tue Dec 19 2017 12:47:28 for GRINS-0.8.0 by  doxygen 1.8.9.1