1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
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/>.
25 Foam::domainDecomposition
28 Automatic domain decomposition class for finite-volume meshes
34 \*---------------------------------------------------------------------------*/
36 #ifndef domainDecomposition_H
37 #define domainDecomposition_H
40 #include "labelList.H"
45 #include "volFields.H"
51 /*---------------------------------------------------------------------------*\
52 Class domainDecomposition Declaration
53 \*---------------------------------------------------------------------------*/
55 class domainDecomposition
61 //- Optional: points at the facesInstance
62 autoPtr<pointIOField> facesInstancePointsPtr_;
64 //- Mesh decomposition control dictionary
65 IOdictionary decompositionDict_;
67 //- Number of processors in decomposition
70 //- Is the decomposition data to be distributed for each processor
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
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
125 const labelList& zoneElems,
127 labelList& elementToZone
130 //- Append single element to list
131 static void append(labelList&, const label);
133 //- Add face to interProcessor patch.
134 void addInterProcFace
137 const label ownerProc,
141 List<DynamicList<DynamicList<label> > >&
149 //- Construct from IOobject
150 domainDecomposition(const IOobject& io);
154 ~domainDecomposition();
159 //- Number of processor in decomposition
165 //- Is the decomposition data to be distributed for each processor
166 bool distributed() const
172 void decomposeMesh();
174 //- Write decomposition
175 bool writeDecomposition();
177 //- Cell-processor decomposition labels
178 const labelList& cellToProc() const
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 } // End namespace Foam
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 // ************************************************************************* //