Skip to content
Snippets Groups Projects
Commit 1755ecf9 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Simplify conditions to not test "== true" or "== false"

Use the left-hand side as a condition
parent 610d2ee9
No related branches found
No related tags found
1 merge request!569Fix some issues found by Clazy, Cppcheck, and myself
Pipeline #71504 passed
...@@ -132,7 +132,7 @@ namespace Dune { ...@@ -132,7 +132,7 @@ namespace Dune {
// at the beginning make a multimap "bordercontribution". // at the beginning make a multimap "bordercontribution".
// process has i and j as border dofs but is not the owner // process has i and j as border dofs but is not the owner
// => only contribute to Ax if i,j is in bordercontribution // => only contribute to Ax if i,j is in bordercontribution
if (buildcomm == true) { if (buildcomm) {
// set up mask vector // set up mask vector
if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) { if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size())) {
...@@ -188,7 +188,7 @@ namespace Dune { ...@@ -188,7 +188,7 @@ namespace Dune {
flag = false; flag = false;
continue; continue;
} }
if (flag == false) if (!flag)
continue; continue;
} }
// don´t contribute to Ax if // don´t contribute to Ax if
...@@ -198,7 +198,7 @@ namespace Dune { ...@@ -198,7 +198,7 @@ namespace Dune {
// as interor/border dofs // as interor/border dofs
// if the owner of j does not have i as interior/border dof, // if the owner of j does not have i as interior/border dof,
// it will not be taken into account // it will not be taken into account
if (flag==true) if (flag)
bordercontribution.insert(std::pair<int,int>(i.index(),j.index())); bordercontribution.insert(std::pair<int,int>(i.index(),j.index()));
} }
} }
......
...@@ -656,17 +656,17 @@ namespace Dune { ...@@ -656,17 +656,17 @@ namespace Dune {
if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free(); if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free();
if (CopyToAllInterfaceBuilt) CopyToAllInterface.free(); if (CopyToAllInterfaceBuilt) CopyToAllInterface.free();
if (globalLookup_) delete globalLookup_; if (globalLookup_) delete globalLookup_;
if (freecomm==true) if (freecomm && (comm != MPI_COMM_NULL))
if(comm!=MPI_COMM_NULL) {
{ // If it is possible to query whether MPI_Finalize
// If it is possible to query whether MPI_Finalize // was called, only free the communicator before
// was called, only free the communicator before // calling MPI_Finalize.
// calling MPI_Finalize. int wasFinalized = 0;
int wasFinalized = 0; MPI_Finalized(&wasFinalized);
MPI_Finalized( &wasFinalized ); if (!wasFinalized) {
if(!wasFinalized) MPI_Comm_free(&comm);
MPI_Comm_free(&comm);
} }
}
} }
private: private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment