From: Wolfgang Bangerth Date: Mon, 7 Jun 2021 15:38:28 +0000 (-0600) Subject: Simplify the code that leads to an assertion. X-Git-Tag: v9.4.0-rc1~1264^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ecec249bbbc6ca1751e82062153ffc096ef7d3d;p=dealii.git 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. --- 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 "