1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Calculates a unique integer (label so might not have enough room - 2G max)
29 for processor + local index. E.g.
31 globalIndex globalFaces(mesh.nFaces());
32 label globalFaceI = globalFaces.toGlobal(faceI);
38 \*---------------------------------------------------------------------------*/
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of friend functions and operators
54 Istream& operator>>(Istream& is, globalIndex& gi);
55 Ostream& operator<<(Ostream& os, const globalIndex& gi);
58 /*---------------------------------------------------------------------------*\
59 Class globalIndex Declaration
60 \*---------------------------------------------------------------------------*/
66 //- Start off procI+1. (so like CompactListList)
74 //- Construct from local max size
75 globalIndex(const label localSize);
77 //- Construct from Istream
78 globalIndex(Istream& is);
83 ////- Start of procI+1 data
84 //inline const labelList& offsets() const;
87 // Queries relating to my processor
90 inline label localSize() const;
92 //- From local to global
93 inline label toGlobal(const label i) const;
95 //- Is on local processor
96 inline bool isLocal(const label i) const;
98 //- From global to local on current processor.
99 // FatalError if not on local processor.
100 inline label toLocal(const label i) const;
105 //- Global sum of localSizes
106 inline label size() const;
108 //- Size of procI data
109 inline label localSize(const label procI) const;
111 //- From local to global on procI
112 inline label toGlobal(const label procI, const label i) const;
114 //- Is on processor procI
115 inline bool isLocal(const label procI, const label i) const;
117 //- From global to local on procI
118 inline label toLocal(const label procI, const label i) const;
120 //- Which processor does global come from? Binary search.
121 inline label whichProcID(const label i) const;
123 //- Start of procI data
124 inline label offset(const label procI) const;
128 // IOstream Operators
130 friend Istream& operator>>(Istream& is, globalIndex& gi);
131 friend Ostream& operator<<(Ostream& os, const globalIndex& gi);
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 #include "globalIndexI.H"
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 // ************************************************************************* //