Commit fa1b1451 authored by mattijs's avatar mattijs
Browse files

added localSize for procI

parent 75945b50
......@@ -83,30 +83,41 @@ public:
////- Start of procI+1 data
//inline const labelList& offsets() const;
//- Start of procI data
inline label offset(const label procI) const;
//- my local size
inline label localSize() const;
//- Global sum of localSizes
inline label size() const;
// Queries relating to my processor
//- From local to global
inline label toGlobal(const label i) const;
//- my local size
inline label localSize() const;
//- Is on local processor
inline bool isLocal(const label i) const;
//- From local to global
inline label toGlobal(const label i) const;
//- From global to local on procI
inline label toLocal(const label procI, const label i) const;
//- Is on local processor
inline bool isLocal(const label i) const;
//- From global to local on current processor.
// FatalError if not on local processor.
inline label toLocal(const label i) const;
//- From global to local on current processor.
// FatalError if not on local processor.
inline label toLocal(const label i) const;
// Global queries
//- Global sum of localSizes
inline label size() const;
//- From global to local on procI
inline label toLocal(const label procI, const label i) const;
//- Which processor does global come from? Binary search.
inline label whichProcID(const label i) const;
//- Start of procI data
inline label offset(const label procI) const;
//- Size of procI data
inline label localSize(const label procI) const;
//- Which processor does global come from?
inline label whichProcID(const label i) const;
// IOstream Operators
......
......@@ -40,17 +40,23 @@ inline Foam::label Foam::globalIndex::offset(const label procI) const
}
inline Foam::label Foam::globalIndex::localSize() const
inline Foam::label Foam::globalIndex::localSize(const label procI) const
{
return
(
Pstream::myProcNo() == 0
? offsets_[Pstream::myProcNo()]
: offsets_[Pstream::myProcNo()] - offsets_[Pstream::myProcNo()-1]
procI == 0
? offsets_[procI]
: offsets_[procI] - offsets_[procI-1]
);
}
inline Foam::label Foam::globalIndex::localSize() const
{
return localSize(Pstream::myProcNo());
}
inline Foam::label Foam::globalIndex::size() const
{
return offsets_[Pstream::nProcs()-1];
......
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