]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix Exceptions
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 6 Jun 2018 07:59:16 +0000 (09:59 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 6 Jun 2018 15:13:44 +0000 (17:13 +0200)
include/deal.II/algorithms/any_data.h
include/deal.II/base/exceptions.h
include/deal.II/base/function_parser.h
include/deal.II/base/patterns.h
include/deal.II/fe/fe_values.h
include/deal.II/lac/lapack_support.h
include/deal.II/lac/sparse_direct.h

index 2c32cb68920352a10e8de24fd087b2afcc18f003..5f0fac0f2f2e8776f4717fd1c87016173daf61cb 100644 (file)
@@ -197,8 +197,8 @@ public:
 
   /// The requested type and the stored type are different
   DeclException2(ExcTypeMismatch,
-                 char *,
-                 char *,
+                 std::string,
+                 std::string,
                  << "The requested type " << arg1 << " and the stored type "
                  << arg2 << " must coincide.");
 
index 5c5badfec7da7412fa6d5c6f705dfab0aa21b232..65f63e7f7d5a7f748f670fabede3b4d10a1a7ceb 100644 (file)
@@ -224,8 +224,8 @@ private:
     class Exception1 : public dealii::ExceptionBase      \
     {                                                    \
     public:                                              \
-      Exception1(const type1 a1) : arg1(a1)              \
-      {} /*NOLINT*/                                      \
+      Exception1(type1 const &a1) : arg1(a1)             \
+      {}                                                 \
       virtual ~Exception1() noexcept                     \
       {}                                                 \
       virtual void                                       \
@@ -235,7 +235,7 @@ private:
       }                                                  \
                                                          \
     private:                                             \
-      const type1 arg1;                                  \
+      type1 const arg1;                                  \
     }
 
 
@@ -245,26 +245,23 @@ private:
  *
  * @ingroup Exceptions
  */
-#  define DeclException2(Exception2, type1, type2, outsequence) \
-    class Exception2 : public dealii::ExceptionBase             \
-    {                                                           \
-    public:                                                     \
-      Exception2(const type1 a1, const type2 a2) :              \
-        /*NOLINT*/                                              \
-        arg1(a1),                                               \
-        arg2(a2)                                                \
-      {}                                                        \
-      virtual ~Exception2() noexcept                            \
-      {}                                                        \
-      virtual void                                              \
-      print_info(std::ostream &out) const override              \
-      {                                                         \
-        out << "    " outsequence << std::endl;                 \
-      }                                                         \
-                                                                \
-    private:                                                    \
-      const type1 arg1;                                         \
-      const type2 arg2;                                         \
+#  define DeclException2(Exception2, type1, type2, outsequence)         \
+    class Exception2 : public dealii::ExceptionBase                     \
+    {                                                                   \
+    public:                                                             \
+      Exception2(type1 const &a1, type2 const &a2) : arg1(a1), arg2(a2) \
+      {}                                                                \
+      virtual ~Exception2() noexcept                                    \
+      {}                                                                \
+      virtual void                                                      \
+      print_info(std::ostream &out) const override                      \
+      {                                                                 \
+        out << "    " outsequence << std::endl;                         \
+      }                                                                 \
+                                                                        \
+    private:                                                            \
+      type1 const arg1;                                                 \
+      type2 const arg2;                                                 \
     }
 
 
@@ -278,8 +275,7 @@ private:
     class Exception3 : public dealii::ExceptionBase                    \
     {                                                                  \
     public:                                                            \
-      Exception3(const type1 a1, const type2 a2, const type3 a3) :     \
-        /*NOLINT*/                                                     \
+      Exception3(type1 const &a1, type2 const &a2, type3 const &a3) :  \
         arg1(a1),                                                      \
         arg2(a2),                                                      \
         arg3(a3)                                                       \
@@ -293,9 +289,9 @@ private:
       }                                                                \
                                                                        \
     private:                                                           \
-      const type1 arg1;                                                \
-      const type2 arg2;                                                \
-      const type3 arg3;                                                \
+      type1 const arg1;                                                \
+      type2 const arg2;                                                \
+      type3 const arg3;                                                \
     }
 
 
