]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move the error check next to the checked statement. 16411/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 2 Jan 2024 23:18:34 +0000 (16:18 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 4 Jan 2024 00:23:28 +0000 (17:23 -0700)
source/lac/trilinos_vector.cc

index 8d26487152f4645a83aa3be018e0999834e98fe9..b64381447f8e84c19049e541ca7424f1788067d8 100644 (file)
@@ -657,17 +657,21 @@ namespace TrilinosWrappers
 #  endif
 
       // Now pass over the information about what we did last to the vector.
-      int ierr = 0;
       if (nonlocal_vector.get() == nullptr || mode != Add)
-        ierr = vector->GlobalAssemble(mode);
+        {
+          const auto ierr = vector->GlobalAssemble(mode);
+          AssertThrow(ierr == 0, ExcTrilinosError(ierr));
+        }
       else
         {
           Epetra_Export exporter(nonlocal_vector->Map(), vector->Map());
-          ierr = vector->Export(*nonlocal_vector, exporter, mode);
+
+          int ierr = vector->Export(*nonlocal_vector, exporter, mode);
           AssertThrow(ierr == 0, ExcTrilinosError(ierr));
+
           ierr = nonlocal_vector->PutScalar(0.);
+          AssertThrow(ierr == 0, ExcTrilinosError(ierr));
         }
-      AssertThrow(ierr == 0, ExcTrilinosError(ierr));
       last_action = Zero;
 
       compressed = true;

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.