]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Properly count skipped cells when next_cell is not returning the immediately
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Apr 2005 21:28:59 +0000 (21:28 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 21 Apr 2005 21:28:59 +0000 (21:28 +0000)
next cell.

git-svn-id: https://svn.dealii.org/trunk@10558 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 6bece270d34408e86f9e09d370cffced05102225..b23d3310e5e0655dda0ddbc37a82fed1ff677024 100644 (file)
@@ -407,8 +407,16 @@ void DataOut<dim>::build_some_patches (Data data)
   for (unsigned int i=0; (i<data.this_thread)&&(cell != this->dofs->end()); ++i)
     {
       ++patch;
-      ++cell_number;
-      cell=next_cell(cell);
+
+                                       // move to next cell and update
+                                       // cell_number making sure that we also
+                                       // count those cells that next_cell may
+                                       // have skipped
+      const typename DoFHandler<dim>::cell_iterator
+        new_cell = next_cell(cell);
+      if (new_cell != this->dofs->end())
+        cell_number += std::distance (cell, new_cell);
+      cell = new_cell;
     }
 
                                   // now loop over all cells and
@@ -556,10 +564,18 @@ void DataOut<dim>::build_some_patches (Data data)
           (i<data.n_threads)&&(cell != this->dofs->end()); ++i)
        {
          ++patch;
-         ++cell_number;
-         cell=next_cell(cell);
+
+                                           // move to next cell and update
+                                           // cell_number making sure that we also
+                                           // count those cells that next_cell may
+                                           // have skipped
+          const typename DoFHandler<dim>::cell_iterator
+            new_cell = next_cell(cell);
+          if (new_cell != this->dofs->end())
+            cell_number += std::distance (cell, new_cell);
+          cell = new_cell;
        }
-    };
+    }
 }
 
 

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.