]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Removed patterns_tools.cc and refactored add_parameter
authorLuca Heltai <luca.heltai@sissa.it>
Wed, 19 Jul 2017 18:53:48 +0000 (20:53 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Sun, 23 Jul 2017 14:57:13 +0000 (16:57 +0200)
include/deal.II/base/patterns_tools.h
source/base/CMakeLists.txt
source/base/patterns_tools.cc [deleted file]

index 584a18ca7e9f420eddfaa8e0d2db37e30e72750e..23b51d1a49cb1f1ccb34868760afbb402e604f49 100644 (file)
 
 
 #include <deal.II/base/config.h>
+#include <deal.II/base/utilities.h>
 #include <deal.II/base/exceptions.h>
 #include <deal.II/base/subscriptor.h>
 #include <deal.II/base/point.h>
+#include <deal.II/base/parameter_handler.h>
 #include <deal.II/base/std_cxx14/memory.h>
 
 #include <boost/core/demangle.hpp>
-#include <boost/any.hpp>
-
 
 #include <map>
 #include <vector>
@@ -148,6 +148,22 @@ namespace PatternsTools
                       const std::unique_ptr<PatternBase> &p = Convert<T>::to_pattern()) = delete;
   };
 
+  /**
+   * Declare a new entry in @p prm with name @p entry, set its default value
+   * to the content of the variable @p parameter, and create an action
+   * that will fill @p parameter with updated values when a file is parsed,
+   * or the entry is set to a new value.
+   *
+   * By default, the pattern to use is obtained by calling the function
+   * PatternsTools::Convert<T>::to_pattern(), but a custom one can be used.
+   */
+  template <class ParameterType>
+  void add_parameter(const std::string           &entry,
+                     ParameterType               &parameter,
+                     ParameterHandler            &prm,
+                     const std::string           &documentation = std::string(),
+                     const Patterns::PatternBase &pattern = *Convert<ParameterType>::to_pattern());
+
   /**
    * @addtogroup Exceptions
    * @{
index 434cec8d73751b6feb25e6486d673abf159128cc..4625cb74183eead0cac8544f0d0b6f1129010475 100644 (file)
@@ -45,7 +45,6 @@ SET(_src
   parsed_function.cc
   partitioner.cc
   path_search.cc
-  patterns_tools.cc
   polynomial.cc
   polynomials_abf.cc
   polynomials_adini.cc
diff --git a/source/base/patterns_tools.cc b/source/base/patterns_tools.cc
deleted file mode 100644 (file)
index c7340bb..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE at
-// the top level of the deal.II distribution.
-//
-// ---------------------------------------------------------------------
-
-
-#include <deal.II/base/parameter_handler.h>
-#include <deal.II/base/patterns_tools.h>
-#include <deal.II/base/utilities.h>
-#include <deal.II/base/memory_consumption.h>
-#include <deal.II/base/std_cxx14/memory.h>
-
-DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
-#include <boost/core/demangle.hpp>
-DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
-
-//#include <fstream>
-//#include <iostream>
-//#include <iomanip>
-//#include <cstdlib>
-//#include <algorithm>
-//#include <sstream>
-//#include <cctype>
-//#include <limits>
-//#include <cstring>
-
-
-DEAL_II_NAMESPACE_OPEN
-
-
-
-//TODO[WB]: various functions here could be simplified by using namespace Utilities
-
-namespace PatternsTools
-{
-  std::string default_list_separator(unsigned int rank)
-  {
-    static std::array<std::string, 5> seps = {{" ",  ","  ,  ";"  ,  "|"  ,   "%"}};
-    AssertThrow(rank < seps.size(), ExcMessage("I don't know what to use for such "
-                                               "high rank. Bailing out."));
-    return seps[rank];
-  }
-
-
-  std::string default_map_separator(unsigned int rank)
-  {
-    static std::array<std::string, 5> seps = {{" ",  ":"  ,  "="  ,  "@"  ,   "#"}};
-    AssertThrow(rank < seps.size(), ExcMessage("I don't know what to use for such "
-                                               "high rank. Bailing out."));
-    return seps[rank];
-  }
-}
-
-DEAL_II_NAMESPACE_CLOSE

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.