]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a couple more static assertions. 3637/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 24 Nov 2016 18:48:37 +0000 (11:48 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Sat, 26 Nov 2016 03:11:33 +0000 (20:11 -0700)
include/deal.II/grid/manifold.h

index a1fda6dfb23c7a68afe3e7b37a6ce0fccdee1495..8e97d71509655dcb353e8fccf8e963c0fb19bfa9 100644 (file)
@@ -298,6 +298,14 @@ class Manifold : public Subscriptor
 {
 public:
 
+  // explicitly check for sensible template arguments
+#ifdef DEAL_II_WITH_CXX11
+  static_assert (dim<=spacedim,
+                 "The dimension <dim> of a Manifold must be less than or "
+                 "equal to the space dimension <spacedim> in which it lives.");
+#endif
+
+
   /**
    * Type keeping information about the normals at the vertices of a face of a
    * cell. Thus, there are <tt>GeometryInfo<dim>::vertices_per_face</tt>
@@ -879,6 +887,13 @@ template <int dim, int spacedim=dim, int chartdim=dim>
 class ChartManifold : public Manifold<dim,spacedim>
 {
 public:
+  // explicitly check for sensible template arguments
+#ifdef DEAL_II_WITH_CXX11
+  static_assert (dim<=spacedim,
+                 "The dimension <dim> of a ChartManifold must be less than or "
+                 "equal to the space dimension <spacedim> in which it lives.");
+#endif
+
   /**
    * Constructor. The optional argument can be used to specify the periodicity
    * of the chartdim-dimensional manifold (one period per direction). A

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.