FreeFOAM The Cross-Platform CFD Toolkit
domainDecomposition.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::domainDecomposition
26 
27 Description
28  Automatic domain decomposition class for FOAM meshes
29 
30 SourceFiles
31  domainDecomposition.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef domainDecomposition_H
36 #define domainDecomposition_H
37 
38 #include <finiteVolume/fvMesh.H>
39 #include <OpenFOAM/labelList.H>
40 #include <OpenFOAM/SLList.H>
41 #include <OpenFOAM/PtrList.H>
42 #include <OpenFOAM/point.H>
43 #include <OpenFOAM/Time.H>
44 #include <finiteVolume/volFields.H>
45 
46 #ifndef namespaceFoam
47 #define namespaceFoam
48  using namespace Foam;
49 #endif
50 
51 /*---------------------------------------------------------------------------*\
52  Class domainDecomposition Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public fvMesh
58 {
59  // Private data
60 
61  //- Mesh decomposition control dictionary
62  IOdictionary decompositionDict_;
63 
64  //- Number of processors in decomposition
65  label nProcs_;
66 
67  //- Is the decomposition data to be distributed for each processor
68  bool distributed_;
69 
70  //- Processor label for each cell
71  labelList cellToProc_;
72 
73  //- Labels of points for each processor
74  labelListList procPointAddressing_;
75 
76  //- Labels of faces for each processor
77  // Note: Face turning index is stored as the sign on addressing
78  // Only the processor boundary faces are affected: if the sign of the
79  // index is negative, the processor face is the reverse of the
80  // original face. In order to do this properly, all face
81  // indices will be incremented by 1 and the decremented as
82  // necessary t avoid the problem of face number zero having no
83  // sign.
84  labelListList procFaceAddressing_;
85 
86  //- Labels of cells for each processor
87  labelListList procCellAddressing_;
88 
89  //- Original patch index for every processor patch
90  labelListList procBoundaryAddressing_;
91 
92  //- Sizes for processor mesh patches
93  // Excludes inter-processor boundaries
94  labelListList procPatchSize_;
95 
96  //- Start indices for processor patches
97  // Excludes inter-processor boundaries
98  labelListList procPatchStartIndex_;
99 
100  //- Neighbour processor ID for inter-processor boundaries
101  labelListList procNeighbourProcessors_;
102 
103  //- Sizes for inter-processor patches
104  labelListList procProcessorPatchSize_;
105 
106  //- Start indices for inter-processor patches
107  labelListList procProcessorPatchStartIndex_;
108 
109  //- List of globally shared point labels
110  labelList globallySharedPoints_;
111 
112  //- Are there cyclic-parallel faces
113  bool cyclicParallel_;
114 
115 
116  // Private Member Functions
117 
118  void distributeCells();
119 
120  //- Mark all elements with value or -2 if occur twice
121  static void mark
122  (
123  const labelList& zoneElems,
124  const label zoneI,
125  labelList& elementToZone
126  );
127 
128 public:
129 
130  // Constructors
131 
132  //- Construct from IOobject
133  domainDecomposition(const IOobject& io);
134 
135 
136  // Destructor
137 
139 
140 
141  // Member Functions
142 
143  //- Number of processor in decomposition
144  label nProcs() const
145  {
146  return nProcs_;
147  }
148 
149  //- Is the decomposition data to be distributed for each processor
150  bool distributed() const
151  {
152  return distributed_;
153  }
154 
155  //- Decompose mesh. Optionally remove zero-sized patches.
156  void decomposeMesh(const bool filterEmptyPatches);
157 
158  //- Write decomposition
159  bool writeDecomposition();
160 
161  //- Cell-processor decomposition labels
162  const labelList& cellToProc() const
163  {
164  return cellToProc_;
165  }
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************ vim: set sw=4 sts=4 et: ************************ //