From 1755ecf99ab8be0526d331d318761afed94b68c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org> Date: Sun, 9 Jun 2024 17:13:06 +0200 Subject: [PATCH] Simplify conditions to not test "== true" or "== false" Use the left-hand side as a condition --- dune/istl/novlpschwarz.hh | 6 +++--- dune/istl/owneroverlapcopy.hh | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dune/istl/novlpschwarz.hh b/dune/istl/novlpschwarz.hh index bf2f2ce2d..61d975521 100644 --- a/dune/istl/novlpschwarz.hh +++ b/dune/istl/novlpschwarz.hh @@ -132,7 +132,7 @@ namespace Dune { // at the beginning make a multimap "bordercontribution". // process has i and j as border dofs but is not the owner // => only contribute to Ax if i,j is in bordercontribution - if (buildcomm == true) { + if (buildcomm) { // set up mask vector if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) { @@ -188,7 +188,7 @@ namespace Dune { flag = false; continue; } - if (flag == false) + if (!flag) continue; } // don´t contribute to Ax if @@ -198,7 +198,7 @@ namespace Dune { // as interor/border dofs // if the owner of j does not have i as interior/border dof, // it will not be taken into account - if (flag==true) + if (flag) bordercontribution.insert(std::pair<int,int>(i.index(),j.index())); } } diff --git a/dune/istl/owneroverlapcopy.hh b/dune/istl/owneroverlapcopy.hh index 64ec00d48..ebd274502 100644 --- a/dune/istl/owneroverlapcopy.hh +++ b/dune/istl/owneroverlapcopy.hh @@ -656,17 +656,17 @@ namespace Dune { if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free(); if (CopyToAllInterfaceBuilt) CopyToAllInterface.free(); if (globalLookup_) delete globalLookup_; - if (freecomm==true) - if(comm!=MPI_COMM_NULL) - { - // If it is possible to query whether MPI_Finalize - // was called, only free the communicator before - // calling MPI_Finalize. - int wasFinalized = 0; - MPI_Finalized( &wasFinalized ); - if(!wasFinalized) - MPI_Comm_free(&comm); + if (freecomm && (comm != MPI_COMM_NULL)) + { + // If it is possible to query whether MPI_Finalize + // was called, only free the communicator before + // calling MPI_Finalize. + int wasFinalized = 0; + MPI_Finalized(&wasFinalized); + if (!wasFinalized) { + MPI_Comm_free(&comm); } + } } private: -- GitLab