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;
174 Integer (
const int lower_bound = min_int_value,
175 const int upper_bound = max_int_value);
181 virtual bool match (
const std::string &test_string)
const;
266 Double (
const double lower_bound = min_double_value,
267 const double upper_bound = max_double_value);
273 virtual bool match (
const std::string &test_string)
const;
343 virtual bool match (
const std::string &test_string)
const;
370 static Selection *create (
const std::string &description);
412 const unsigned int min_elements = 0,
413 const unsigned int max_elements = max_int_value,
414 const std::string &separator =
",");
425 virtual bool match (
const std::string &test_string)
const;
463 <<
"The values " << arg1 <<
" and " << arg2
464 <<
" do not form a valid range.");
527 const unsigned int min_elements = 0,
528 const unsigned int max_elements = max_int_value,
529 const std::string &separator =
",");
540 virtual bool match (
const std::string &test_string)
const;
578 <<
"The values " << arg1 <<
" and " << arg2
579 <<
" do not form a valid range.");
633 virtual bool match (
const std::string &test_string)
const;
672 <<
"A comma was found at position " << arg1
673 <<
" of your input string, but commas are not allowed here.");
718 static Bool *create (
const std::string &description);
743 virtual bool match (
const std::string &test_string)
const;
763 static Anything *create (
const std::string &description);
816 virtual bool match (
const std::string &test_string)
const;
875 virtual bool match (
const std::string &test_string)
const;
895 static DirectoryName *create (
const std::string &description);
1645 virtual bool read_input (std::istream &input,
1646 const std::string &filename =
"input file",
1647 const std::string &last_line =
"") DEAL_II_DEPRECATED;
1660 virtual
void parse_input (
std::istream &input,
1661 const
std::
string &filename = "input file",
1662 const
std::
string &last_line = "");
1685 virtual
bool read_input (const
std::
string &filename,
1686 const
bool optional = false,
1687 const
bool write_stripped_file = false,
1688 const
std::
string &last_line = "") DEAL_II_DEPRECATED;
1698 virtual
void parse_input (const
std::
string &filename,
1699 const
std::
string &last_line = "");
1713 virtual
bool read_input_from_string (const
char *s,
1714 const
std::
string &last_line = "");
1724 virtual
void parse_input_from_string (const
char *s,
1725 const
std::
string &last_line = "");
1738 virtual
bool read_input_from_xml (
std::istream &input) DEAL_II_DEPRECATED;
1747 virtual
void parse_input_from_xml (
std::istream &input);
1774 void declare_entry (const
std::
string &entry,
1775 const
std::
string &default_value,
1777 const
std::
string &documentation =
std::
string());
1822 void declare_alias (const
std::
string &existing_entry_name,
1823 const
std::
string &alias_name,
1824 const
bool alias_is_deprecated = false);
1829 void enter_subsection (const
std::
string &subsection);
1834 void leave_subsection ();
1841 std::
string get (const
std::
string &entry_string) const;
1848 long int get_integer (const
std::
string &entry_string) const;
1853 double get_double (const
std::
string &entry_name) const;
1860 bool get_bool (const
std::
string &entry_name) const;
1871 void set (const
std::
string &entry_name,
1872 const
std::
string &new_value);
1884 void set (const
std::
string &entry_name,
1885 const
char *new_value);
1896 void set (const
std::
string &entry_name,
1897 const
long int &new_value);
1912 void set (const
std::
string &entry_name,
1913 const
double &new_value);
1924 void set (const
std::
string &entry_name,
1925 const
bool &new_value);
1971 std::ostream &print_parameters (
std::ostream &out,
1988 void print_parameters_section (
std::ostream &out,
1990 const
unsigned int indent_level,
1991 const
bool include_top_level_elements = false);
2009 void log_parameters_section (
LogStream &out);
2021 template <class Archive>
2022 void save (Archive &ar, const
unsigned int version) const;
2028 template <class Archive>
2029 void load (Archive &ar, const
unsigned int version);
2031 BOOST_SERIALIZATION_SPLIT_MEMBER()
2048 << "The following entry already exists: " << arg1 << ".");
2053 std::
string,
std::
string,
2054 << "The
string <" << arg1
2055 << "> does not
match the given pattern <" << arg2 << ">.");
2060 "You can't leave a subsection if you are already at the top level "
2061 "of the subsection hierarchy.");
2067 << "You can't ask for entry <" << arg1 << "> you have not yet declared.");
2076 std::
string,
std::
string,
2077 << "There are unequal
numbers of 'subsection' and 'end' "
2078 "statements in the parameter file <" << arg1 << ">."
2079 << (arg2.size() > 0 ? "\n" + arg2 : ""));
2086 int,
std::
string,
std::
string,
2087 << "Line <" << arg1 << "> of file <" << arg2 << ": There is "
2088 "no such subsection to be entered: " << arg3);
2096 int,
std::
string,
std::
string, << "Line <" << arg1 <<
2097 "> of file <" << arg2 << ">: " << arg3);
2105 int,
std::
string,
std::
string,
std::
string,
std::
string,
2106 << "Line <" << arg1 << "> of file <" << arg2 << ">:\n"
2107 " The entry value \n" << " " << arg3 << '\n' <<
2108 " for the entry named\n" << " " << arg4 << '\n' <<
2109 " does not
match the given pattern:\n" << " " <<
2118 "The provided file could not be parsed as a "
2128 << " The entry value \n" << " " << arg1 << '\n' <<
2129 " for the entry named\n" << " " << arg2 << '\n' <<
2130 " does not
match the given pattern:\n" << " " <<
2140 int,
std::
string,
std::
string,
2141 << "Line <" << arg1 << "> of file <" << arg2 << ">: This line "
2142 "contains an 'include' or 'INCLUDE' statement, but the given "
2143 "file to include <" << arg3 << "> cannot be opened.");
2151 static const
char path_separator = '.';
2173 static
std::
string mangle (const
std::
string &s);
2178 static
std::
string demangle (const
std::
string &s);
2190 std::
string get_current_path () const;
2196 std::
string get_current_full_path (const
std::
string &name) const;
2210 void scan_line (
std::
string line,
2211 const
std::
string &input_filename,
2212 const
unsigned int current_line_n);
2455 virtual void create_new (
const unsigned int run_no) = 0;
2460 virtual void run (ParameterHandler &prm) = 0;
2466 MultipleParameterLoop ();
2472 virtual ~MultipleParameterLoop ();
2497 virtual bool read_input (std::istream &input,
2498 const std::string &filename =
"input file",
2499 const std::string &last_line =
"") DEAL_II_DEPRECATED;
2517 virtual void parse_input (std::istream &input,
2518 const std::string &filename =
"input file",
2519 const std::string &last_line =
"");
2581 Entry (
const std::vector<std::string> &Path,
2582 const std::string &Name,
2583 const std::string &Value);
2588 void split_different_values ();
2637 void init_branches ();
2645 void init_branches_current_section ();
2650 void fill_entry_values (
const unsigned int run_no);
2654 template <
class Archive>
2663 ar & *entries.get();
2665 std::vector<std::string> descriptions;
2667 for (
unsigned int j=0; j<patterns.size(); ++j)
2668 descriptions.push_back (patterns[j]->description());
2674 template <
class Archive>
2683 ar & *entries.get();
2685 std::vector<std::string> descriptions;
2689 for (
unsigned int j=0; j<descriptions.size(); ++j)
2694 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
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
virtual bool read_input(std::istream &input, const std::string &filename="input file", const std::string &last_line="") 1
static const char * description_init
#define DeclException1(Exception1, type1, outsequence)
void save(Archive &ar, const unsigned int version) const
static const char * description_init
PatternBase * pattern_factory(const std::string &description)
#define DeclExceptionMsg(Exception, defaulttext)
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
#define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence)
static const char * description_init
virtual bool match(const std::string &test_string) const =0
static const char * description_init
virtual std::size_t memory_consumption() const
static const double max_double_value
virtual std::string description(const OutputStyle style=Machine) const =0
std::vector< std::string > different_values
#define DeclException3(Exception3, type1, type2, type3, outsequence)
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
virtual void parse_input(std::istream &input, const std::string &filename="input file", const std::string &last_line="")