initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / applications / utilities / parallelProcessing / decomposePar / domainDecomposition.H
blob6ec357a02ef08eb837324816a275e88255aab648
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::domainDecomposition
28 Description
29     Automatic domain decomposition class for FOAM meshes
31 SourceFiles
32     domainDecomposition.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"
45 #ifndef namespaceFoam
46 #define namespaceFoam
47     using namespace Foam;
48 #endif
50 /*---------------------------------------------------------------------------*\
51                            Class domainDecomposition Declaration
52 \*---------------------------------------------------------------------------*/
54 class domainDecomposition
56     public fvMesh
58     // Private data
60         //- Mesh decomposition control dictionary
61         IOdictionary decompositionDict_;
63         //- Number of processors in decomposition
64         label nProcs_;
66         //- Is the decomposition data to be distributed for each processor
67         bool distributed_;
69         //- Processor label for each cell
70         labelList cellToProc_;
72         //- Labels of points for each processor
73         labelListList procPointAddressing_;
75         //- Labels of faces for each processor
76         // Note: Face turning index is stored as the sign on addressing
77         // Only the processor boundary faces are affected: if the sign of the
78         // index is negative, the processor face is the reverse of the
79         // original face. In order to do this properly, all face
80         // indices will be incremented by 1 and the decremented as
81         // necessary t avoid the problem of face number zero having no
82         // sign.  
83         labelListList procFaceAddressing_;
85         //- Labels of cells for each processor
86         labelListList procCellAddressing_;
88         //- Original patch index for every processor patch
89         labelListList procBoundaryAddressing_;
91         //- Sizes for processor mesh patches
92         // Excludes inter-processor boundaries
93         labelListList procPatchSize_;
95         //- Start indices for processor patches
96         // Excludes inter-processor boundaries
97         labelListList procPatchStartIndex_;
99         //- Neighbour processor ID for inter-processor boundaries
100         labelListList procNeighbourProcessors_;
102         //- Sizes for inter-processor patches
103         labelListList procProcessorPatchSize_;
105         //- Start indices for inter-processor patches
106         labelListList procProcessorPatchStartIndex_;
108         //- List of globally shared point labels
109         labelList globallySharedPoints_;
111         //- Are there cyclic-parallel faces
112         bool cyclicParallel_;
115     // Private Member Functions
117         void distributeCells();
119         //- Mark all elements with value or -2 if occur twice
120         static void mark
121         (
122             const labelList& zoneElems,
123             const label zoneI,
124             labelList& elementToZone
125         );
127 public:
129     // Constructors
131         //- Construct from IOobject
132         domainDecomposition(const IOobject& io);
135     // Destructor
137         ~domainDecomposition();
140     // Member Functions
142         //- Number of processor in decomposition
143         label nProcs() const
144         {
145             return nProcs_;
146         }
148         //- Is the decomposition data to be distributed for each processor
149         bool distributed() const
150         {
151             return distributed_;
152         }
154         //- Decompose mesh. Optionally remove zero-sized patches.
155         void decomposeMesh(const bool filterEmptyPatches);
157         //- Write decomposition
158         bool writeDecomposition();
160         //- Cell-processor decomposition labels
161         const labelList& cellToProc() const
162         {
163             return cellToProc_;
164         }
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 #endif
172 // ************************************************************************* //