From: Wolfgang Bangerth Date: Thu, 5 Nov 2009 21:48:15 +0000 (+0000) Subject: Fix a problem when overloading first_cell/next_cell and giving cell data. X-Git-Tag: v8.0.0~6848 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c9f84756966583a35ab846cbde7dcdcfe2c0e7c;p=dealii.git Fix a problem when overloading first_cell/next_cell and giving cell data. git-svn-id: https://svn.dealii.org/trunk@20044 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 2cc094ccfe..68e0793ed0 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -961,9 +961,20 @@ void DataOut::build_patches (const Mapping > all_cells; { - unsigned int index = 0; + // set the index of the first + // cell. if first_cell/next_cell + // returns non-active cells, then + // the index is not usable + // anyway, but otherwise we + // should keep track where we are + unsigned int index; + if (first_cell()->has_children()) + index = 0; + else + index = std::distance (this->dofs->begin_active(), + active_cell_iterator(first_cell())); for (cell_iterator cell=first_cell(); cell != this->dofs->end(); - cell = next_cell(cell), ++index) + cell = next_cell(cell)) { Assert (static_cast(cell->level()) < cell_to_patch_index_map.size(), @@ -975,6 +986,23 @@ void DataOut::build_patches (const Mappinglevel()][cell->index()] = all_cells.size(); all_cells.push_back (std::make_pair(cell, index)); + + // if both this and the next + // cell are active, then + // increment the index that + // keeps track on which + // active cell we are sitting + // correctly. if one of the + // cells is not active, then + // this index doesn't mean + // anything anyway, so just + // ignore it. same if we are + // at the end of the range + if (!cell->has_children() && + next_cell(cell) != this->dofs->end() && + !next_cell(cell)->has_children()) + index += std::distance (active_cell_iterator(cell), + active_cell_iterator(next_cell(cell))); } } diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 841f5e1fa4..c2df68f6ae 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -511,6 +511,15 @@ inconvenience this causes.

deal.II

    +
  1. +

    + Fixed: The function DataOut class got confused when its DataOut::first_cell() and + DataOut::next_cell() were overloaded and cell data was given. This is now fixed. +
    + (Wolfgang Bangerth 2009/11/05) +

    +
  2. +
  3. New: The function DoFRenumbering::component_wise is now also implemented