From 0d32b4e3aad83761531ca574a0be69a90b734b92 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 2 Jan 2024 16:18:34 -0700 Subject: [PATCH] Move the error check next to the checked statement. --- source/lac/trilinos_vector.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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; -- 2.39.5