From: Wolfgang Bangerth Date: Tue, 2 Jan 2024 23:18:34 +0000 (-0700) Subject: Move the error check next to the checked statement. X-Git-Tag: relicensing~202^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d32b4e3aad83761531ca574a0be69a90b734b92;p=dealii.git Move the error check next to the checked statement. --- diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index 8d26487152..b64381447f 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -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;