Skip to content
Snippets Groups Projects
Commit 55b8ee3b authored by mattijs's avatar mattijs
Browse files

ENH: zone.C: added check for duplicate entry in zone

parent 8f8d7b1f
Branches
Tags
No related merge requests found
......@@ -26,6 +26,7 @@ License
#include "zone.H"
#include "IOstream.H"
#include "demandDrivenData.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -192,6 +193,9 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
bool hasError = false;
// To check for duplicate entries
labelHashSet elems(size());
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= maxSize)
......@@ -215,6 +219,18 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
break;
}
}
else if (!elems.insert(addr[i]))
{
if (report)
{
WarningIn
(
"bool zone::checkDefinition("
"const label maxSize, const bool report) const"
) << "Zone " << name_
<< " contains duplicate index label " << addr[i] << endl;
}
}
}
return hasError;
......
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