]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Correct a condition. 16352/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 15 Dec 2023 05:48:10 +0000 (22:48 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Fri, 15 Dec 2023 05:49:37 +0000 (22:49 -0700)
include/deal.II/lac/sparse_matrix_tools.h

index c4832c3107b84fbe72c6779a2722701865f5effb..f5002984e8f7a4bf09b96c529ff5b10138dd9254 100644 (file)
@@ -151,23 +151,25 @@ namespace SparseMatrixTools
       (void)comm;
       return {0, value};
 #  else
-      if (comm == MPI_COMM_SELF)
-        return {0, value}; // serial triangulation
-
-      T prefix = {};
+      if (Utilities::MPI::n_mpi_processes(comm) == 1)
+        return {0, value};
+      else
+        {
+          T prefix = {};
 
-      int ierr =
-        MPI_Exscan(&value,
-                   &prefix,
-                   1,
-                   Utilities::MPI::mpi_type_id_for_type<decltype(value)>,
-                   MPI_SUM,
-                   comm);
-      AssertThrowMPI(ierr);
+          int ierr =
+            MPI_Exscan(&value,
+                       &prefix,
+                       1,
+                       Utilities::MPI::mpi_type_id_for_type<decltype(value)>,
+                       MPI_SUM,
+                       comm);
+          AssertThrowMPI(ierr);
 
-      T sum = Utilities::MPI::sum(value, comm);
+          T sum = Utilities::MPI::sum(value, comm);
 
-      return {prefix, sum};
+          return {prefix, sum};
+        }
 #  endif
     }
 

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.