Loading...
Searching...
No Matches
faMeshDecomposition.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2017 Wikki Ltd
9 Copyright (C) 2021,2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::faMeshDecomposition
29
30Description
31 Automatic faMesh decomposition class
32
33Author
34 Zeljko Tukovic, FSB Zagreb
35 Hrvoje Jasak, Wikki Ltd.
36
37SourceFiles
38 faMeshDecomposition.cxx
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_faMeshDecomposition_H
43#define Foam_faMeshDecomposition_H
44
45#include "faMesh.H"
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class faMeshDecomposition Declaration
52\*---------------------------------------------------------------------------*/
53
54class faMeshDecomposition
55:
56 public faMesh
57{
58 // Private Data
59
60 //- The area-region name
61 const word areaName_;
62
63 //- Number of processors in decomposition
64 const label nProcs_;
65
66 //- Is the decomposition data to be distributed for each processor
67 bool distributed_;
68
69 //- Are globalFaceZones being used
70 bool hasGlobalFaceZones_;
71
72 //- Processor label for each cell
73 labelList faceToProc_;
74
75 //- Face labels for each processor mesh
76 labelListList procFaceLabels_;
77
78 //-
79 List<Map<label>> procMeshEdgesMap_;
80
81 //- Number of internal edges for each processor mesh
82 labelList procNInternalEdges_;
83
84 //- Edge labels for patches of processor meshes
85 List<labelListList> procPatchEdgeLabels_;
86
87 //- Labels of points for each processor
88 labelListList procPatchPointAddressing_;
89
90 //- Labels of edges for each processor
91 labelListList procPatchEdgeAddressing_;
92
93 //- Labels of edges for each processor
94 labelListList procEdgeAddressing_;
95
96 //- Labels of faces for each processor
97 labelListList procFaceAddressing_;
98
99 //- Original patch index for every processor patch
100 labelListList procBoundaryAddressing_;
101
102 //- Sizes for processor mesh patches
103 // Excludes inter-processor boundaries
104 labelListList procPatchSize_;
105
106 //- Start indices for processor patches
107 // Excludes inter-processor boundaries
108 labelListList procPatchStartIndex_;
109
110 //- Neighbour processor ID for inter-processor boundaries
111 labelListList procNeighbourProcessors_;
112
113 //- Sizes for inter-processor patches
114 labelListList procProcessorPatchSize_;
115
116 //- Start indices for inter-processor patches
117 labelListList procProcessorPatchStartIndex_;
118
119 //- List of globally shared point labels
120 labelList globallySharedPoints_;
121
122 //- Are there cyclic-parallel faces
123 bool cyclicParallel_;
124
125
126 // Private Member Functions
127
128 void distributeFaces();
129
130 //- No copy construct
131 faMeshDecomposition(const faMeshDecomposition&) = delete;
132
133 //- No copy assignment
134 void operator=(const faMeshDecomposition&) = delete;
135
136public:
137
138 // Constructors
139
140 //- Construct from components.
141 //- Values will come from the volume decomposition
142 faMeshDecomposition
143 (
145 const word& areaName,
147 const polyMesh& mesh,
149 const label nProcessors,
151 const dictionary& params = dictionary::null
152 );
153
154 //- Construct from components (default area region).
155 //- Values will come from the volume decomposition
156 faMeshDecomposition
157 (
159 const polyMesh& mesh,
161 const label nProcessors,
163 const dictionary& params = dictionary::null
164 );
165
166
167 //- Destructor
168 ~faMeshDecomposition() = default;
169
170
171 // Member Functions
172
173 // Settings
174
175 //- The area-region name
176 const word& name() const noexcept { return areaName_; }
177
178 //- Number of processor in decomposition
179 label nProcs() const noexcept { return nProcs_; }
180
181 //- Is decomposition data to be distributed for each processor
182 bool distributed() const noexcept { return distributed_; }
183
184 //- Change distributed flag
185 bool distributed(bool on) noexcept
186 {
187 bool old(distributed_);
188 distributed_ = on;
189 return old;
190 }
191
192 //- Are global face zones used
193 bool useGlobalFaceZones() const noexcept
194 {
195 return hasGlobalFaceZones_;
196 }
197
198 //- Change global face zones flag
199 bool useGlobalFaceZones(bool on) noexcept
200 {
201 bool old(hasGlobalFaceZones_);
202 hasGlobalFaceZones_ = on;
203 return old;
204 }
205
206 //- Update flags based on the decomposition model settings
207 // Sets "distributed", detects presence of "globalFaceZones"
208 void updateParameters(const dictionary& params);
209
210
211 // Mappings
212
213 //- Face-processor decomposition labels
214 const labelList& faceToProc() const noexcept
215 {
216 return faceToProc_;
218
219
220 // Decompose
221
222 //- Decompose mesh
223 void decomposeMesh();
224
225 //- Write decomposition
226 bool writeDecomposition() const;
228
229
230// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231
232} // End namespace Foam
233
234// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235
236#endif
238// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
Definition dictionary.H:487
bool useGlobalFaceZones() const noexcept
Are global face zones used.
bool distributed() const noexcept
Is decomposition data to be distributed for each processor.
void updateParameters(const dictionary &params)
Update flags based on the decomposition model settings.
const labelList & faceToProc() const noexcept
Face-processor decomposition labels.
~faMeshDecomposition()=default
Destructor.
label nProcs() const noexcept
Number of processor in decomposition.
bool writeDecomposition() const
Write decomposition.
const word & name() const noexcept
The area-region name.
bool useGlobalFaceZones(bool on) noexcept
Change global face zones flag.
faMeshDecomposition(const word &areaName, const polyMesh &mesh, const label nProcessors, const dictionary &params=dictionary::null)
Construct from components. Values will come from the volume decomposition.
bool distributed(bool on) noexcept
Change distributed flag.
faMeshDecomposition(const polyMesh &mesh, const label nProcessors, const dictionary &params=dictionary::null)
Construct from components (default area region). Values will come from the volume decomposition.
void decomposeMesh()
Decompose mesh.
faMesh(const faMesh &)=delete
No copy construct.
static const faMesh & mesh(const polyMesh &pMesh)
The single-region finite-area region on the polyMesh. Uses lookupObject semantics - Fatal if non-exis...
Definition faMesh.C:164
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
const direction noexcept
Definition scalarImpl.H:265