@@ -309,11 +305,10 @@ private:
     class Exception4 : public dealii::ExceptionBase                           \
     {                                                                         \
     public:                                                                   \
-      Exception4(const type1 a1,                                              \
-                 const type2 a2, /*NOLINT*/                                   \
-                 const type3 a3,                                              \
-                 const type4 a4) :                                            \
-        /*NOLINT*/                                                            \
+      Exception4(type1 const &a1,                                             \
+                 type2 const &a2,                                             \
+                 type3 const &a3,                                             \
+                 type4 const &a4) :                                           \
         arg1(a1),                                                             \
         arg2(a2),                                                             \
         arg3(a3),                                                             \
@@ -328,10 +323,10 @@ private:
       }                                                                       \
                                                                               \
     private:                                                                  \
-      const type1 arg1;                                                       \
-      const type2 arg2;                                                       \
-      const type3 arg3;                                                       \
-      const type4 arg4;                                                       \
+      type1 const arg1;                                                       \
+      type2 const arg2;                                                       \
+      type3 const arg3;                                                       \
+      type4 const arg4;                                                       \
     }
 
 
@@ -346,12 +341,11 @@ private:
     class Exception5 : public dealii::ExceptionBase             \
     {                                                           \
     public:                                                     \
-      Exception5(const type1 a1,                                \
-                 const type2 a2,                                \
-                 const type3 a3, /*NOLINT*/                     \
-                 const type4 a4,                                \
-                 const type5 a5) :                              \
-        /*NOLINT*/                                              \
+      Exception5(type1 const &a1,                               \
+                 type2 const &a2,                               \
+                 type3 const &a3,                               \
+                 type4 const &a4,                               \
+                 type5 const &a5) :                             \
         arg1(a1),                                               \
         arg2(a2),                                               \
         arg3(a3),                                               \
@@ -367,11 +361,11 @@ private:
       }                                                         \
                                                                 \
     private:                                                    \
-      const type1 arg1;                                         \
-      const type2 arg2;                                         \
-      const type3 arg3;                                         \
-      const type4 arg4;                                         \
-      const type5 arg5;                                         \
+      type1 const arg1;                                         \
+      type2 const arg2;                                         \
+      type3 const arg3;                                         \
+      type4 const arg4;                                         \
+      type5 const arg5;                                         \
     }
 
 #else /*ifndef DOXYGEN*/
@@ -587,7 +581,7 @@ namespace StandardExceptions
    * file.
    */
   DeclException1(ExcFileNotOpen,
-                 char *,
+                 std::string,
                  << "Could not open file " << arg1 << ".");
 
   /**
index b8f16fcab58d4dc491a60c073a0fff2cf75d11e8..0fc9a890aba5c88700c85a4031dc8175683b2696 100644 (file)
@@ -312,7 +312,7 @@ public:
    */
   DeclException2(ExcParseError,
                  int,
-                 char *,
+                 std::string,
                  << "Parsing Error at Column " << arg1
                  << ". The parser said: " << arg2);
 
index 4f84342baea6f6cb44d324709f54955d5fde934a..1219cee97fd5ca0828fd93bb917e640581a1a1d5 100644 (file)
@@ -1398,9 +1398,9 @@ namespace Patterns
      */
     DeclException2(ExcNoMatch,
                    std::string,
-                   Patterns::PatternBase &,
+                   const Patterns::PatternBase *,
                    << "The string " << arg1 << " does not match the pattern \""
-                   << arg2.description() << "\"");
+                   << arg2->description() << "\"");
     //@}
   } // namespace Tools
 } // namespace Patterns
@@ -1514,7 +1514,7 @@ namespace Patterns
           str << (value ? "true" : "false");
         else
           str << value;
-        AssertThrow(p->match(str.str()), ExcNoMatch(str.str(), *p));
+        AssertThrow(p->match(str.str()), ExcNoMatch(str.str(), p.get()));
         return str.str();
       }
 
@@ -1523,7 +1523,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &p =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(p->match(s), ExcNoMatch(s, *p));
+        AssertThrow(p->match(s), ExcNoMatch(s, p.get()));
         T value;
         if (std::is_same<T, bool>::value)
           value = (s == "true");
@@ -1769,7 +1769,7 @@ namespace Patterns
         for (unsigned int i = 1; i < vec.size(); ++i)
           s += p->get_separator() + " " + vec[i];
 
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *p));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, p));
         return s;
       }
 
@@ -1778,7 +1778,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
 
         auto p = dynamic_cast<const Patterns::List *>(pattern.get());
         AssertThrow(p,
@@ -1845,7 +1845,7 @@ namespace Patterns
         for (unsigned int i = 1; i < vec.size(); ++i)
           s += p->get_separator() + " " + vec[i];
 
-        AssertThrow(p->match(s), ExcNoMatch(s, *p));
+        AssertThrow(p->match(s), ExcNoMatch(s, p));
         return s;
       }
 
