17 #ifndef __deal2__parameter_handler_h
18 #define __deal2__parameter_handler_h
21 #include <deal.II/base/config.h>
23 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/base/std_cxx1x/shared_ptr.h>
26 #include <boost/property_tree/ptree_fwd.hpp>
27 #include <boost/serialization/split_member.hpp>
34 DEAL_II_NAMESPACE_OPEN
78 virtual bool match (
const std::string &test_string)
const = 0;
168 virtual bool match (
const std::string &test_string)
const;
262 virtual bool match (
const std::string &test_string)
const;
327 virtual bool match (
const std::string &test_string)
const;
411 virtual bool match (
const std::string &test_string)
const;
447 <<
"The values " << arg1 <<
" and " << arg2
448 <<
" do not form a valid range.");
524 virtual bool match (
const std::string &test_string)
const;
560 <<
"The values " << arg1 <<
" and " << arg2
561 <<
" do not form a valid range.");
617 virtual bool match (
const std::string &test_string)
const;
654 <<
"A comma was found at position " << arg1
655 <<
" of your input string, but commas are not allowed here.");
700 static Bool *
create (
const std::string &description);
725 virtual bool match (
const std::string &test_string)
const;
790 virtual bool match (
const std::string &test_string)
const;
849 virtual bool match (
const std::string &test_string)
const;
1598 virtual bool read_input (std::istream &input,
1599 const std::string &filename =
"input file");
1612 virtual bool read_input (
const std::string &filename,
1613 const bool optional =
false,
1614 const bool write_stripped_file =
false);
1661 const std::string &default_value,
1663 const std::string &documentation = std::string());
1682 std::string
get (
const std::string &entry_string)
const;
1689 long int get_integer (
const std::string &entry_string)
const;
1694 double get_double (
const std::string &entry_name)
const;
1701 bool get_bool (
const std::string &entry_name)
const;
1712 void set (
const std::string &entry_name,
1713 const std::string &new_value);
1725 void set (
const std::string &entry_name,
1726 const char *new_value);
1737 void set (
const std::string &entry_name,
1738 const long int &new_value);
1754 void set (
const std::string &entry_name,
1755 const double &new_value);
1766 void set (
const std::string &entry_name,
1767 const bool &new_value);
1825 const unsigned int indent_level);
1855 template <
class Archive>
1856 void save (Archive &ar,
const unsigned int version)
const;
1862 template <
class Archive>
1863 void load (Archive &ar,
const unsigned int version);
1865 BOOST_SERIALIZATION_SPLIT_MEMBER()
1880 << "The following entry already exists: " << arg1);
1885 std::
string, std::
string,
1886 << "The
string <" << arg1
1887 << "> does not match the given pattern <" << arg2 << ">");
1897 << "You can't ask for entry <" << arg1 << "> you have not yet declared");
1903 << "Error when trying to convert the following
string: " << arg1);
1921 std::auto_ptr<boost::property_tree::ptree>
entries;
1927 std::vector<std_cxx1x::shared_ptr<const Patterns::PatternBase> >
patterns;
1933 static std::
string mangle (const std::
string &s);
1938 static std::
string demangle (const std::
string &s);
1977 const std::
string &input_filename,
1978 const
unsigned int lineno);
2222 virtual void create_new (
const unsigned int run_no) = 0;
2228 virtual void declare_parameters (ParameterHandler &prm) = 0;
2233 virtual void run (ParameterHandler &prm) = 0;
2239 MultipleParameterLoop ();
2246 virtual ~MultipleParameterLoop ();
2256 virtual bool read_input (std::istream &input,
2257 const std::string &filename =
"input file");
2270 virtual bool read_input (
const std::string &FileName,
2271 const bool optional =
false,
2272 const bool write_stripped_file =
false);
2319 Entry (
const std::vector<std::string> &Path,
2320 const std::string &Name,
2321 const std::string &Value);
2326 void split_different_values ();
2375 void init_branches ();
2383 void init_branches_current_section ();
2388 void fill_entry_values (
const unsigned int run_no);
2392 template <
class Archive>
2403 std::vector<std::string> descriptions;
2405 for (
unsigned int j=0; j<
patterns.size(); ++j)
2406 descriptions.push_back (
patterns[j]->description());
2412 template <
class Archive>
2423 std::vector<std::string> descriptions;
2427 for (
unsigned int j=0; j<descriptions.size(); ++j)
2432 DEAL_II_NAMESPACE_CLOSE
std::vector< Entry > multiple_choices
bool scan_line(std::string line, const std::string &input_filename, const unsigned int lineno)
virtual PatternBase * clone() const
static const char path_separator
PatternBase * key_pattern
virtual PatternBase * clone() const
virtual std::string description() const
static const char * description_init
static const char * description_init
virtual bool read_input(std::istream &input, const std::string &filename="input file")
static const char * description_init
virtual std::string description() const
std::string get_current_full_path(const std::string &name) const
virtual std::size_t memory_consumption() const
virtual bool read_input_from_string(const char *s)
void loop(ITERATOR begin, typename identity< ITERATOR >::type end, DOFINFO &dinfo, INFOBOX &info, const std_cxx1x::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std_cxx1x::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std_cxx1x::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, bool cells_first=true, bool unique_faces_only=true)
virtual std::string description() const
static const char * description_init
static const char * description_init
static std::string mangle(const std::string &s)
std::size_t memory_consumption() const
virtual std::string description() const =0
virtual PatternBase * clone() const
static const char * description_init
const std::string separator
static bool is_parameter_node(const boost::property_tree::ptree &)
static Map * create(const std::string &description)
void log_parameters(LogStream &out)
static const unsigned int max_int_value
void set(const std::string &entry_name, const std::string &new_value)
virtual std::string description() const
virtual ~ParameterHandler()
std::size_t memory_consumption() const
PatternBase * pattern_factory(const std::string &description)
void log_parameters_section(LogStream &out)
virtual bool match(const std::string &test_string) const
static const char * description_init
virtual std::string description() const
std::vector< std::string > subsection_path
static const int max_int_value
virtual bool match(const std::string &test_string) const
const unsigned int max_elements
std::size_t memory_consumption() const
std::size_t memory_consumption() const
void load(Archive &ar, const unsigned int version)
std::vector< std::string > subsection_path
static const int min_int_value
static FileName * create(const std::string &description)
virtual bool match(const std::string &test_string) const
static const char * description_init
virtual PatternBase * clone() const
virtual PatternBase * clone() const =0
void enter_subsection(const std::string &subsection)
FileName(const FileType type=input)
virtual bool read_input_from_xml(std::istream &input)
static Anything * create(const std::string &description)
static const char * description_init
virtual std::string description() const
ParameterHandler & operator=(const ParameterHandler &)
virtual PatternBase * clone() const
std::vector< std_cxx1x::shared_ptr< const Patterns::PatternBase > > patterns
DeclException1(ExcEntryAlreadyExists, std::string,<< "The following entry already exists: "<< arg1)
static Selection * create(const std::string &description)
Double(const double lower_bound=min_double_value, const double upper_bound=max_double_value)
void save(Archive &ar, const unsigned int version) const
virtual bool match(const std::string &test_string) const
List(const PatternBase &base_pattern, const unsigned int min_elements=0, const unsigned int max_elements=max_int_value, const std::string &separator=",")
MultipleSelection(const std::string &seq)
Map(const PatternBase &key_pattern, const PatternBase &value_pattern, const unsigned int min_elements=0, const unsigned int max_elements=max_int_value, const std::string &separator=",")
virtual std::string description() const
virtual bool match(const std::string &test_string) const
std::string get_current_path() const
static Integer * create(const std::string &description)
static const double min_double_value
DeclException2(ExcInvalidRange, int, int,<< "The values "<< arg1<< " and "<< arg2<< " do not form a valid range.")
virtual bool match(const std::string &test_string) const
static Double * create(const std::string &description)
virtual PatternBase * clone() const
virtual bool match(const std::string &test_string) const =0
virtual PatternBase * clone() const
virtual std::string description() const
DeclException0(ExcAlreadyAtTopLevel)
virtual bool match(const std::string &test_string) const
bool get_bool(const std::string &entry_name) const
static const char * description_init
virtual std::string description() const
DeclException1(ExcCommasNotAllowed, int,<< "A comma was found at position "<< arg1<< " of your input string, but commas are not allowed here.")
static MultipleSelection * create(const std::string &description)
static const double max_double_value
static List * create(const std::string &description)
DeclException2(ExcValueDoesNotMatchPattern, std::string, std::string,<< "The string <"<< arg1<< "> does not match the given pattern <"<< arg2<< ">")
virtual PatternBase * clone() const
Integer(const int lower_bound=min_int_value, const int upper_bound=max_int_value)
double get_double(const std::string &entry_name) const
virtual PatternBase * clone() const
virtual std::string description() const
void declare_entry(const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
Selection(const std::string &seq)
static std::string demangle(const std::string &s)
std::vector< std::string > different_values
const unsigned int min_elements
static const unsigned int max_int_value
std::auto_ptr< boost::property_tree::ptree > entries
std::ostream & print_parameters(std::ostream &out, const OutputStyle style)
void print_parameters_section(std::ostream &out, const OutputStyle style, const unsigned int indent_level)
DeclException2(ExcInvalidRange, int, int,<< "The values "<< arg1<< " and "<< arg2<< " do not form a valid range.")
virtual bool match(const std::string &test_string) const
const std::string separator
const unsigned int max_elements
static Bool * create(const std::string &description)
std::size_t memory_consumption() const
const unsigned int min_elements
virtual bool match(const std::string &test_string) const
long int get_integer(const std::string &entry_string) const
virtual PatternBase * clone() const
static DirectoryName * create(const std::string &description)