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 Cell-face mesh analysis engine
31 polyMeshGenAddressing.C
32 polyMeshGenAddressingClear.C
33 polyMeshGenAddressingCellCells.C
34 polyMeshGenAddressingEdgeCells.C
35 polyMeshGenAddressingPointCells.C
36 polyMeshGenAddressingCells.C
37 polyMeshGenAddressingEdgeFaces.C
38 polyMeshGenAddressingPointFaces.C
39 polyMeshGenAddressingCellEdges.C
40 polyMeshGenAddressingPointEdges.C
41 polyMeshGenAddressingPointPoints.C
42 polyMeshGenAddressingEdges.C
43 polyMeshGenAddressingCellCentresAndVols.C
44 polyMeshGenAddressingFaceCentresAndAreas.C
45 polyMeshGenAddressingUpdateGeometry.C
46 polyMeshGenAddressingParallelAddressing.C
48 \*---------------------------------------------------------------------------*/
50 #ifndef polyMeshGenAddressing_H
51 #define polyMeshGenAddressing_H
54 #include "polyMeshGenCells.H"
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 /*---------------------------------------------------------------------------*\
67 Class polyMeshGenAddressing Declaration
68 \*---------------------------------------------------------------------------*/
70 class polyMeshGenAddressing
74 //- reference to the mesh
75 const polyMeshGenCells& mesh_;
80 mutable edgeList* edgesPtr_;
86 mutable VRWGraph* ccPtr_;
89 mutable VRWGraph* ecPtr_;
92 mutable VRWGraph* pcPtr_;
95 mutable VRWGraph* efPtr_;
98 mutable VRWGraph* pfPtr_;
101 mutable VRWGraph* cePtr_;
104 mutable VRWGraph* fePtr_;
107 mutable VRWGraph* pePtr_;
110 mutable VRWGraph* ppPtr_;
113 mutable VRWGraph* cpPtr_;
119 mutable vectorField* cellCentresPtr_;
122 mutable vectorField* faceCentresPtr_;
125 mutable scalarField* cellVolumesPtr_;
128 mutable vectorField* faceAreasPtr_;
130 // Parallel demand driven data
132 //- global point labels
133 mutable labelLongList* globalPointLabelPtr_;
135 //- global face labels
136 mutable labelLongList* globalFaceLabelPtr_;
138 //- global cell labels
139 mutable labelLongList* globalCellLabelPtr_;
141 //- global edge labels
142 mutable labelLongList* globalEdgeLabelPtr_;
144 // Parallel addressing
146 //- processors containing a vertex
147 mutable VRWGraph* pProcsPtr_;
149 //- global to local point adressing
150 mutable Map<label>* globalToLocalPointAddressingPtr_;
152 //- neighbour processors sharing a point with this processor
153 mutable DynList<label>* pointNeiProcsPtr_;
155 //- processors containing an edge
156 mutable VRWGraph* eProcsPtr_;
158 //- global to local edge addressing
159 mutable Map<label>* globalToLocalEdgeAddressingPtr_;
161 //- neighbour processors sharing an edge with the current processor
162 mutable DynList<label>* edgeNeiProcsPtr_;
165 // Private member functions
167 //- Disallow construct as copy
168 polyMeshGenAddressing(const polyMeshGenAddressing&);
170 //- Disallow default bitwise assignment
171 void operator=(const polyMeshGenAddressing&);
174 // Private member functions to calculate demand driven data
176 // Topological calculations
178 //- Calculate cell-cell addressing
179 void calcCellCells() const;
181 //- Calculate cell-edge addressing
182 void calcEdgeCells() const;
184 //- Calculate point-cell addressing
185 void calcPointCells() const;
187 //- Calculate edge-face addressing
188 void calcEdgeFaces() const;
190 //- Calculate face-edge addressing
191 void calcFaceEdges() const;
193 //- Calculate point-face addressing
194 void calcPointFaces() const;
196 //- Calculate edge list
197 void calcCellEdges() const;
199 //- Calculate point-edge addressing
200 void calcPointEdges() const;
202 //- Calculate point-point addressing
203 void calcPointPoints() const;
205 //- Calculate cell-point addressing
206 void calcCellPoints() const;
208 //- During edge calculation, a larger set of data is assembled.
209 // Create and destroy as a set, using clearOutEdges()
210 void calcEdges() const;
211 void clearOutEdges();
213 // Parallel calculations
215 //- calculate global point labels
216 void calcGlobalPointLabels() const;
218 //- calculate global face labels
219 void calcGlobalFaceLabels() const;
221 //- calculate global cell labels
222 void calcGlobalCellLabels() const;
224 //- calculate global edge labels
225 void calcGlobalEdgeLabels() const;
227 // Geometrical calculations
229 //- Calculate face centres and areas
230 void calcFaceCentresAndAreas() const;
231 void makeFaceCentresAndAreas
233 const pointFieldPMG& p,
238 //- Calculate cell centres and volumes
239 void calcCellCentresAndVols() const;
240 void makeCellCentresAndVols
242 const vectorField& fCtrs,
243 const vectorField& fAreas,
244 vectorField& cellCtrs,
245 scalarField& cellVols
248 //- Calculate edge vectors
249 void calcEdgeVectors() const;
251 // Disallow bitwise construct
252 //- Default constructor
253 polyMeshGenAddressing();
259 ClassName("polyMeshGenAddressing");
261 /* //- Estimated number of cells per edge
262 static const unsigned cellsPerEdge_ = 4;
264 //- Estimated number of cells per point
265 static const unsigned cellsPerPoint_ = 8;
267 //- Estimated number of faces per cell
268 static const unsigned facesPerCell_ = 6;
270 //- Estimated number of faces per edge
271 static const unsigned facesPerEdge_ = 4;
273 //- Estimated number of faces per point
274 static const unsigned facesPerPoint_ = 12;
276 //- Estimated number of edges per cell
277 static const unsigned edgesPerCell_ = 12;
279 //- Estimated number of edges per cell
280 static const unsigned edgesPerFace_ = 4;
282 //- Estimated number of edges per point
283 static const unsigned edgesPerPoint_ = 6;
285 //- Estimated number of points per cell
286 static const unsigned pointsPerCell_ = 8;
288 //- Estimated number of points per face
289 static const unsigned pointsPerFace_ = 4;
293 //- Construct from components
294 polyMeshGenAddressing(const polyMeshGenCells& mesh);
299 ~polyMeshGenAddressing();
304 // Primitive mesh data
306 //- Return mesh edges
307 const edgeList& edges() const;
309 // Return mesh connectivity
311 const VRWGraph& cellCells() const;
312 // faceCells given as faceOwner and faceNeighbour
313 const VRWGraph& edgeCells() const;
314 const VRWGraph& pointCells() const;
316 // faceFaces considered unnecessary
317 const VRWGraph& edgeFaces() const;
318 const VRWGraph& pointFaces() const;
320 const VRWGraph& cellEdges() const;
321 const VRWGraph& faceEdges() const;
322 // edgeEdges considered unnecessary
323 const VRWGraph& pointEdges() const;
324 const VRWGraph& pointPoints() const;
325 const VRWGraph& cellPoints() const;
327 // Parallel addressing
329 const labelLongList& globalPointLabel() const;
330 const labelLongList& globalFaceLabel() const;
331 const labelLongList& globalCellLabel() const;
332 const labelLongList& globalEdgeLabel() const;
334 const VRWGraph& pointAtProcs() const;
335 const Map<label>& globalToLocalPointAddressing() const;
336 const DynList<label>& pointNeiProcs() const;
337 const VRWGraph& edgeAtProcs() const;
338 const Map<label>& globalToLocalEdgeAddressing() const;
339 const DynList<label>& edgeNeiProcs() const;
341 // Geometric data (raw!)
343 const vectorField& cellCentres() const;
344 const vectorField& faceCentres() const;
345 const scalarField& cellVolumes() const;
346 const vectorField& faceAreas() const;
348 // Storage management
350 //- Print a list of all the currently allocated mesh data
351 void printAllocated() const;
356 //- Clear topological data
357 void clearAddressing();
359 //- Clear parallel addressing
360 void clearParallelAddressing();
362 //- Clear all geometry and addressing unnecessary for CFD
365 //- Clear everything primitive, geometry and addressing
368 // Update geometry data
369 void updateGeometry(const boolList& changedFace);
373 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
375 } // End namespace Foam
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
381 // ************************************************************************* //