Commit 9a2ccb7a authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

isLocal check incorrect

parent 09f5d38f
...@@ -53,14 +53,9 @@ inline Foam::label Foam::globalIndex::toGlobal(const label i) const ...@@ -53,14 +53,9 @@ inline Foam::label Foam::globalIndex::toGlobal(const label i) const
//- Is on local processor //- Is on local processor
inline bool Foam::globalIndex::isLocal(const label i) const inline bool Foam::globalIndex::isLocal(const label i) const
{ {
label localI = return
( (i < offsets_[Pstream::myProcNo()])
Pstream::myProcNo() == 0 && (i >= (Pstream::myProcNo() == 0 ? 0 : offsets_[Pstream::myProcNo()-1]));
? i
: i - offsets_[Pstream::myProcNo()-1]
);
return localI >= 0 && localI < offsets_[Pstream::myProcNo()];
} }
...@@ -69,7 +64,7 @@ inline Foam::label Foam::globalIndex::toLocal(const label procI, const label i) ...@@ -69,7 +64,7 @@ inline Foam::label Foam::globalIndex::toLocal(const label procI, const label i)
{ {
label localI = (procI == 0 ? i : i - offsets_[procI-1]); label localI = (procI == 0 ? i : i - offsets_[procI-1]);
if (localI < 0 || localI >= offsets_[procI]) if (localI < 0 || i >= offsets_[procI])
{ {
FatalErrorIn("globalIndex::toLocal(const label, const label)") FatalErrorIn("globalIndex::toLocal(const label, const label)")
<< "Global " << i << " does not belong on processor " << "Global " << i << " does not belong on processor "
......
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