]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify control flow.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 5 Jan 2015 15:19:53 +0000 (09:19 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 9 Jan 2015 06:56:08 +0000 (00:56 -0600)
source/base/mpi.cc

index 2680c3272a34834cf83cf2fed0aa72a3e4c196d4..e0d65cd1a154c1fe833afa38f443cde7b8eac78c 100644 (file)
@@ -501,8 +501,6 @@ namespace Utilities
       // when running PETSc, because we initialize MPI ourselves before calling
       // PetscInitialize
 #ifdef DEAL_II_WITH_MPI
-      int mpi_err = 0;
-
       int MPI_has_been_started = 0;
       MPI_Initialized(&MPI_has_been_started);
       if (Utilities::System::job_supports_mpi() == true &&
@@ -516,12 +514,12 @@ namespace Utilities
                         << std::endl;
             }
           else
-            mpi_err = MPI_Finalize();
+            {
+              const int mpi_err = MPI_Finalize();
+              AssertThrow (mpi_err == 0,
+                           ExcMessage ("An error occurred while calling MPI_Finalize()"));
+            }
         }
-
-
-      AssertThrow (mpi_err == 0,
-                   ExcMessage ("An error occurred while calling MPI_Finalize()"));
 #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.