30 #include "libmesh/getpot.h"
31 #include "libmesh/parameter_multiaccessor.h"
32 #include "libmesh/parameter_pointer.h"
33 #include "libmesh/parsed_fem_function.h"
34 #include "libmesh/parsed_fem_function_parameter.h"
35 #include "libmesh/parsed_function.h"
36 #include "libmesh/parsed_function_parameter.h"
43 #elif LIBMESH_DIM == 2
44 std::string ParameterUser::zero_vector_function = std::string(
"{0}{0}");
46 std::string ParameterUser::zero_vector_function = std::string(
"{0}");
52 const std::string & param_name,
53 libMesh::Number param_default )
55 param_variable = input(param_name, param_default);
58 "ERROR: " <<
_my_name <<
" double-registered parameter " <<
67 const std::string & func_param_name,
68 const std::string & param_default)
70 if((param_default ==
"DIE!") &&
71 (!input.have_variable(func_param_name)))
73 libMesh::err <<
"Error: Must specify parsed function for " <<
75 <<
" Please specify " << func_param_name << std::endl;
79 func.reparse(input(func_param_name, param_default));
81 libmesh_assert_msg(!_my_parsed_functions.count(func_param_name),
82 "ERROR: " << _my_name <<
" double-registered parameter " <<
85 _my_parsed_functions[func_param_name] = &func;
91 const std::string & func_param_name,
92 const std::string & param_default)
94 if((param_default ==
"DIE!") &&
95 (!input.have_variable(func_param_name)))
97 libMesh::err <<
"Error: Must specify parsed (fem) function for " <<
99 <<
" Please specify " << func_param_name << std::endl;
103 func.reparse(input(func_param_name, param_default));
105 libmesh_assert_msg(!_my_parsed_fem_functions.count(func_param_name),
106 "ERROR: " << _my_name <<
" double-registered parameter " <<
109 _my_parsed_fem_functions[func_param_name] = &func;
113 (
const libMesh::Number & old_parameter,
114 libMesh::Number & new_parameter)
116 std::map<std::string, libMesh::Number*>::iterator it =
117 _my_parameters.begin();
118 const std::map<std::string, libMesh::Number*>::iterator end =
119 _my_parameters.end();
120 for (; it != end; ++it)
121 if (it->second == &old_parameter)
123 it->second = &new_parameter;
135 >::iterator it = _my_parsed_functions.begin();
139 >::iterator end = _my_parsed_functions.end();
140 for (; it != end; ++it)
141 if (it->second == &old_func)
143 it->second = &new_func;
155 >::iterator it = _my_parsed_fem_functions.begin();
159 >::iterator end = _my_parsed_fem_functions.end();
160 for (; it != end; ++it)
161 if (it->second == &old_func)
163 it->second = &new_func;
170 (
const std::string & param_name,
174 std::map<std::string, libMesh::Number*>::const_iterator it =
175 _my_parameters.find(param_name);
181 bool found_parameter =
false;
185 if (it != _my_parameters.end())
187 std::cout << _my_name <<
" has Number parameter " << param_name
189 param_pointer.push_back
190 (libMesh::ParameterPointer<libMesh::Number>(it->second));
193 found_parameter =
true;
200 std::size_t last_slash_i = param_name.rfind(
'/');
202 if (last_slash_i != std::string::npos)
204 std::string search_name = param_name.substr(0, last_slash_i);
206 std::string var_name = param_name.substr(last_slash_i+1);
210 <libMesh::Number,libMesh::Gradient>*>::const_iterator
211 pf_it = _my_parsed_functions.find(search_name);
213 if (pf_it != _my_parsed_functions.end())
215 std::cout << _my_name <<
" has ParsedFunction for " <<
216 search_name <<
" / " << var_name << std::endl;
217 param_pointer.push_back
218 (libMesh::ParsedFunctionParameter<libMesh::Number>
219 (*pf_it->second, var_name));
222 libmesh_assert(!found_parameter);
223 found_parameter =
true;
231 <libMesh::Number>*>::const_iterator
232 pff_it = _my_parsed_fem_functions.find(search_name);
234 if (pff_it != _my_parsed_fem_functions.end())
236 std::cout << _my_name <<
" has ParsedFEMFunction for " <<
237 search_name <<
" / " << var_name << std::endl;
238 param_pointer.push_back
239 (libMesh::ParsedFEMFunctionParameter<libMesh::Number>
240 (*pff_it->second, var_name));
243 libmesh_assert(!found_parameter);
virtual void set_parameter(libMesh::Number ¶m_variable, const GetPot &input, const std::string ¶m_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
static std::string zero_vector_function
A parseable function string with LIBMESH_DIM components, all 0.
std::map< std::string, libMesh::Number * > _my_parameters
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 ¶m_name, libMesh::ParameterMultiAccessor< libMesh::Number > ¶m_pointer) const
Each subclass will register its copy of an independent.