Commit 29bcf92a authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Kilian Weishaupt
Browse files

[boundarytypes] Use std::any_of instead of for loops

parent 2e8c4152
......@@ -255,10 +255,10 @@ public:
*/
bool hasDirichlet() const
{
for (int i = 0; i < numEq; ++i)
if (boundaryInfo_[i].isDirichlet)
return true;
return false;
return std::any_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isDirichlet; }
);
}
/*!
......@@ -288,10 +288,10 @@ public:
*/
bool hasNeumann() const
{
for (int i = 0; i < numEq; ++i)
if (boundaryInfo_[i].isNeumann)
return true;
return false;
return std::any_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isNeumann; }
);
}
/*!
......@@ -309,10 +309,10 @@ public:
*/
bool hasOutflow() const
{
for (int i = 0; i < numEq; ++i)
if (boundaryInfo_[i].isOutflow)
return true;
return false;
return std::any_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isOutflow; }
);
}
/*!
......@@ -330,10 +330,10 @@ public:
*/
bool hasCouplingDirichlet() const
{
for (int i = 0; i < numEq; ++i)
if (boundaryInfo_[i].isCouplingDirichlet)
return true;
return false;
return std::any_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isCouplingDirichlet; }
);
}
/*!
......@@ -351,10 +351,10 @@ public:
*/
bool hasCouplingNeumann() const
{
for (int i = 0; i < numEq; ++i)
if (boundaryInfo_[i].isCouplingNeumann)
return true;
return false;
return std::any_of(boundaryInfo_.begin(),
boundaryInfo_.end(),
[](const BoundaryInfo& b){ return b.isCouplingNeumann; }
);
}
/*!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment