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> 78 virtual bool match (
const std::string &test_string)
const = 0;
161 Integer (
const int lower_bound = min_int_value,
162 const int upper_bound = max_int_value);
168 virtual bool match (
const std::string &test_string)
const;
189 static Integer *create (
const std::string &description);
255 Double (
const double lower_bound = min_double_value,
256 const double upper_bound = max_double_value);
262 virtual bool match (
const std::string &test_string)
const;
283 static Double *create (
const std::string &description);
327 virtual bool match (
const std::string &test_string)
const;
354 static Selection *create (
const std::string &description);
397 const unsigned int min_elements = 0,
398 const unsigned int max_elements = max_int_value,
399 const std::string &separator =
",");
411 virtual bool match (
const std::string &test_string)
const;
431 static List *create (
const std::string &description);
447 <<
"The values " << arg1 <<
" and " << arg2
448 <<
" do not form a valid range.");
511 const unsigned int min_elements = 0,
512 const unsigned int max_elements = max_int_value,
513 const std::string &separator =
",");
524 virtual bool match (
const std::string &test_string)
const;
544 static Map *create (
const std::string &description);
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;
745 static Anything *create (
const std::string &description);
790 virtual bool match (
const std::string &test_string)
const;
815 static FileName *create (
const std::string &description);
849 virtual bool match (
const std::string &test_string)
const;
869 static DirectoryName *create (
const std::string &description);
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);
1622 virtual bool read_input_from_string (
const char *s);
1633 virtual bool read_input_from_xml (std::istream &input);
1660 void declare_entry (
const std::string &entry,
1661 const std::string &default_value,
1663 const std::string &documentation = std::string());
1668 void enter_subsection (
const std::string &subsection);
1674 bool leave_subsection ();
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);
1811 std::ostream &print_parameters (std::ostream &out,
1823 void print_parameters_section (std::ostream &out,
1825 const unsigned int indent_level);
1843 void log_parameters_section (
LogStream &out);
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);
1910 static const
char path_separator = '.';
1921 std::auto_ptr<boost::property_tree::ptree> entries;
1933 static
std::
string mangle (const
std::
string &s);
1938 static
std::
string demangle (const
std::
string &s);
1943 static
bool is_parameter_node (const boost::property_tree::ptree &);
1955 std::
string get_current_path () const;
1961 std::
string get_current_full_path (const
std::
string &name) const;
1976 bool scan_line (
std::
string line,
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);
2278 virtual bool read_input_from_string (
const char *s);
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>
2401 ar & *entries.get();
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>
2421 ar & *entries.get();
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
PatternBase * key_pattern
#define DeclException2(Exception2, type1, type2, outsequence)
static const char * description_init
static const char * description_init
static const char * description_init
virtual std::size_t memory_consumption() const
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)
static const char * description_init
static const char * description_init
virtual std::string description() const =0
static const char * description_init
const std::string separator
static const unsigned int max_int_value
PatternBase * pattern_factory(const std::string &description)
static const char * description_init
std::vector< std::string > subsection_path
static const int max_int_value
const unsigned int max_elements
void load(Archive &ar, const unsigned int version)
static const int min_int_value
static const char * description_init
virtual PatternBase * clone() const =0
static const char * description_init
#define DeclException1(Exception1, type1, outsequence)
void save(Archive &ar, const unsigned int version) const
#define DeclException0(Exception0)
static const double min_double_value
virtual bool match(const std::string &test_string) const =0
static const char * description_init
static const double max_double_value
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