]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
When codim=1, we can't take for granted that the left neighbor of the right neighbor...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Dec 2010 13:46:23 +0000 (13:46 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 7 Dec 2010 13:46:23 +0000 (13:46 +0000)
git-svn-id: https://svn.dealii.org/trunk@22937 0785d39b-7218-0410-832d-ea1e28bc413d

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

index e9068436acec3ce4c01781a8bca43d4feab1d13a..6b95623667b2f7264d1ca8f0cf2a0e06b4f2d749 100644 (file)
@@ -2832,19 +2832,14 @@ inline
 unsigned int
 CellAccessor<dim,spacedim>::neighbor_face_no (const unsigned int neighbor) const
 {
-  if (dim==1)
-    return neighbor_of_neighbor(neighbor);
+  const unsigned int n2=neighbor_of_neighbor_internal(neighbor);
+  if (n2!=numbers::invalid_unsigned_int)
+                                    // return this value as the
+                                    // neighbor is not coarser
+    return n2;
   else
-    {
-      const unsigned int n2=neighbor_of_neighbor_internal(neighbor);
-      if (n2!=numbers::invalid_unsigned_int)
-                                        // return this value as the
-                                        // neighbor is not coarser
-       return n2;
-      else
-                                        // the neighbor is coarser
-       return neighbor_of_coarser_neighbor(neighbor).first;
-    }
+                                    // the neighbor is coarser
+    return neighbor_of_coarser_neighbor(neighbor).first;
 }
 
 DEAL_II_NAMESPACE_CLOSE
index 376c94744fc9e6362fc5a47e839e26e70fb08c5e..00b028184c5f3dddd097f350628ac2a2627be6ac 100644 (file)
@@ -1322,7 +1322,16 @@ unsigned int CellAccessor<dim,spacedim>::neighbor_of_neighbor_internal (const un
 {
   AssertIndexRange (neighbor, GeometryInfo<dim>::faces_per_cell);
 
-  if (dim==1)
+                                  // if we have a 1d mesh in 1d, we
+                                  // can assume that the left
+                                  // neighbor of the right neigbor is
+                                  // the current cell. but that is an
+                                  // invariant that isn't true if the
+                                  // mesh is embedded in a higher
+                                  // dimensional space, so we have to
+                                  // fall back onto the generic code
+                                  // below
+  if ((dim==1) && (spacedim==dim))
     return GeometryInfo<dim>::opposite_face[neighbor];
 
   const TriaIterator<CellAccessor<dim, spacedim> > neighbor_cell = this->neighbor(neighbor);
@@ -1375,7 +1384,8 @@ template <int dim, int spacedim>
 unsigned int CellAccessor<dim,spacedim>::neighbor_of_neighbor (const unsigned int neighbor) const
 {
   const unsigned int n2=neighbor_of_neighbor_internal(neighbor);
-  Assert (n2!=numbers::invalid_unsigned_int, TriaAccessorExceptions::ExcNeighborIsCoarser());
+  Assert (n2!=numbers::invalid_unsigned_int,
+         TriaAccessorExceptions::ExcNeighborIsCoarser());
 
   return n2;
 }

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.