]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add more static asserts for sensible template parameters 3622/head
authorKarl Ljungkvist <k.ljungkvist@gmail.com>
Tue, 22 Nov 2016 15:06:14 +0000 (16:06 +0100)
committerKarl Ljungkvist <k.ljungkvist@gmail.com>
Mon, 28 Nov 2016 07:30:26 +0000 (08:30 +0100)
include/deal.II/fe/fe.h
include/deal.II/grid/tria.h

index 77732571df76c288a91382e4016006398f95e77d..5f54f946138984fee600fcb522e07145a7994c18 100644 (file)
@@ -2721,6 +2721,14 @@ protected:
   friend class FEFaceValues<dim,spacedim>;
   friend class FESubfaceValues<dim,spacedim>;
   friend class FESystem<dim,spacedim>;
+
+  // explicitly check for sensible template arguments
+#ifdef DEAL_II_WITH_CXX11
+  static_assert (dim<=spacedim,
+                 "The dimension <dim> of a FiniteElement must be less than or "
+                 "equal to the space dimension <spacedim> in which it lives.");
+#endif
+
 };
 
 
index 9ba7656484ee47d35411807cd1962a41fbd24ea1..096c6554d2e66ed74fcf544f04ad67c23b27e5c5 100644 (file)
@@ -3454,6 +3454,14 @@ private:
 
   template <typename>
   friend class dealii::internal::Triangulation::TriaObjects;
+
+  // explicitly check for sensible template arguments
+#ifdef DEAL_II_WITH_CXX11
+  static_assert (dim<=spacedim,
+                 "The dimension <dim> of a Triangulation must be less than or "
+                 "equal to the space dimension <spacedim> in which it lives.");
+#endif
+
 };
 
 

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.