]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify two functions. 7112/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 23 Aug 2018 21:21:33 +0000 (15:21 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 23 Aug 2018 21:21:33 +0000 (15:21 -0600)
These functions threw an exception in 1d, but this is not
the right place to check that condition: the assertion is currently
thrown because some other class does not implement a function. In
particular, this is about TriaAccessor<0,1>::operator++(), but that
already has the correct assertion that, if ever lifted, would
make the place that currently *also* checks the condition work
automatically.

source/grid/tria.cc

index 42190f0bb35687347b8190e91f5c1026b0738b60..5f98cf9d3fd7a30d2c58d61814d146df97451969 100644 (file)
@@ -12181,27 +12181,15 @@ template <int dim, int spacedim>
 typename Triangulation<dim, spacedim>::vertex_iterator
 Triangulation<dim, spacedim>::begin_vertex() const
 {
-  if (dim == 1)
-    {
-      // This does not work if dim==1 because TriaAccessor<0,1,spacedim> does
-      // not implement operator++
-      Assert(false, ExcNotImplemented());
-      return raw_vertex_iterator();
-    }
-  else
-    {
-      vertex_iterator i =
-        raw_vertex_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
-                            0,
-                            0);
-      if (i.state() != IteratorState::valid)
-        return i;
-      // This loop will end because every triangulation has used vertices.
-      while (i->used() == false)
-        if ((++i).state() != IteratorState::valid)
-          return i;
+  vertex_iterator i =
+    raw_vertex_iterator(const_cast<Triangulation<dim, spacedim> *>(this), 0, 0);
+  if (i.state() != IteratorState::valid)
+    return i;
+  // This loop will end because every triangulation has used vertices.
+  while (i->used() == false)
+    if ((++i).state() != IteratorState::valid)
       return i;
-    }
+  return i;
 }
 
 
@@ -12210,6 +12198,7 @@ template <int dim, int spacedim>
 typename Triangulation<dim, spacedim>::active_vertex_iterator
 Triangulation<dim, spacedim>::begin_active_vertex() const
 {
+  // every vertex is active
   return begin_vertex();
 }
 
@@ -12219,15 +12208,9 @@ template <int dim, int spacedim>
 typename Triangulation<dim, spacedim>::vertex_iterator
 Triangulation<dim, spacedim>::end_vertex() const
 {
-  if (dim == 1)
-    {
-      Assert(false, ExcNotImplemented());
-      return raw_vertex_iterator();
-    }
-  else
-    return raw_vertex_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
-                               -1,
-                               numbers::invalid_unsigned_int);
+  return raw_vertex_iterator(const_cast<Triangulation<dim, spacedim> *>(this),
+                             -1,
+                             numbers::invalid_unsigned_int);
 }
 
 

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.