diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H index dce4faca229c609a8d91e286c2359fba8353dd15..0ed207057a347a07612bb089c2575777aeaf88f8 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H @@ -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 diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H index a28604684165ea3743024f51a47e50d2dd2de891..f9444fe54b0291f32f3d19b9476bf21dfbcf8618 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H @@ -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];