16 #ifndef dealii__parameter_handler_h 17 #define dealii__parameter_handler_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/subscriptor.h> 23 #include <deal.II/base/std_cxx11/shared_ptr.h> 24 #include <deal.II/base/std_cxx11/unique_ptr.h> 26 #include <boost/property_tree/ptree_fwd.hpp> 27 #include <boost/serialization/split_member.hpp> 33 DEAL_II_NAMESPACE_OPEN
68 virtual bool match (
const std::string &test_string)
const = 0;
149 Integer (
const int lower_bound = min_int_value,
150 const int upper_bound = max_int_value);
156 virtual bool match (
const std::string &test_string)
const;
177 static Integer *create (
const std::string &description);
243 Double (
const double lower_bound = min_double_value,
244 const double upper_bound = max_double_value);
250 virtual bool match (
const std::string &test_string)
const;
271 static Double *create (
const std::string &description);
318 virtual bool match (
const std::string &test_string)
const;
345 static Selection *create (
const std::string &description);
387 const unsigned int min_elements = 0,
388 const unsigned int max_elements = max_int_value,
389 const std::string &separator =
",");
400 virtual bool match (
const std::string &test_string)
const;
420 static List *create (
const std::string &description);
438 <<
"The values " << arg1 <<
" and " << arg2
439 <<
" do not form a valid range.");
502 const unsigned int min_elements = 0,
503 const unsigned int max_elements = max_int_value,
504 const std::string &separator =
",");
515 virtual bool match (
const std::string &test_string)
const;
535 static Map *create (
const std::string &description);
553 <<
"The values " << arg1 <<
" and " << arg2
554 <<
" do not form a valid range.");
608 virtual bool match (
const std::string &test_string)
const;
647 <<
"A comma was found at position " << arg1
648 <<
" of your input string, but commas are not allowed here.");
693 static Bool *create (
const std::string &description);
718 virtual bool match (
const std::string &test_string)
const;
738 static Anything *create (
const std::string &description);
781 virtual bool match (
const std::string &test_string)
const;
806 static FileName *create (
const std::string &description);
840 virtual bool match (
const std::string &test_string)
const;
860 static DirectoryName *create (
const std::string &description);
1581 virtual bool read_input (std::istream &input,
1582 const std::string &filename =
"input file");
1595 virtual bool read_input (
const std::string &filename,
1596 const bool optional =
false,
1597 const bool write_stripped_file =
false);
1605 virtual bool read_input_from_string (
const char *s);
1616 virtual bool read_input_from_xml (std::istream &input);
1643 void declare_entry (
const std::string &entry,
1644 const std::string &default_value,
1646 const std::string &documentation = std::string());
1691 void declare_alias (
const std::string &existing_entry_name,
1692 const std::string &alias_name,
1693 const bool alias_is_deprecated =
false);
1698 void enter_subsection (
const std::string &subsection);
1703 void leave_subsection ();
1710 std::string
get (
const std::string &entry_string)
const;
1717 long int get_integer (
const std::string &entry_string)
const;
1722 double get_double (
const std::string &entry_name)
const;
1729 bool get_bool (
const std::string &entry_name)
const;
1740 void set (
const std::string &entry_name,
1741 const std::string &new_value);
1753 void set (
const std::string &entry_name,
1754 const char *new_value);
1765 void set (
const std::string &entry_name,
1766 const long int &new_value);
1781 void set (
const std::string &entry_name,
1782 const double &new_value);
1793 void set (
const std::string &entry_name,
1794 const bool &new_value);
1840 std::ostream &print_parameters (std::ostream &out,
1857 void print_parameters_section (std::ostream &out,
1859 const unsigned int indent_level,
1860 const bool include_top_level_elements =
false);
1878 void log_parameters_section (
LogStream &out);
1890 template <
class Archive>
1891 void save (Archive &ar,
const unsigned int version)
const;
1897 template <
class Archive>
1898 void load (Archive &ar,
const unsigned int version);
1900 BOOST_SERIALIZATION_SPLIT_MEMBER()
1917 << "The following entry already exists: " << arg1);
1922 std::
string,
std::
string,
1923 << "The
string <" << arg1
1924 << "> does not
match the given pattern <" << arg2 << ">");
1934 << "You can't ask for entry <" << arg1 << "> you have not yet declared");
1941 static const
char path_separator = '.';
1963 static
std::
string mangle (const
std::
string &s);
1968 static
std::
string demangle (const
std::
string &s);
1980 std::
string get_current_path () const;
1986 std::
string get_current_full_path (const
std::
string &name) const;
2001 bool scan_line (
std::
string line,
2002 const
std::
string &input_filename,
2003 const
unsigned int current_line_n);
2246 virtual void create_new (
const unsigned int run_no) = 0;
2251 virtual void run (ParameterHandler &prm) = 0;
2257 MultipleParameterLoop ();
2263 virtual ~MultipleParameterLoop ();
2278 virtual bool read_input (std::istream &input,
2279 const std::string &filename =
"input file");
2329 Entry (
const std::vector<std::string> &Path,
2330 const std::string &Name,
2331 const std::string &Value);
2336 void split_different_values ();
2385 void init_branches ();
2393 void init_branches_current_section ();
2398 void fill_entry_values (
const unsigned int run_no);
2402 template <
class Archive>
2411 ar & *entries.get();
2413 std::vector<std::string> descriptions;
2415 for (
unsigned int j=0; j<patterns.size(); ++j)
2416 descriptions.push_back (patterns[j]->description());
2422 template <
class Archive>
2431 ar & *entries.get();
2433 std::vector<std::string> descriptions;
2437 for (
unsigned int j=0; j<descriptions.size(); ++j)
2442 DEAL_II_NAMESPACE_CLOSE
std::vector< Entry > multiple_choices
PatternBase * key_pattern
#define DeclException2(Exception2, type1, type2, outsequence)
static const char * description_init
static const char * description_init
virtual std::string description() const =0
const std::string separator
static const unsigned int max_int_value
static const char * description_init
std::vector< std::string > subsection_path
static const int max_int_value
const unsigned int max_elements
static const char * description_init
void load(Archive &ar, const unsigned int version)
static const int min_int_value
virtual PatternBase * clone() const =0
static const char * description_init
static const char * description_init
static const char * description_init
#define DeclException1(Exception1, type1, outsequence)
virtual std::size_t memory_consumption() const
static const char * description_init
PatternBase * pattern_factory(const std::string &description)
#define DeclException0(Exception0)
void loop(ITERATOR begin, typename identity< ITERATOR >::type end, DOFINFO &dinfo, INFOBOX &info, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std_cxx11::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std_cxx11::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
static const double min_double_value
virtual bool read_input(std::istream &input, const std::string &filename="input file")
static const char * description_init
virtual bool match(const std::string &test_string) const =0
static const char * description_init
static const double max_double_value
void save(Archive &ar, const unsigned int version) const
std::vector< std::string > different_values
const unsigned int min_elements
static const unsigned int max_int_value
const std::string separator
const unsigned int max_elements
const unsigned int min_elements