]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix generation of neighbor information for 1d as well.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 4 Jan 2002 13:03:13 +0000 (13:03 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 4 Jan 2002 13:03:13 +0000 (13:03 +0000)
git-svn-id: https://svn.dealii.org/trunk@5345 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/numerics/data_out.cc

index 84cbcc1a5525020474b913dbcfae58c335cbdc74..8035bd65c80634df454738f7e150f0326f3eaee1 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -535,37 +535,55 @@ void DataOut<dim>::build_patches (const unsigned int n_subdivisions,
                                   // First, number patches
                                   // consecutively.
   unsigned int patch_no = 0;
-  typename std::vector<typename DataOutBase::Patch<dim> >::iterator patch;
-  for (patch = patches.begin(); patch != patches.end(); ++patch)
+  for (typename std::vector<typename DataOutBase::Patch<dim> >::iterator
+        patch = patches.begin(); patch != patches.end(); ++patch)
     patch->me = patch_no++;
 
                                   // Traverse the map of cells
                                   // created in build_some_patches
                                   // and enter numbers of neighboring
                                   // patches on the same level.
-  typename PatchMap::iterator map_entry;
-  for (map_entry = patch_map.begin(); map_entry != patch_map.end(); ++map_entry)
+  for (typename PatchMap::iterator map_entry = patch_map.begin();
+       map_entry != patch_map.end();
+       ++map_entry)
     {
-      typename DoFHandler<dim>::cell_iterator cell = map_entry->first;
-      patch = map_entry->second;
-
+      const typename DoFHandler<dim>::cell_iterator
+       cell = map_entry->first;
+      const typename std::vector<typename DataOutBase::Patch<dim> >::iterator
+       patch = map_entry->second;
+
+                                      // loop over all faces and see
+                                      // whether there's a cell
+                                      // behind that for which we
+                                      // need to set neighbor
+                                      // information
       for (unsigned int i=0;i<GeometryInfo<dim>::faces_per_cell;++i)
        {
-         if (cell->at_boundary(i))
-           continue;
-         typename DoFHandler<dim>::cell_iterator
-           neighbor = cell->neighbor(i);
-         if (cell->level() != neighbor->level())
-           continue;
-         typename PatchMap::iterator
-           neighbor_entry = patch_map.find(neighbor);
-         if (neighbor_entry == patch_map.end())
+                                          // we can't do anything if
+                                          // - there is no neighbor
+                                          // - the neighbor is coarser
+                                          // - or the cell behind the
+                                          //   face is refined, i.e. is
+                                          //   not inserted into the map
+         if (cell->at_boundary(i) ||
+             (cell->level() != cell->neighbor(i)->level()) ||
+             (patch_map.find(cell->neighbor(i)) == patch_map.end()))
            continue;
-         typename std::vector<typename DataOutBase::Patch<dim> >::iterator
-           neighbor_patch = neighbor_entry->second;
-         
+
+                                          // if there is a neighbor,
+                                          // get its patch...
+         const typename
+           std::vector<typename DataOutBase::Patch<dim> >::iterator
+           neighbor_patch = patch_map.find(cell->neighbor(i))->second;
+                                          // ...and set its neighbor
+                                          // pointer set
+//TODO:[GK] Shouldn't we use the deal.II (i.e. the unnatural) numbering of the neighbors here as well rather than some new numbering scheme?
          switch (dim)
            {
+             case 1:
+                   patch->neighbors[i] = neighbor_patch->me;
+                   break;
+                   
              case 2:
                switch (i)
                  {
@@ -586,6 +604,7 @@ void DataOut<dim>::build_patches (const unsigned int n_subdivisions,
                    case 5: patch->neighbors[0] = neighbor_patch->me; break;
                  }
                break;
+
              default:
                Assert(false, ExcNotImplemented());
            }

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.