]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add generic declaration ExcIndexRangeType and AssertGlobalIndexRange in exception.h
authorkainan.wang <kainan.wang@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 21:42:59 +0000 (21:42 +0000)
committerkainan.wang <kainan.wang@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 2 Apr 2013 21:42:59 +0000 (21:42 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_bigger_global_dof_indices_4@29154 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/exceptions.h

index b7dba6957633efadba5f97440f22943811c46a47..82bdec6f3547ca08f599fa0ce2939156c17dfce4 100644 (file)
@@ -734,6 +734,16 @@ namespace StandardExceptions
                   << "Index " << arg1 << " is not in [" << arg2 << ","
                   << arg3 << "[");
 
+  /**
+   * This generic exception will allow(enforce) the user to specify
+   * the type of indices which adds type safety to the program.
+   */
+  template<typename T>
+  DeclException3 (ExcIndexRangeType,
+                  T,T,T,
+                  << "Index " << arg1 << " is not in [" << arg2 << ","
+                  << arg3 << "[");
+
   /**
    * A number is too small.
    */
@@ -896,6 +906,9 @@ namespace StandardExceptions
 #define AssertIndexRange(index,range) Assert((index) < (range), \
                                              ExcIndexRange((index),0,(range)))
 
+#define AssertGlobalIndexRange(index,range) Assert((index) < (range), \
+                                                  ExcIndexRange<types::global_dof_index>((index),0,(range)))
+
 
 /*
  * Unfortunately, the following must be repeated for each library,

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.