From 27dfcb46af0c24c4348671f705576b1a88898f98 Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Tue, 15 Oct 2013 20:28:36 +0000 Subject: [PATCH] Modify data_out.cc to copy the patches in parrallel. git-svn-id: https://svn.dealii.org/trunk@31243 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/numerics/data_out.h | 3 ++- deal.II/source/numerics/data_out.cc | 26 ++++++++++----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/deal.II/include/deal.II/numerics/data_out.h b/deal.II/include/deal.II/numerics/data_out.h index 7dfe9c9bd4..961fed7c20 100644 --- a/deal.II/include/deal.II/numerics/data_out.h +++ b/deal.II/include/deal.II/numerics/data_out.h @@ -253,7 +253,8 @@ private: void build_one_patch (const std::pair *cell_and_index, internal::DataOut::ParallelData &data, ::dealii::DataOutBase::Patch &patch, - const CurvedCellRegion curved_cell_region); + const CurvedCellRegion curved_cell_region, + std::vector > &patches); }; diff --git a/deal.II/source/numerics/data_out.cc b/deal.II/source/numerics/data_out.cc index 03e0cce91a..eeef590696 100644 --- a/deal.II/source/numerics/data_out.cc +++ b/deal.II/source/numerics/data_out.cc @@ -59,17 +59,11 @@ namespace internal /** - * In a WorkStream context, use this function to append the patch computed - * by the parallel stage to the array of patches. + * Dummy function used for WorkStream. */ template void - append_patch_to_list (const DataOutBase::Patch &patch, - std::vector > &patches) - { - patches.push_back (patch); - patches.back().patch_index = patches.size()-1; - } + copy(const DataOutBase::Patch &patch) {} } } @@ -81,7 +75,8 @@ DataOut:: build_one_patch (const std::pair *cell_and_index, internal::DataOut::ParallelData &data, DataOutBase::Patch &patch, - const CurvedCellRegion curved_cell_region) + const CurvedCellRegion curved_cell_region, + std::vector > &patches) { // use ucd_to_deal map as patch vertices are in the old, unnatural // ordering. if the mapping does not preserve locations @@ -306,6 +301,10 @@ build_one_patch (const std::pair *cell_and_index, patch.neighbors[f] = (*data.cell_to_patch_index_map)[neighbor->level()][neighbor->index()]; } + + // Put the patch in the patches vector + patches[cell_and_index->second] = patch; + patches[cell_and_index->second].patch_index = cell_and_index->second; } @@ -398,8 +397,7 @@ void DataOut::build_patches (const Mappingpatches.clear (); - this->patches.reserve (all_cells.size()); - Assert (this->patches.size() == 0, ExcInternalError()); + this->patches.resize(all_cells.size()); // now create a default object for the WorkStream object to work with unsigned int n_datasets=this->cell_data.size(); @@ -449,9 +447,9 @@ void DataOut::build_patches (const Mapping::build_one_patch, *this, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, - curved_cell_region), - std_cxx1x::bind(&internal::DataOut::append_patch_to_list, - std_cxx1x::_1, std_cxx1x::ref(this->patches)), + curved_cell_region,std_cxx1x::ref(this->patches)), + std_cxx1x::bind(&internal::DataOut::copy, + std_cxx1x::_1), thread_data, sample_patch); } -- 2.39.5