]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
It turns out that, despite assurances in the doc strings, we did not check that the...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 22 Aug 2013 04:14:51 +0000 (04:14 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 22 Aug 2013 04:14:51 +0000 (04:14 +0000)
git-svn-id: https://svn.dealii.org/trunk@30406 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/base/parameter_handler.cc
tests/bits/parameter_handler_13a.cc
tests/bits/parameter_handler_1a.cc
tests/bits/parameter_handler_1a/cmp/generic
tests/bits/parameter_handler_1a/prm

index 5a70443040823ca53c348f351af459123980e5c6..b5e5c868092f249ef5db63cbb44ac67dd45b7f71 100644 (file)
@@ -56,6 +56,15 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li>
+  Fixed: The ParameterHandler::declare_entry() did not check that the
+  default value of a parameter indeed satisfies the pattern given for this
+  parameter (despite a statement in the documentation that this checking
+  would happen). This is now fixed.
+  <br>
+  (Wolfgang Bangerth, 2013/08/21)
+  </li>
+
   <li>
   New: Patterns::List and Patterns::Map now accept a string
   different than the default comma that denotes the separator
index e59d518c0afb04ff1dd8f1ad7e08129904d18e6e..78adb441beb283797f9a537c6e6e8db98bffd2b8 100644 (file)
@@ -1579,6 +1579,14 @@ ParameterHandler::declare_entry (const std::string           &entry,
                                  const Patterns::PatternBase &pattern,
                                  const std::string           &documentation)
 {
+  Assert (pattern.match (default_value),
+         ExcMessage (std::string("The default value <") +
+                     default_value +
+                     "> for the entry <" +
+                     entry +
+                     "> does not match the given pattern " +
+                     pattern.description()));
+  
   entries->put (get_current_full_path(entry) + path_separator + "value",
                 default_value);
   entries->put (get_current_full_path(entry) + path_separator + "default_value",
index 8ade8c2cc36faeec77227bd0adb8e4f3f57e5a88..1492f2d69561f290894b482f9d9d8e5cbdd928c5 100644 (file)
@@ -26,7 +26,7 @@
 void check (const char *p)
 {
   ParameterHandler prm;
-  prm.declare_entry ("test_13", "-1:a, 0:b, 1:c",
+  prm.declare_entry ("test_13", "-1:a xyz 0:b xyz 1:c",
                      Patterns::Map(Patterns::Integer(-1,1),
                                    Patterns::Selection("a|b|c"),
                                    2,3, "xyz"));
index b26f8bcec192cb2907ee94559bac28d332b3e5c8..a0166cf06bf9ca172ac8203cbe195e88fe579080 100644 (file)
@@ -27,7 +27,7 @@
 void check (const char *p)
 {
   ParameterHandler prm;
-  prm.declare_entry ("test_1", "-1,0",
+  prm.declare_entry ("test_1", "-1 xyz 0",
                      Patterns::List(Patterns::Integer(-1,1),2,3,"xyz"));
 
   std::ifstream in(p);
index 4dd3ceb053debe29fb400960671173cc6789fbd8..f6607cae796a9fd6155d7f0fdc4b026ca5ef2292 100644 (file)
@@ -1,2 +1,2 @@
 
-DEAL::test_1=-1,0
+DEAL::test_1=1 xyz 0 xyz 1
index 8927009d62988baa99db75a50a835a81acc30de6..bceb08beaf0bf779b7dd50102f777585fb105648 100644 (file)
@@ -1 +1 @@
-set test_1 = 1,0,1xyz1,0,-1
+set test_1 = 1 xyz 0 xyz 1

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.