]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a bunch of assertions to kill invalid behavior as early as possible (currently...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 30 Oct 2012 13:05:57 +0000 (13:05 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 30 Oct 2012 13:05:57 +0000 (13:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@27234 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/dofs/dof_accessor.templates.h

index cefac603cc35b427951e6209697664cd3866093f..9dd7fc8122bd06847af4b676b71962343eccf3d0 100644 (file)
@@ -1477,6 +1477,11 @@ inline
 unsigned int
 DoFAccessor<dim,DH>::n_active_fe_indices () const
 {
+  if (dim == DH::dimension)
+    Assert (this->active(),
+           ExcMessage ("You can't query information about active FE indices on "
+                       "cells that have children and are therefore not active."));
+
                                    // access the respective DoF
   return
     dealii::internal::DoFAccessor::Implementation::
@@ -1493,6 +1498,11 @@ inline
 unsigned int
 DoFAccessor<dim,DH>::nth_active_fe_index (const unsigned int n) const
 {
+  if (dim == DH::dimension)
+    Assert (this->active(),
+           ExcMessage ("You can't query information about active FE indices on "
+                       "cells that have children and are therefore not active."));
+
                                    // access the respective DoF
   return
     dealii::internal::DoFAccessor::Implementation::
@@ -1510,6 +1520,11 @@ inline
 bool
 DoFAccessor<dim,DH>::fe_index_is_active (const unsigned int fe_index) const
 {
+  if (dim == DH::dimension)
+    Assert (this->active(),
+           ExcMessage ("You can't query information about active FE indices on "
+                       "cells that have children and are therefore not active."));
+
                                    // access the respective DoF
   return
     dealii::internal::DoFAccessor::Implementation::
@@ -3299,6 +3314,10 @@ inline
 unsigned int
 DoFCellAccessor<DH>::active_fe_index () const
 {
+  Assert (this->active(),
+         ExcMessage ("You can't query information about active FE indices on "
+                     "cells that have children and are therefore not active."));
+
   return dealii::internal::DoFCellAccessor::Implementation::active_fe_index (*this);
 }
 
@@ -3309,6 +3328,10 @@ inline
 void
 DoFCellAccessor<DH>::set_active_fe_index (const unsigned int i)
 {
+  Assert (this->active(),
+         ExcMessage ("You can't query information about active FE indices on "
+                     "cells that have children and are therefore not active."));
+
   dealii::internal::DoFCellAccessor::Implementation::set_active_fe_index (*this, i);
 }
 

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.