From 7ecec249bbbc6ca1751e82062153ffc096ef7d3d Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 7 Jun 2021 09:38:28 -0600 Subject: [PATCH] Simplify the code that leads to an assertion. We convert integers to doubles so that we can run MPI::MinMaxAvg and then compare the min against the max. We do this comparison with a tolerance, but that is unnecessary: If the integer representations are the same, then so are the floating point representations, bit-by-bit. --- source/lac/trilinos_vector.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index 53b4a28fc1..6a72c82a5d 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -616,13 +616,14 @@ namespace TrilinosWrappers // check that every process has decided to use the same mode. This will // otherwise result in undefined behavior in the call to // GlobalAssemble(). - double double_mode = mode; + const double double_mode = mode; const Epetra_MpiComm *comm_ptr = dynamic_cast(&(trilinos_partitioner().Comm())); Assert(comm_ptr != nullptr, ExcInternalError()); - Utilities::MPI::MinMaxAvg result = + + const Utilities::MPI::MinMaxAvg result = Utilities::MPI::min_max_avg(double_mode, comm_ptr->GetMpiComm()); - Assert(result.max - result.min < 1e-5, + Assert(result.max == result.min, ExcMessage( "Not all processors agree whether the last operation on " "this vector was an addition or a set operation. This will " -- 2.39.5