From f478032919bf046480f3ac9074d0ee78f062dc71 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 21 Apr 2005 21:28:59 +0000 Subject: [PATCH] Properly count skipped cells when next_cell is not returning the immediately 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 | 26 +++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 6bece270d3..b23d3310e5 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -407,8 +407,16 @@ void DataOut::build_some_patches (Data data) for (unsigned int i=0; (idofs->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::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::build_some_patches (Data data) (idofs->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::cell_iterator + new_cell = next_cell(cell); + if (new_cell != this->dofs->end()) + cell_number += std::distance (cell, new_cell); + cell = new_cell; } - }; + } } -- 2.39.5