]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify the code that leads to an assertion. 12394/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 7 Jun 2021 15:38:28 +0000 (09:38 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 7 Jun 2021 17:06:22 +0000 (11:06 -0600)
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

index 53b4a28fc1948bdd483c7cc47727340d3be79924..6a72c82a5d5a230f03ba52b5f53edefe0243ceba 100644 (file)
@@ -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<const Epetra_MpiComm *>(&(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 "

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.