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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::faMeshDecomposition
28 
29 Description
30  Automatic faMesh decomposition class
31 
32 Author
33  Zeljko Tukovic, FSB Zagreb
34  Hrvoje Jasak, Wikki Ltd.
35 
36 SourceFiles
37  faMeshDecomposition.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef faMeshDecomposition_H
42 #define faMeshDecomposition_H
43 
44 #include "fvMesh.H"
45 #include "faMesh.H"
46 #include "labelList.H"
47 #include "SLList.H"
48 #include "PtrList.H"
49 #include "point.H"
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class faMeshDecomposition Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public faMesh
61 {
62  // Private data
63 
64  //- Optional non-standard file for decomposeParDict
65  const fileName decompDictFile_;
66 
67  //- Number of processors in decomposition
68  label nProcs_;
69 
70  //- Is the decomposition data to be distributed for each processor
71  bool distributed_;
72 
73  //- Are globalFaceZones being used
74  bool hasGlobalFaceZones_;
75 
76  //- Processor label for each cell
77  labelList faceToProc_;
78 
79  //- Face labels for each processor mesh
80  labelListList procFaceLabels_;
81 
82  //-
83  List<Map<label>> procMeshEdgesMap_;
84 
85  //- Number of internal edges for each processor mesh
86  labelList procNInternalEdges_;
87 
88  //- Edge labels for patches of processor meshes
89  List<List<List<label>>> procPatchEdgeLabels_;
90 
91  //- Labels of points for each processor
92  labelListList procPatchPointAddressing_;
93 
94  //- Labels of edges for each processor
95  labelListList procPatchEdgeAddressing_;
96 
97  //- Labels of edges for each processor
98  labelListList procEdgeAddressing_;
99 
100  //- Labels of faces for each processor
101  labelListList procFaceAddressing_;
102 
103  //- Original patch index for every processor patch
104  labelListList procBoundaryAddressing_;
105 
106  //- Sizes for processor mesh patches
107  // Excludes inter-processor boundaries
108  labelListList procPatchSize_;
109 
110  //- Start indices for processor patches
111  // Excludes inter-processor boundaries
112  labelListList procPatchStartIndex_;
113 
114  //- Neighbour processor ID for inter-processor boundaries
115  labelListList procNeighbourProcessors_;
116 
117  //- Sizes for inter-processor patches
118  labelListList procProcessorPatchSize_;
119 
120  //- Start indices for inter-processor patches
121  labelListList procProcessorPatchStartIndex_;
122 
123  //- List of globally shared point labels
124  labelList globallySharedPoints_;
125 
126  //- Are there cyclic-parallel faces
127  bool cyclicParallel_;
128 
129 
130  // Private Member Functions
131 
132  void distributeFaces();
133 
134 public:
135 
136  // Constructors
137 
138  //- Construct from components.
139  // \param mesh the fvMesh
140  // \param decompDictFile optional non-standard location for the
141  // decomposeParDict file
143  (
144  const fvMesh& mesh,
145  const fileName& decompDictFile = ""
146  );
147 
148 
149  //- Destructor
150  ~faMeshDecomposition() = default;
151 
152 
153  // Member Functions
154 
155  //- Number of processor in decomposition
156  label nProcs() const
157  {
158  return nProcs_;
159  }
160 
161  //- Is the decomposition data to be distributed for each processor
162  bool distributed() const
163  {
164  return distributed_;
165  }
166 
167  //- Decompose mesh
168  void decomposeMesh();
169 
170  //- Write decomposition
171  bool writeDecomposition();
172 
173  //- Cell-processor decomposition labels
174  const labelList& faceToProc() const
175  {
176  return faceToProc_;
177  }
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
point.H
Foam::faMeshDecomposition::decomposeMesh
void decomposeMesh()
Decompose mesh.
faMesh.H
Foam::faMeshDecomposition::distributed
bool distributed() const
Is the decomposition data to be distributed for each processor.
Definition: faMeshDecomposition.H:161
Foam::faMeshDecomposition::faMeshDecomposition
faMeshDecomposition(const fvMesh &mesh, const fileName &decompDictFile="")
Construct from components.
Foam::faMeshDecomposition::nProcs
label nProcs() const
Number of processor in decomposition.
Definition: faMeshDecomposition.H:155
labelList.H
Foam::faMeshDecomposition
Automatic faMesh decomposition class.
Definition: faMeshDecomposition.H:57
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
fvMesh.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faMesh::mesh
const polyMesh & mesh() const
Return access to polyMesh.
Definition: faMesh.H:323
SLList.H
Non-intrusive singly-linked list.
Foam::List< label >
Foam::faMeshDecomposition::~faMeshDecomposition
~faMeshDecomposition()=default
Destructor.
PtrList.H
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:77
Foam::faMeshDecomposition::faceToProc
const labelList & faceToProc() const
Cell-processor decomposition labels.
Definition: faMeshDecomposition.H:173
Foam::faMeshDecomposition::writeDecomposition
bool writeDecomposition()
Write decomposition.