]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make sure it is possible to create default-constructed objects of type Triangulation...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 9 Apr 2013 19:11:44 +0000 (19:11 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 9 Apr 2013 19:11:44 +0000 (19:11 +0000)
git-svn-id: https://svn.dealii.org/trunk@29227 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/grid/tria_accessor.templates.h

index 87eec9623a470d3c018674de7e0da9e50fe6bb4d..5379e3a5af5ffe0f18f2777210bfca1941f30bf5 100644 (file)
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------------------
 //    $Id$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -2042,16 +2042,22 @@ TriaAccessor (const Triangulation<1,spacedim> *tria,
 template <int spacedim>
 inline
 TriaAccessor<0, 1, spacedim>::
-TriaAccessor (const Triangulation<1,spacedim> *,
-              const int,
-              const int,
+TriaAccessor (const Triangulation<1,spacedim> *tria,
+              const int level,
+              const int index,
               const AccessorData *)
   :
-  tria (0),
+  tria (tria),
   vertex_kind (interior_vertex),
   global_vertex_index (numbers::invalid_unsigned_int)
 {
-  Assert (false, ExcInternalError());
+  // in general, calling this constructor should yield an error -- users should
+  // instead call the one immediately above. however, if you create something
+  // like Triangulation<1>::face_iterator() then this calls the default constructor
+  // of the iterator which calls the accessor with argument list (0,-2,-2,0), so
+  // in this particular case accept this call and create an object that corresponds
+  // to the default constructed (invalid) vertex accessor
+  Assert ((level == -2) && (index == -2), ExcInternalError());
 }
 
 

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.