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;
181 virtual bool match (
const std::string &test_string)
const;
273 virtual bool match (
const std::string &test_string)
const;
343 virtual bool match (
const std::string &test_string)
const;
425 virtual bool match (
const std::string &test_string)
const;
463 <<
"The values " << arg1 <<
" and " << arg2
464 <<
" do not form a valid range.");
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.");
743 virtual bool match (
const std::string &test_string)
const;
816 virtual bool match (
const std::string &test_string)
const;
875 virtual bool match (
const std::string &test_string)
const;
1645 virtual bool read_input (std::istream &input,
1646 const std::string &filename =
"input file",
1647 const std::string &last_line =
"") DEAL_II_DEPRECATED;
1661 const
std::
string &filename = "input file",
1662 const
std::
string &last_line = "");
1686 const
bool optional = false,
1687 const
bool write_stripped_file = false,
1688 const
std::
string &last_line = "") DEAL_II_DEPRECATED;
1699 const
std::
string &last_line = "");
1714 const
std::
string &last_line = "");
1725 const
std::
string &last_line = "");
1775 const
std::
string &default_value,
1777 const
std::
string &documentation =
std::
string());
1823 const
std::
string &alias_name,
1824 const
bool alias_is_deprecated = false);
1841 std::
string get (const
std::
string &entry_string) 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);
1990 const
unsigned int indent_level,
1991 const
bool include_top_level_elements = false);
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.");
2211 const
std::
string &input_filename,
2212 const
unsigned int current_line_n);
2455 virtual void create_new (
const unsigned int run_no) = 0;
2497 virtual bool read_input (std::istream &input,
2498 const std::string &filename =
"input file",
2499 const std::string &last_line =
"") DEAL_II_DEPRECATED;
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>
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>
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
std::size_t memory_consumption() const
long int get_integer(const std::string &entry_string) const
virtual bool match(const std::string &test_string) const
static const char path_separator
PatternBase * key_pattern
virtual bool match(const std::string &test_string) const
#define DeclException2(Exception2, type1, type2, outsequence)
static ::ExceptionBase & ExcEntryAlreadyExists(std::string arg1)
virtual ~ParameterHandler()
static const char * description_init
static const char * description_init
static ::ExceptionBase & ExcInvalidEntryForPatternXML(std::string arg1, std::string arg2, std::string arg3)
static ::ExceptionBase & ExcCannotOpenIncludeStatementFile(int arg1, std::string arg2, std::string arg3)
std::string get_current_path() const
virtual bool match(const std::string &test_string) const
static ::ExceptionBase & ExcEntryUndeclared(std::string arg1)
std::string get(const std::string &entry_string) const
static ::ExceptionBase & ExcUnbalancedSubsections(std::string arg1, std::string arg2)
std::size_t memory_consumption() const
const std::string separator
static Map * create(const std::string &description)
void log_parameters(LogStream &out)
static const unsigned int max_int_value
static const char * description_init
void set(const std::string &entry_name, const std::string &new_value)
virtual PatternBase * clone() const
virtual bool match(const std::string &test_string) const
void log_parameters_section(LogStream &out)
virtual std::string description(const OutputStyle style=Machine) const
static Double * create(const std::string &description)
std::vector< std::string > subsection_path
static const int max_int_value
const unsigned int max_elements
static ::ExceptionBase & ExcCommasNotAllowed(int arg1)
static const char * description_init
static ::ExceptionBase & ExcValueDoesNotMatchPattern(std::string arg1, std::string arg2)
void load(Archive &ar, const unsigned int version)
std::vector< std::string > subsection_path
static const int min_int_value
static ::ExceptionBase & ExcInvalidRange(int arg1, int arg2)
virtual PatternBase * clone() const =0
void enter_subsection(const std::string &subsection)
virtual void parse_input_from_xml(std::istream &input)
FileName(const FileType type=input)
static ::ExceptionBase & ExcInvalidXMLParameterFile()
static const char * description_init
virtual PatternBase * clone() const
static const char * description_init
static Integer * create(const std::string &description)
static ::ExceptionBase & ExcCannotParseLine(int arg1, std::string arg2, std::string arg3)
double get_double(const std::string &entry_name) const
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)
static Bool * create(const std::string &description)
ParameterHandler & operator=(const ParameterHandler &)
virtual std::string description(const OutputStyle style=Machine) const
virtual bool read_input_from_xml(std::istream &input) 1
virtual std::string description(const OutputStyle style=Machine) const
Double(const double lower_bound=min_double_value, const double upper_bound=max_double_value)
std::string get_current_full_path(const std::string &name) 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)
virtual std::size_t memory_consumption() const
static const char * description_init
static Anything * create(const std::string &description)
static ::ExceptionBase & ExcInvalidRange(int arg1, int arg2)
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=",")
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 std::string mangle(const std::string &s)
virtual std::string description(const OutputStyle style=Machine) const
virtual PatternBase * clone() const
std::size_t memory_consumption() const
static const double min_double_value
virtual std::string description(const OutputStyle style=Machine) const
#define DeclException5(Exception5, type1, type2, type3, type4, type5, outsequence)
bool get_bool(const std::string &entry_name) const
virtual bool match(const std::string &test_string) const
static const char * description_init
virtual void parse_input_from_string(const char *s, const std::string &last_line="")
static ::ExceptionBase & ExcAlreadyAtTopLevel()
virtual PatternBase * clone() const
virtual std::string description(const OutputStyle style=Machine) const
virtual bool match(const std::string &test_string) const =0
virtual PatternBase * clone() const
virtual std::string description(const OutputStyle style=Machine) const
virtual bool match(const std::string &test_string) const
static const char * description_init
std::size_t memory_consumption() const
virtual PatternBase * clone() const
static const double max_double_value
virtual std::string description(const OutputStyle style=Machine) const =0
virtual bool match(const std::string &test_string) const
virtual PatternBase * clone() const
static std::string demangle(const std::string &s)
std::ostream & print_parameters(std::ostream &out, const OutputStyle style)
Integer(const int lower_bound=min_int_value, const int upper_bound=max_int_value)
void print_parameters_section(std::ostream &out, const OutputStyle style, const unsigned int indent_level, const bool include_top_level_elements=false)
virtual PatternBase * clone() const
void save(Archive &ar, const unsigned int version) const
std_cxx11::unique_ptr< boost::property_tree::ptree > entries
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 DirectoryName * create(const std::string &description)
static FileName * create(const std::string &description)
static MultipleSelection * create(const std::string &description)
virtual bool match(const std::string &test_string) const
std::vector< std::string > different_values
void scan_line(std::string line, const std::string &input_filename, const unsigned int current_line_n)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
const unsigned int min_elements
std::size_t memory_consumption() const
static ::ExceptionBase & ExcInvalidEntryForPattern(int arg1, std::string arg2, std::string arg3, std::string arg4, std::string arg5)
static List * create(const std::string &description)
virtual bool read_input_from_string(const char *s, const std::string &last_line="")
static const unsigned int max_int_value
static Selection * create(const std::string &description)
virtual PatternBase * clone() const
static ::ExceptionBase & ExcNoSubsection(int arg1, std::string arg2, std::string arg3)
const std::string separator
virtual std::string description(const OutputStyle style=Machine) const
void declare_alias(const std::string &existing_entry_name, const std::string &alias_name, const bool alias_is_deprecated=false)
const unsigned int max_elements
virtual std::string description(const OutputStyle style=Machine) const
virtual bool match(const std::string &test_string) const
const unsigned int min_elements
virtual std::string description(const OutputStyle style=Machine) const
std::vector< std_cxx11::shared_ptr< const Patterns::PatternBase > > patterns
virtual PatternBase * clone() const
virtual void parse_input(std::istream &input, const std::string &filename="input file", const std::string &last_line="")