Skip to content
Snippets Groups Projects
Commit 794c6581 authored by mattijs's avatar mattijs
Browse files

added some more global access methods

parent 6c994a32
Branches
Tags
No related merge requests found
......@@ -106,6 +106,15 @@ public:
//- Global sum of localSizes
inline label size() const;
//- Size of procI data
inline label localSize(const label procI) const;
//- From local to global on procI
inline label toGlobal(const label procI, const label i) const;
//- Is on processor procI
inline bool isLocal(const label procI, const label i) const;
//- From global to local on procI
inline label toLocal(const label procI, const label i) const;
......@@ -115,9 +124,6 @@ public:
//- Start of procI data
inline label offset(const label procI) const;
//- Size of procI data
inline label localSize(const label procI) const;
// IOstream Operators
......
......@@ -63,27 +63,39 @@ inline Foam::label Foam::globalIndex::size() const
}
inline Foam::label Foam::globalIndex::toGlobal
(
const label procI,
const label i
) const
{
return(procI == 0 ? i : i + offsets_[procI-1]);
}
inline Foam::label Foam::globalIndex::toGlobal(const label i) const
{
return
(
Pstream::myProcNo() == 0
? i
: i + offsets_[Pstream::myProcNo()-1]
);
return toGlobal(Pstream::myProcNo(), i);
}
//- Is on local processor
inline bool Foam::globalIndex::isLocal(const label i) const
inline bool Foam::globalIndex::isLocal(const label procI, const label i) const
{
return
(i < offsets_[Pstream::myProcNo()])
&& (i >= (Pstream::myProcNo() == 0 ? 0 : offsets_[Pstream::myProcNo()-1]));
(i < offsets_[procI])
&& (i >= (procI == 0 ? 0 : offsets_[procI-1]));
}
inline bool Foam::globalIndex::isLocal(const label i) const
{
return isLocal(Pstream::myProcNo(), i);
}
inline Foam::label Foam::globalIndex::toLocal(const label procI, const label i)
const
const
{
label localI = (procI == 0 ? i : i - offsets_[procI-1]);
......
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