BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / utilities / parallelProcessing / decomposePar / domainDecomposition.H
blobe5fb53808605fc5db2fe797881726cb8289dfc38
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::domainDecomposition
27 Description
28     Automatic domain decomposition class for finite-volume meshes
30 SourceFiles
31     domainDecomposition.C
32     decomposeMesh.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef domainDecomposition_H
37 #define domainDecomposition_H
39 #include "fvMesh.H"
40 #include "labelList.H"
41 #include "SLList.H"
42 #include "PtrList.H"
43 #include "point.H"
44 #include "Time.H"
45 #include "volFields.H"
48 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                      Class domainDecomposition Declaration
53 \*---------------------------------------------------------------------------*/
55 class domainDecomposition
57     public fvMesh
59     // Private data
61         //- Optional: points at the facesInstance
62         autoPtr<pointIOField> facesInstancePointsPtr_;
64         //- Mesh decomposition control dictionary
65         IOdictionary decompositionDict_;
67         //- Number of processors in decomposition
68         label nProcs_;
70         //- Is the decomposition data to be distributed for each processor
71         bool distributed_;
73         //- Processor label for each cell
74         labelList cellToProc_;
76         //- Labels of points for each processor
77         labelListList procPointAddressing_;
79         //- Labels of faces for each processor
80         // Note: Face turning index is stored as the sign on addressing
81         // Only the processor boundary faces are affected: if the sign of the
82         // index is negative, the processor face is the reverse of the
83         // original face. In order to do this properly, all face
84         // indices will be incremented by 1 and the decremented as
85         // necessary to avoid the problem of face number zero having no
86         // sign.
87         List<DynamicList<label> > procFaceAddressing_;
89         //- Labels of cells for each processor
90         labelListList procCellAddressing_;
92         //- Sizes for processor mesh patches
93         // Excludes inter-processor boundaries
94         labelListList procPatchSize_;
96         //- Start indices for processor patches
97         // Excludes inter-processor boundaries
98         labelListList procPatchStartIndex_;
101         // Per inter-processor patch information
103         //- Neighbour processor ID for inter-processor boundaries
104         labelListList procNeighbourProcessors_;
106         //- Sizes for inter-processor patches
107         labelListList procProcessorPatchSize_;
109         //- Start indices (in procFaceAddressing_) for inter-processor patches
110         labelListList procProcessorPatchStartIndex_;
112         //- Sub patch IDs for inter-processor patches
113         List<labelListList> procProcessorPatchSubPatchIDs_;
115         //- Sub patch sizes for inter-processor patches
116         List<labelListList> procProcessorPatchSubPatchStarts_;
118     // Private Member Functions
120         void distributeCells();
122         //- Mark all elements with value or -2 if occur twice
123         static void mark
124         (
125             const labelList& zoneElems,
126             const label zoneI,
127             labelList& elementToZone
128         );
130         //- Append single element to list
131         static void append(labelList&, const label);
133         //- Add face to interProcessor patch.
134         void addInterProcFace
135         (
136             const label facei,
137             const label ownerProc,
138             const label nbrProc,
140             List<Map<label> >&,
141             List<DynamicList<DynamicList<label> > >&
142         ) const;
145 public:
147     // Constructors
149         //- Construct from IOobject
150         domainDecomposition(const IOobject& io);
153     //- Destructor
154     ~domainDecomposition();
157     // Member Functions
159         //- Number of processor in decomposition
160         label nProcs() const
161         {
162             return nProcs_;
163         }
165         //- Is the decomposition data to be distributed for each processor
166         bool distributed() const
167         {
168             return distributed_;
169         }
171         //- Decompose mesh.
172         void decomposeMesh();
174         //- Write decomposition
175         bool writeDecomposition();
177         //- Cell-processor decomposition labels
178         const labelList& cellToProc() const
179         {
180             return cellToProc_;
181         }
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #endif
194 // ************************************************************************* //