20 #ifndef LIBMESH_PARAMETERS_H 21 #define LIBMESH_PARAMETERS_H 49 void print_helper(std::ostream & os,
const std::vector<P> * param);
52 void print_helper(std::ostream & os,
const std::vector<std::vector<P>> * param);
102 template <
typename T>
109 template <
typename T>
110 const T &
get (
const std::string &)
const;
117 template <
typename T>
118 void insert (
const std::string &);
126 template <
typename T>
127 T &
set (
const std::string &);
138 void remove (
const std::string &);
145 #ifdef LIBMESH_HAVE_RTTI 149 template <
typename T>
151 #endif // LIBMESH_HAVE_RTTI 156 virtual void clear ();
175 #ifdef LIBMESH_HAVE_RTTI 180 virtual std::string
type ()
const = 0;
181 #endif // LIBMESH_HAVE_RTTI 187 virtual void print(std::ostream &)
const = 0;
200 template <
typename T>
208 const T &
get ()
const {
return _value; }
215 #ifdef LIBMESH_HAVE_RTTI 219 virtual std::string
type ()
const;
220 #endif // LIBMESH_HAVE_RTTI 225 virtual void print(std::ostream &)
const;
242 typedef std::map<std::string, Value *>::iterator
iterator;
283 #ifdef LIBMESH_HAVE_RTTI 284 template <
typename T>
292 template <
typename T>
300 template <
typename T>
306 libmesh_assert(copy);
324 it->second =
nullptr;
344 for (
const auto & pr : source.
_values)
348 _values[pr.first] = pr.second->clone();
375 os <<
"Name\t Type\t Value\n" 376 <<
"---------------------\n";
379 os <<
" " << it->first
380 #ifdef LIBMESH_HAVE_RTTI 381 <<
"\t " << it->second->type()
382 #endif // LIBMESH_HAVE_RTTI 383 <<
"\t "; it->second->print(os);
404 template <
typename T>
411 #ifdef LIBMESH_HAVE_RTTI
412 if (
dynamic_cast<const Parameter<T> *
>(it->second) !=
nullptr)
423 template <
typename T>
427 if (!this->have_parameter<T>(
name))
429 std::ostringstream oss;
432 #ifdef LIBMESH_HAVE_RTTI 435 oss <<
" parameter named \"" 436 <<
name <<
"\" found.\n\n" 437 <<
"Known parameters:\n" 440 libmesh_error_msg(oss.str());
445 libmesh_assert(it !=
_values.end());
446 libmesh_assert(it->second);
448 return cast_ptr<Parameter<T> *>(it->second)->
get();
451 template <
typename T>
455 if (!this->have_parameter<T>(
name))
462 template <
typename T>
466 if (!this->have_parameter<T>(
name))
471 return cast_ptr<Parameter<T> *>(
_values[
name])->
set();
482 it->second =
nullptr;
490 #ifdef LIBMESH_HAVE_RTTI 491 template <
typename T>
495 unsigned int cnt = 0;
500 for (; it != vals_end; ++it)
501 if (
dynamic_cast<Parameter<T> *
>(it->second) !=
nullptr)
544 os << static_cast<int>(*param);
552 os << static_cast<int>(*param);
559 for (std::size_t i=0; i<param->size(); ++i)
560 os << (*param)[i] <<
" ";
565 void print_helper(std::ostream & os,
const std::vector<std::vector<P>> * param)
567 for (std::size_t i=0; i<param->size(); ++i)
568 for (std::size_t j=0; j<(*param)[i].size(); ++j)
569 os << (*param)[i][j] <<
" ";
574 #endif // LIBMESH_PARAMETERS_H std::string name(const ElemQuality q)
std::map< std::string, Value * >::const_iterator const_iterator
virtual void print(std::ostream &) const =0
virtual std::string type() const =0
void print_helper(std::ostream &os, const P *param)
std::map< std::string, Value * >::iterator iterator
Tnew cast_ptr(Told *oldvar)
void print(std::ostream &os=libMesh::out) const
virtual Parameters & operator+=(const Parameters &source)
virtual Parameters & operator=(const Parameters &source)
void remove(const std::string &)
std::string demangle(const char *name)
virtual Value * clone() const
std::map< std::string, Value * > _values
T & set(const std::string &)
const T & get(const std::string &) const
void insert(const std::string &)
virtual Value * clone() const =0
std::size_t n_parameters() const
virtual void print(std::ostream &) const
bool have_parameter(const std::string &) const
OStreamProxy out(std::cout)
virtual std::string type() const
std::ostream & operator<<(std::ostream &os, const FEAbstract &fe)
virtual void set_attributes(const std::string &, bool)