1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 3 of the License, or (at your
14 option) any later version.
16 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 Calculates surface of the mesh
33 \*---------------------------------------------------------------------------*/
35 #ifndef meshSurfaceEngine_H
36 #define meshSurfaceEngine_H
38 #include "objectRegistry.H"
40 #include "polyMeshGenModifier.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class meshSurfaceEngine Declaration
55 \*---------------------------------------------------------------------------*/
57 class meshSurfaceEngine
60 //- reference to the mesh
63 //- number of active patch
64 const label activePatch_;
67 mutable labelList* boundaryPointsPtr_;
70 mutable faceList::subList* boundaryFacesPtr_;
72 //- patches boundary faces are in
73 mutable labelList* boundaryFacePatchPtr_;
76 mutable labelList* boundaryFaceOwnersPtr_;
78 //- point faces addressing
79 mutable VRWGraph* pointFacesPtr_;
80 mutable VRWGraph* pointInFacePtr_;
82 //- point-patches addressing
83 mutable VRWGraph* pointPatchesPtr_;
85 //- pointBoundaryPoint addressing
86 mutable labelList* bppPtr_;
88 //- point points addressing
89 mutable VRWGraph* pointPointsPtr_;
92 mutable edgeList* edgesPtr_;
94 //- boundary point-edges addressing
95 mutable VRWGraph* bpEdgesPtr_;
97 //- edge faces addressing
98 mutable VRWGraph* edgeFacesPtr_;
100 //- face edges addressing
101 mutable VRWGraph* faceEdgesPtr_;
103 //- edge-patches addressing
104 mutable VRWGraph* edgePatchesPtr_;
106 //- face-faces addressing
107 mutable VRWGraph* faceFacesPtr_;
110 mutable vectorField* pointNormalsPtr_;
113 mutable vectorField* faceNormalsPtr_;
116 mutable vectorField* faceCentresPtr_;
118 // Private data for parallel execution
120 //- global boundary point label
121 mutable labelList* globalBoundaryPointLabelPtr_;
123 //- global boundary point to local addressing
124 mutable Map<label>* globalBoundaryPointToLocalPtr_;
126 //- boundary point-processors addressing
127 mutable VRWGraph* bpProcsPtr_;
129 //- neighbour processors for communication when sending point data
130 mutable DynList<label>* bpNeiProcsPtr_;
132 //- global boundary edge label
133 mutable labelList* globalBoundaryEdgeLabelPtr_;
135 //- global boundary edge to local addressing
136 mutable Map<label>* globalBoundaryEdgeToLocalPtr_;
138 //- boundary edge-processors addressing
139 mutable VRWGraph* beProcsPtr_;
141 //- neighbour processors for communication when sending edge data
142 mutable DynList<label>* beNeiProcsPtr_;
144 //- processor containing other face and face-patch addressing
145 mutable Map<label>* otherEdgeFaceAtProcPtr_;
146 mutable Map<label>* otherEdgeFacePatchPtr_;
148 //- global label for boundary faces
149 mutable labelList* globalBoundaryFaceLabelPtr_;
151 // Private member functions
153 //- calculate boundary nodes, faces and addressing
154 void calculateBoundaryFaces() const;
155 void calculateBoundaryOwners() const;
156 void calculateBoundaryNodes() const;
158 void calculateBoundaryFacePatches() const;
160 void calculatePointFaces() const;
162 void calculatePointPatches() const;
164 void calculatePointPoints() const;
166 void calculatePointNormals() const;
167 void calculateFaceNormals() const;
168 void calculateFaceCentres() const;
170 void updatePointNormalsAtProcBoundaries() const;
172 void calculateEdgesAndAddressing() const;
173 void calculateFaceEdgesAddressing() const;
174 void calculateEdgeFacesAddressing() const;
175 void calculateEdgePatchesAddressing() const;
176 void calculateFaceFacesAddressing() const;
178 // Private member functions for parallel runs
180 void calcGlobalBoundaryPointLabels() const;
181 void calcGlobalBoundaryEdgeLabels() const;
182 void calcAddressingForProcEdges() const;
183 void calcGlobalBoundaryFaceLabels() const;
185 // Private member functions
189 //- Disallow default bitwise copy construct
190 meshSurfaceEngine(const meshSurfaceEngine&);
192 //- Disallow default bitwise assignment
193 void operator=(const meshSurfaceEngine&);
197 friend class meshSurfaceEngineModifier;
201 //- Construct from mesh
202 meshSurfaceEngine(polyMeshGen& mesh);
204 //- Construct from mesh and patch
205 meshSurfaceEngine(polyMeshGen &mesh, const label patchI);
209 ~meshSurfaceEngine();
212 inline const polyMeshGen& mesh() const;
213 inline const pointFieldPMG& points() const;
214 inline const faceListPMG& faces() const;
215 inline const cellListPMG& cells() const;
217 inline const labelList& boundaryPoints() const;
219 inline const faceList::subList& boundaryFaces() const;
221 //- patch label for each boundary face
222 inline const labelList& boundaryFacePatches() const;
224 inline const labelList& faceOwners() const;
226 inline const VRWGraph& pointFaces() const;
227 inline const VRWGraph& pointInFaces() const;
229 //inline const VRWGraph& pointPatches() const;
231 inline const VRWGraph& pointPoints() const;
233 inline const vectorField& pointNormals() const;
235 inline const vectorField& faceNormals() const;
237 inline const vectorField& faceCentres() const;
239 inline const labelList& bp() const;
241 inline const edgeList& edges() const;
243 inline const VRWGraph& boundaryPointEdges() const;
245 inline const VRWGraph& edgeFaces() const;
247 inline const VRWGraph& faceEdges() const;
249 inline const VRWGraph& edgePatches() const;
251 inline const VRWGraph& faceFaces() const;
253 // Functions for parallel runs
254 //- global boundary point label
255 inline const labelList& globalBoundaryPointLabel() const;
257 //- global point label to local label. Only for processors points
258 inline const Map<label>& globalToLocalBndPointAddressing() const;
260 //- processors which contain the vertex
261 inline const VRWGraph& bpAtProcs() const;
263 //- communication matrix for sending point data
264 inline const DynList<label>& bpNeiProcs() const;
266 //- global boundary edge label
267 inline const labelList& globalBoundaryEdgeLabel() const;
269 //- global boundary edge label to local label. Only for processor edges
270 inline const Map<label>& globalToLocalBndEdgeAddressing() const;
272 //- processors which contain the edges
273 inline const VRWGraph& beAtProcs() const;
275 //- communication matrix for sending edge data
276 inline const DynList<label>& beNeiProcs() const;
278 //- patch label and processor label at which the other surface face
279 //- sharing processor edge is located. Only for processor edges
280 inline const Map<label>& otherEdgeFaceAtProc() const;
281 inline const Map<label>& otherEdgeFacePatch() const;
283 //- global boundary face label
284 inline const labelList& globalBoundaryFaceLabel() const;
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 } // End namespace Foam
292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 #include "meshSurfaceEngineI.H"
296 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 // ************************************************************************* //