From 1589afb960e19dc1f11a53cf16e8cb98e24e3d51 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Fri, 29 May 2009 15:28:26 +0100
Subject: [PATCH] added localSize member function

---
 .../meshes/polyMesh/globalMeshData/globalIndex.H      |  3 +++
 .../meshes/polyMesh/globalMeshData/globalIndexI.H     | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H
index 5f7ed0a2b26..c74d82b182d 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H
@@ -84,6 +84,9 @@ public:
         //- Start of procI+1 data
         inline const labelList& offsets() const;
 
+        //- my local size
+        inline label localSize() const;
+
         //- Global sum of localSizes
         inline label size() const;
 
diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H
index b01ed6e8ba8..65f5d2d9d06 100644
--- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H
+++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H
@@ -34,6 +34,17 @@ inline const Foam::labelList& Foam::globalIndex::offsets() const
 }
 
 
+inline Foam::label Foam::globalIndex::localSize() const
+{
+    return
+    (
+        Pstream::myProcNo() == 0
+      ? offsets_[Pstream::myProcNo()]
+      : offsets_[Pstream::myProcNo()] - offsets_[Pstream::myProcNo()-1]
+    );
+}
+
+
 inline Foam::label Foam::globalIndex::size() const
 {
     return offsets_[Pstream::nProcs()-1];
-- 
GitLab