@@ -1854,7 +1854,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
 
         auto p = dynamic_cast<const Patterns::Map *>(pattern.get());
         AssertThrow(p,
@@ -1919,7 +1919,7 @@ namespace Patterns
         for (unsigned int i = 1; i < vec.size(); ++i)
           s += p->get_separator() + " " + vec[i];
 
-        AssertThrow(p->match(s), ExcNoMatch(s, *p));
+        AssertThrow(p->match(s), ExcNoMatch(s, p));
         return s;
       }
 
@@ -1928,7 +1928,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
 
         auto p = dynamic_cast<const Patterns::List *>(pattern.get());
         AssertThrow(p,
@@ -2012,7 +2012,7 @@ namespace Patterns
           p->get_separator() + " " +
           Convert<typename T::value_type>::to_string(t.imag(), base_p);
 
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *p));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, p));
         return s;
       }
 
@@ -2024,7 +2024,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
 
         auto p = dynamic_cast<const Patterns::List *>(pattern.get());
         AssertThrow(p,
@@ -2058,7 +2058,7 @@ namespace Patterns
                 const std::unique_ptr<Patterns::PatternBase> &pattern =
                   Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(t), ExcNoMatch(t, *pattern));
+        AssertThrow(pattern->match(t), ExcNoMatch(t, pattern.get()));
         return t;
       }
 
@@ -2067,7 +2067,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
         return s;
       }
     };
@@ -2102,7 +2102,7 @@ namespace Patterns
         std::unordered_map<Key, Value> m;
         m.insert(t);
         std::string s = Convert<decltype(m)>::to_string(m, pattern);
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
         return s;
       }
 
@@ -2147,7 +2147,7 @@ namespace Patterns
         std::string str;
         for (unsigned int i = 0; i < string_array.size(); ++i)
           str += (i ? " " + p->get_separator() + " " : "") + string_array[i];
-        AssertThrow(p->match(str), ExcNoMatch(str, *p));
+        AssertThrow(p->match(str), ExcNoMatch(str, p));
         return str;
       }
 
@@ -2156,7 +2156,7 @@ namespace Patterns
                const std::unique_ptr<Patterns::PatternBase> &pattern =
                  Convert<T>::to_pattern())
       {
-        AssertThrow(pattern->match(s), ExcNoMatch(s, *pattern));
+        AssertThrow(pattern->match(s), ExcNoMatch(s, pattern.get()));
 
         auto p = dynamic_cast<const Patterns::Tuple *>(pattern.get());
         AssertThrow(p,
index 302b3b4fc89f01084f59db062c271f567574ed56..9f90fd0b53b46927e7c4da8ae0b07d52b29ab7e0 100644 (file)
@@ -3187,7 +3187,7 @@ public:
    */
   DeclException1(
     ExcAccessToUninitializedField,
-    char *,
+    std::string,
     << "You are requesting information from an FEValues/FEFaceValues/FESubfaceValues "
     << "object for which this kind of information has not been computed. What "
     << "information these objects compute is determined by the update_* flags you "
index a2af518adc763b87ef481fff7a5222c3713d4f87..bbfe7c96fd9d0ea7c9c3a2748a2cf1506380856b 100644 (file)
@@ -186,7 +186,7 @@ namespace LAPACKSupport
    * A LAPACK function returned an error code.
    */
   DeclException2(ExcErrorCode,
-                 char *,
+                 std::string,
                  types::blas_int,
                  << "The function " << arg1 << " returned with an error code "
                  << arg2);
@@ -217,7 +217,7 @@ namespace LAPACKSupport
    */
   DeclException1(
     ExcMissing,
-    char *,
+    std::string,
     << "When you ran 'cmake' during installation of deal.II, "
     << "no suitable installation of the BLAS or LAPACK library could "
     << "be found. Consequently, the function <" << arg1
index e99241ad1637b07e859480f875a0f2ee5cd82db3..5650112878aa42abd528b9077733c470ccba6514 100644 (file)
@@ -275,7 +275,7 @@ public:
    */
   DeclException2(
     ExcUMFPACKError,
-    char *,
+    std::string,
     int,
     << "UMFPACK routine " << arg1 << " returned error status " << arg2 << "."
     << "\n\n"

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.