From: Martin Kronbichler Date: Fri, 7 Jun 2013 13:32:23 +0000 (+0000) Subject: Make comparison of ghost values in compress(VectorOperation::insert) safer. X-Git-Tag: v8.0.0~301 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35c7e6719301744fbc333fd5296fbb32ae113174;p=dealii.git Make comparison of ghost values in compress(VectorOperation::insert) safer. git-svn-id: https://svn.dealii.org/trunk@29795 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/parallel_vector.templates.h b/deal.II/include/deal.II/lac/parallel_vector.templates.h index c78dee5259..f59100d4a8 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.templates.h +++ b/deal.II/include/deal.II/lac/parallel_vector.templates.h @@ -204,7 +204,9 @@ namespace parallel // nothing to do for insert (only need to zero ghost entries in // compress_finish(). in debug mode we still want to check consistency // of the inserted data, therefore the communication is still - // initialized + // initialized. Having different code in debug and optimized mode is + // somewhat dangerous, but it really saves communication so it seems + // still worthwhile. #ifndef DEBUG if (operation == VectorOperation::insert) return; @@ -295,6 +297,16 @@ namespace parallel { #ifdef DEAL_II_WITH_MPI + // in optimized mode, no communication was started, so leave the + // function directly (and only clear ghosts) +#ifndef DEBUG + if (operation == VectorOperation::insert) + { + zero_out_ghosts(); + return; + } +#endif + const Utilities::MPI::Partitioner &part = *partitioner; // nothing to do when we neither have import @@ -338,7 +350,7 @@ namespace parallel j++, read_position++) Assert(*read_position == 0. || std::abs(local_element(j) - *read_position) < - std::abs(local_element(j)) * 100. * + std::abs(local_element(j)) * 1000. * std::numeric_limits::epsilon(), ExcMessage("Inserted elements do not match.")); AssertDimension(read_position-import_data,part.n_import_indices());