From 3cc805b2137b1d967952a887cdd56cf942277cb6 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Fri, 7 Jun 2013 13:32:23 +0000 Subject: [PATCH] Make comparison of ghost values in compress(VectorOperation::insert) safer. git-svn-id: https://svn.dealii.org/trunk@29795 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/lac/parallel_vector.templates.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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()); -- 2.39.5