From d54ab095aa253d3128475d81cbc0cceefd9481b6 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 21 Apr 2005 22:20:37 +0000 Subject: [PATCH] All approaches before were conceptually broken. Do it differently. git-svn-id: https://svn.dealii.org/trunk@10562 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/numerics/data_out.cc | 71 ++++++++------------- 1 file changed, 25 insertions(+), 46 deletions(-) diff --git a/deal.II/deal.II/source/numerics/data_out.cc b/deal.II/deal.II/source/numerics/data_out.cc index 5e4f102b12..8e081e7c5c 100644 --- a/deal.II/deal.II/source/numerics/data_out.cc +++ b/deal.II/deal.II/source/numerics/data_out.cc @@ -399,37 +399,14 @@ void DataOut::build_some_patches (Data data) const unsigned int n_q_points = patch_points.n_quadrature_points; - unsigned int cell_number = 0; typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); - typename DoFHandler::cell_iterator cell = this->dofs->begin(); - - // count how many cells were skipped at the - // beginning - { - const typename DoFHandler::cell_iterator first_cell = this->first_cell(); - while (cell != first_cell) - { - ++cell; - ++cell_number; - } - } + typename DoFHandler::cell_iterator cell = first_cell(); // get first cell in this thread for (unsigned int i=0; (idofs->end()); ++i) { ++patch; - - // 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); - while (cell != new_cell) - { - ++cell; - ++cell_number; - } + ++cell; } // now loop over all cells and @@ -470,15 +447,28 @@ void DataOut::build_some_patches (Data data) }; }; - // then do the cell data - for (unsigned int dataset=0; datasetcell_data.size(); ++dataset) - { - const double value - = this->cell_data[dataset]->get_cell_data_value (cell_number); - for (unsigned int q=0; qdata(dataset+this->dof_data.size()*data.n_components,q) = - value; - } + // then do the cell data. only + // compute the number of a cell if + // needed; also make sure that we + // only access cell data if the + // first_cell/next_cell functions + // only return active cells + if (this->cell_data.size() != 0) + { + Assert (!cell->has_children(), ExcNotImplemented()); + const unsigned int cell_number + = std::distance (this->dofs->begin_active(), + typename DoFHandler::active_cell_iterator(cell)); + + for (unsigned int dataset=0; datasetcell_data.size(); ++dataset) + { + const double value + = this->cell_data[dataset]->get_cell_data_value (cell_number); + for (unsigned int q=0; qdata(dataset+this->dof_data.size()*data.n_components,q) = + value; + } + } } // now fill the neighbors fields @@ -577,18 +567,7 @@ void DataOut::build_some_patches (Data data) (idofs->end()); ++i) { ++patch; - - // 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); - while (cell != new_cell) - { - ++cell; - ++cell_number; - } + cell = next_cell(cell); } } } -- 2.39.5