deal2lkit: A ToolKit library for Deal.II
parameter_acceptor.cc File Reference
#include <deal2lkit/parameter_acceptor.h>
#include <deal2lkit/utilities.h>
#include <deal.II/base/point.h>
#include <deal.II/base/revision.h>
#include <deal2lkit/revision.h>
#include <fstream>

Go to the source code of this file.

Macros

#define MYP(dim)
 point More...
 
#define MYV(type, sep)
 vector More...
 

Functions

template<>
std_cxx11::shared_ptr< Patterns::PatternBaseParameterAcceptor::to_pattern< std::string > (const std::string &)
 Conversion specializations. More...
 
template<>
std::string ParameterAcceptor::to_string< std::string > (const std::string &entry)
 
template<>
std::string ParameterAcceptor::to_type< std::string > (const std::string &parameter)
 

Macro Definition Documentation

§ MYP

#define MYP (   dim)
Value:
template<>\
std_cxx11::shared_ptr<Patterns::PatternBase> ParameterAcceptor::to_pattern<Point<dim> >(const Point<dim> &) {\
return SP(new Patterns::List(Patterns::Double(),dim,dim));\
}\
\
template<>\
std::string ParameterAcceptor::to_string<Point<dim> >(const Point<dim> &entry) {\
return print(entry);\
}\
\
template<>\
Point<dim> ParameterAcceptor::to_type<Point<dim> >(const std::string &parameter) {\
Point<dim> p;\
auto ps = Utilities::split_string_list(parameter);\
AssertDimension(ps.size(), dim);\
for(unsigned int i=0; i<dim; ++i)\
p[i] = std::stod(ps[i]);\
return p;\
}
shared_ptr< T > SP(T *t)
Construct a shared pointer to a non const class T.
Definition: utilities.h:483
std::string print(const std::vector< Type > &list, const std::string sep=",")
Return a string containing the content of the vector, with elements separated by the @ sep parameter...
Definition: utilities.h:425
std::vector< std::string > split_string_list(const std::string &s, const char delimiter=',')

point

Definition at line 306 of file parameter_acceptor.cc.

§ MYV

#define MYV (   type,
  sep 
)
Value:
template<>\
std_cxx11::shared_ptr<Patterns::PatternBase> ParameterAcceptor::to_pattern<std::vector<type> >(const std::vector<type> &) {\
type p;\
return SP(new Patterns::List(*to_pattern(p),0,Patterns::List::max_int_value,sep));\
}\
\
template<>\
std::string ParameterAcceptor::to_string<std::vector<type> >(const std::vector<type> &entry) {\
std::ostringstream s; \
if(entry.size() > 0) \
s << to_string(entry[0]); \
for(unsigned int i=1; i<entry.size(); ++i) \
s << std::string(sep) << " " << to_string(entry[i]); \
return s.str();\
}\
\
template<>\
std::vector<type> ParameterAcceptor::to_type<std::vector<type> >(const std::string &parameter) {\
auto ps = Utilities::split_string_list(parameter,sep[0]);\
std::vector<type> p(ps.size());\
for(unsigned int i=0; i<ps.size(); ++i)\
p[i] = to_type<type>(ps[i]);\
return p;\
}
shared_ptr< T > SP(T *t)
Construct a shared pointer to a non const class T.
Definition: utilities.h:483
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
std::vector< std::string > split_string_list(const std::string &s, const char delimiter=',')
static const unsigned int max_int_value

vector

Definition at line 334 of file parameter_acceptor.cc.

Function Documentation

§ ParameterAcceptor::to_pattern< std::string >()

template<>
std_cxx11::shared_ptr<Patterns::PatternBase> ParameterAcceptor::to_pattern< std::string > ( const std::string &  )

Conversion specializations.

string

Definition at line 208 of file parameter_acceptor.cc.

§ ParameterAcceptor::to_string< std::string >()

template<>
std::string ParameterAcceptor::to_string< std::string > ( const std::string &  entry)

Definition at line 214 of file parameter_acceptor.cc.

§ ParameterAcceptor::to_type< std::string >()

template<>
std::string ParameterAcceptor::to_type< std::string > ( const std::string &  parameter)

Definition at line 220 of file parameter_acceptor.cc.