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 Modifier for polyMeshGen
33 \*---------------------------------------------------------------------------*/
35 #ifndef polyMeshGenModifier_H
36 #define polyMeshGenModifier_H
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 #include "polyMeshGen.H"
43 #include "demandDrivenData.H"
48 // Forward declarations
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 class polyMeshGenModifier
56 //- reference to the mesh
59 //- helper data for adding cells
60 VRWGraph* pointFacesPtr_;
62 // Private member functions
63 //- calculate and return point faces
64 inline void calculatePointFaces()
66 const faceListPMG& faces = mesh_.faces();
68 pointFacesPtr_ = new VRWGraph();
69 VRWGraph& pointFaces = *pointFacesPtr_;
71 pointFaces.reverseAddressing(mesh_.points().size(), faces);
74 //- re-order positions of processor boundary faces
75 //- they should comea immediately after the internal faces
76 void reorderProcBoundaryFaces();
80 VRWGraph& pointFaces()
83 calculatePointFaces();
85 return *pointFacesPtr_;
91 //- Construct from the reference to the mesh
92 polyMeshGenModifier(polyMeshGen& mesh)
101 ~polyMeshGenModifier()
107 //- access to mesh points
108 inline pointFieldPMG& pointsAccess()
110 return mesh_.points_;
113 //- access to mesh faces
114 inline faceListPMG& facesAccess()
120 inline cellListPMG& cellsAccess()
125 //- access to processor boundary data
126 inline PtrList<processorBoundaryPatch>& procBoundariesAccess()
128 return mesh_.procBoundaries_;
131 //- access to boundary data
132 inline PtrList<boundaryPatch>& boundariesAccess()
134 return mesh_.boundaries_;
137 //- functions which change the mesh
138 //- reorder boundary faces
139 void reorderBoundaryFaces();
141 //- remove unused vertices
142 void removeUnusedVertices();
145 void removeFaces(const boolList& removeFace);
147 //- remove duplicate faces from the mesh
148 void removeDuplicateFaces();
153 const boolList& removeCell,
154 const bool removeProcFaces = true
157 //- add cells (vertices must be added)
158 void addCells(const LongList<faceList>& cellFaces);
159 void addCells(const VRWGraphList& cellFaces);
160 void addCell(const faceList& cellFaces);
162 //- replace the boundary with new boundary faces
165 const wordList& patchNames,
166 const VRWGraph& boundaryFaces,
167 const labelLongList& faceOwners,
168 const labelLongList& facePatches
171 //- add additional faces into processor patches
172 void addProcessorFaces
174 const VRWGraph& procFaces,
175 const labelLongList& facePatches
178 //- add new processor patch and return its label
179 label addProcessorPatch(const label otherProcLabel);
181 //- remove empty processor patch
182 bool removeEmptyProcessorPatches();
184 //- add buffer cells needed for exporting the mesh in the format
185 //- required by some solvers
186 void addBufferCells();
188 //- zip up topologically open cells
191 //- reorder the cells and faces to reduce the matrix bandwidth
194 //- clear out unnecessary data (pointFacesPtr_);
195 inline void clearOut()
197 deleteDemandDrivenData(pointFacesPtr_);
200 //- clear out all allocated data
201 inline void clearAll()
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //