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/>.
26 \*---------------------------------------------------------------------------*/
28 #include "meshSurfaceEngine.H"
29 #include "demandDrivenData.H"
35 // #define DEBUGSearch
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 inline const polyMeshGen& meshSurfaceEngine::mesh() const
49 inline const pointFieldPMG& meshSurfaceEngine::points() const
51 return mesh_.points();
54 inline const faceListPMG& meshSurfaceEngine::faces() const
59 inline const cellListPMG& meshSurfaceEngine::cells() const
64 inline const labelList& meshSurfaceEngine::bp() const
69 if( omp_in_parallel() )
72 "const labelList& meshSurfaceEngine::bp() const"
73 ) << "Calculating addressing inside a parallel region."
74 << " This is not thread safe" << exit(FatalError);
77 calculateBoundaryFaces();
78 calculateBoundaryNodes();
84 inline const labelList& meshSurfaceEngine::boundaryPoints() const
86 if( !boundaryPointsPtr_ )
89 if( omp_in_parallel() )
92 "const labelList& meshSurfaceEngine::boundaryPoints() const"
93 ) << "Calculating addressing inside a parallel region."
94 << " This is not thread safe" << exit(FatalError);
97 calculateBoundaryNodes();
100 return *boundaryPointsPtr_;
103 inline const faceList::subList& meshSurfaceEngine::boundaryFaces() const
105 if( !boundaryFacesPtr_ )
108 if( omp_in_parallel() )
111 "const faceList::subList&"
112 "meshSurfaceEngine::boundaryFaces() const"
113 ) << "Calculating addressing inside a parallel region."
114 << " This is not thread safe" << exit(FatalError);
117 calculateBoundaryFaces();
120 return *boundaryFacesPtr_;
123 inline const labelList& meshSurfaceEngine::boundaryFacePatches() const
125 if( !boundaryFacePatchPtr_ )
128 if( omp_in_parallel() )
132 " meshSurfaceEngine::boundaryFacePatches() const"
133 ) << "Calculating addressing inside a parallel region."
134 << " This is not thread safe" << exit(FatalError);
137 calculateBoundaryFacePatches();
140 return *boundaryFacePatchPtr_;
143 inline const labelList& meshSurfaceEngine::faceOwners() const
145 if( !boundaryFaceOwnersPtr_ )
148 if( omp_in_parallel() )
151 "const labelList& meshSurfaceEngine::faceOwners() const"
152 ) << "Calculating addressing inside a parallel region."
153 << " This is not thread safe" << exit(FatalError);
156 calculateBoundaryOwners();
159 return *boundaryFaceOwnersPtr_;
162 inline const VRWGraph& meshSurfaceEngine::pointFaces() const
164 if( !pointFacesPtr_ )
167 if( omp_in_parallel() )
170 "const VRWGraph& meshSurfaceEngine::pointFaces() const"
171 ) << "Calculating addressing inside a parallel region."
172 << " This is not thread safe" << exit(FatalError);
175 calculatePointFaces();
178 return *pointFacesPtr_;
181 inline const VRWGraph& meshSurfaceEngine::pointInFaces() const
183 if( !pointInFacePtr_ )
186 if( omp_in_parallel() )
189 "const VRWGraph& meshSurfaceEngine::pointInFaces() const"
190 ) << "Calculating addressing inside a parallel region."
191 << " This is not thread safe" << exit(FatalError);
194 calculatePointFaces();
197 return *pointInFacePtr_;
200 inline const VRWGraph& meshSurfaceEngine::pointPatches() const
202 if( !pointPatchesPtr_ )
205 if( omp_in_parallel() )
208 "const VRWGraph& meshSurfaceEngine::pointPatches() const"
209 ) << "Calculating addressing inside a parallel region."
210 << " This is not thread safe" << exit(FatalError);
213 calculatePointPatches();
216 return *pointPatchesPtr_;
220 inline const VRWGraph& meshSurfaceEngine::pointPoints() const
222 if( !pointPointsPtr_ )
225 if( omp_in_parallel() )
228 "const VRWGraph& meshSurfaceEngine::pointPoints() const"
229 ) << "Calculating addressing inside a parallel region."
230 << " This is not thread safe" << exit(FatalError);
233 calculatePointPoints();
236 return *pointPointsPtr_;
239 inline const vectorField& meshSurfaceEngine::pointNormals() const
241 if( !pointNormalsPtr_ )
244 if( omp_in_parallel() )
247 "const vectorField& meshSurfaceEngine::pointNormals() const"
248 ) << "Calculating addressing inside a parallel region."
249 << " This is not thread safe" << exit(FatalError);
252 calculatePointNormals();
255 return *pointNormalsPtr_;
258 inline const vectorField& meshSurfaceEngine::faceNormals() const
260 if( !faceNormalsPtr_ )
263 if( omp_in_parallel() )
266 "const vectorField& meshSurfaceEngine::faceNormals() const"
267 ) << "Calculating addressing inside a parallel region."
268 << " This is not thread safe" << exit(FatalError);
271 calculateFaceNormals();
274 return *faceNormalsPtr_;
277 inline const vectorField& meshSurfaceEngine::faceCentres() const
279 if( !faceCentresPtr_ )
282 if( omp_in_parallel() )
285 "const vectorField& meshSurfaceEngine::faceCentres() const"
286 ) << "Calculating addressing inside a parallel region."
287 << " This is not thread safe" << exit(FatalError);
290 calculateFaceCentres();
293 return *faceCentresPtr_;
296 inline const edgeList& meshSurfaceEngine::edges() const
301 if( omp_in_parallel() )
304 "const edgeList& meshSurfaceEngine::edges() const"
305 ) << "Calculating addressing inside a parallel region."
306 << " This is not thread safe" << exit(FatalError);
309 calculateEdgesAndAddressing();
315 inline const VRWGraph& meshSurfaceEngine::boundaryPointEdges() const
320 if( omp_in_parallel() )
323 "const VRWGraph& meshSurfaceEngine::boundaryPointEdges() const"
324 ) << "Calculating addressing inside a parallel region."
325 << " This is not thread safe" << exit(FatalError);
328 calculateEdgesAndAddressing();
334 inline const VRWGraph& meshSurfaceEngine::edgeFaces() const
339 if( omp_in_parallel() )
342 "const VRWGraph& meshSurfaceEngine::edgeFaces() const"
343 ) << "Calculating addressing inside a parallel region."
344 << " This is not thread safe" << exit(FatalError);
347 calculateEdgeFacesAddressing();
350 return *edgeFacesPtr_;
353 inline const VRWGraph& meshSurfaceEngine::faceEdges() const
358 if( omp_in_parallel() )
361 "const VRWGraph& meshSurfaceEngine::faceEdges() const"
362 ) << "Calculating addressing inside a parallel region."
363 << " This is not thread safe" << exit(FatalError);
366 calculateFaceEdgesAddressing();
369 return *faceEdgesPtr_;
372 inline const VRWGraph& meshSurfaceEngine::edgePatches() const
374 if( !edgePatchesPtr_ )
377 if( omp_in_parallel() )
380 "const VRWGraph& meshSurfaceEngine::edgePatches() const"
381 ) << "Calculating addressing inside a parallel region."
382 << " This is not thread safe" << exit(FatalError);
385 calculateEdgePatchesAddressing();
388 return *edgePatchesPtr_;
391 inline const VRWGraph& meshSurfaceEngine::faceFaces() const
396 if( omp_in_parallel() )
399 "const VRWGraph& meshSurfaceEngine::faceFaces() const"
400 ) << "Calculating addressing inside a parallel region."
401 << " This is not thread safe" << exit(FatalError);
404 calculateFaceFacesAddressing();
407 return *faceFacesPtr_;
410 inline const labelList& meshSurfaceEngine::globalBoundaryPointLabel() const
412 if( !globalBoundaryPointLabelPtr_ )
415 if( omp_in_parallel() )
419 " meshSurfaceEngine::globalBoundaryPointLabel() const"
420 ) << "Calculating addressing inside a parallel region."
421 << " This is not thread safe" << exit(FatalError);
424 calcGlobalBoundaryPointLabels();
427 return *globalBoundaryPointLabelPtr_;
430 inline const Map<label>&
431 meshSurfaceEngine::globalToLocalBndPointAddressing() const
433 if( !globalBoundaryPointToLocalPtr_ )
436 if( omp_in_parallel() )
440 " meshSurfaceEngine::globalToLocalBndPointAddressing() const"
441 ) << "Calculating addressing inside a parallel region."
442 << " This is not thread safe" << exit(FatalError);
445 calcGlobalBoundaryPointLabels();
448 return *globalBoundaryPointToLocalPtr_;
451 inline const VRWGraph& meshSurfaceEngine::bpAtProcs() const
453 if( !globalBoundaryPointLabelPtr_ )
456 if( omp_in_parallel() )
459 "const VRWGraph& meshSurfaceEngine::bpAtProcs() const"
460 ) << "Calculating addressing inside a parallel region."
461 << " This is not thread safe" << exit(FatalError);
464 calcGlobalBoundaryPointLabels();
470 inline const DynList<label>& meshSurfaceEngine::bpNeiProcs() const
472 if( !bpNeiProcsPtr_ )
475 if( omp_in_parallel() )
478 "const DynList<label>& meshSurfaceEngine::bpNeiProcs() const"
479 ) << "Calculating addressing inside a parallel region."
480 << " This is not thread safe" << exit(FatalError);
483 calcGlobalBoundaryPointLabels();
486 return *bpNeiProcsPtr_;
489 inline const labelList& meshSurfaceEngine::globalBoundaryEdgeLabel() const
491 if( !globalBoundaryEdgeLabelPtr_ )
494 if( omp_in_parallel() )
498 " meshSurfaceEngine::globalBoundaryEdgeLabel() const"
499 ) << "Calculating addressing inside a parallel region."
500 << " This is not thread safe" << exit(FatalError);
503 calcGlobalBoundaryEdgeLabels();
506 return *globalBoundaryEdgeLabelPtr_;
509 inline const Map<label>&
510 meshSurfaceEngine::globalToLocalBndEdgeAddressing() const
512 if( !globalBoundaryEdgeToLocalPtr_ )
515 if( omp_in_parallel() )
519 " meshSurfaceEngine::globalToLocalBndEdgeAddressing() const"
520 ) << "Calculating addressing inside a parallel region."
521 << " This is not thread safe" << exit(FatalError);
524 calcGlobalBoundaryEdgeLabels();
527 return *globalBoundaryEdgeToLocalPtr_;
530 inline const VRWGraph& meshSurfaceEngine::beAtProcs() const
532 if( !globalBoundaryEdgeLabelPtr_ )
535 if( omp_in_parallel() )
538 "const VRWGraph& meshSurfaceEngine::beAtProcs() const"
539 ) << "Calculating addressing inside a parallel region."
540 << " This is not thread safe" << exit(FatalError);
543 calcGlobalBoundaryEdgeLabels();
549 inline const DynList<label>& meshSurfaceEngine::beNeiProcs() const
551 if( !beNeiProcsPtr_ )
554 if( omp_in_parallel() )
557 "const DynList<label>& meshSurfaceEngine::beNeiProcs() const"
558 ) << "Calculating addressing inside a parallel region."
559 << " This is not thread safe" << exit(FatalError);
562 calcGlobalBoundaryEdgeLabels();
565 return *beNeiProcsPtr_;
568 inline const Map<label>& meshSurfaceEngine::otherEdgeFaceAtProc() const
570 if( !otherEdgeFaceAtProcPtr_ )
573 if( omp_in_parallel() )
577 " meshSurfaceEngine::otherEdgeFaceAtProc() const"
578 ) << "Calculating addressing inside a parallel region."
579 << " This is not thread safe" << exit(FatalError);
582 calcAddressingForProcEdges();
585 return *otherEdgeFaceAtProcPtr_;
588 inline const Map<label>& meshSurfaceEngine::otherEdgeFacePatch() const
590 if( !otherEdgeFacePatchPtr_ )
593 if( omp_in_parallel() )
597 " meshSurfaceEngine::otherEdgeFacePatch() const"
598 ) << "Calculating addressing inside a parallel region."
599 << " This is not thread safe" << exit(FatalError);
602 calcAddressingForProcEdges();
605 return *otherEdgeFacePatchPtr_;
608 inline const labelList& meshSurfaceEngine::globalBoundaryFaceLabel() const
610 if( !globalBoundaryFaceLabelPtr_ )
613 if( omp_in_parallel() )
617 " meshSurfaceEngine::globalBoundaryFaceLabel() const"
618 ) << "Calculating addressing inside a parallel region."
619 << " This is not thread safe" << exit(FatalError);
622 calcGlobalBoundaryFaceLabels();
625 return *globalBoundaryFaceLabelPtr_;
629 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
631 } // End namespace Foam
633 // ************************************************************************* //