polyMeshGenModifier.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  polyMeshGenModifier
26 
27 Description
28  Modifier for polyMeshGen
29 
30 SourceFiles
31  polyMeshGenModifier.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef polyMeshGenModifier_H
36 #define polyMeshGenModifier_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 #include "polyMeshGen.H"
41 #include "boolList.H"
42 #include "VRWGraph.H"
43 #include "demandDrivenData.H"
44 
45 namespace Foam
46 {
47 
48 // Forward declarations
49 class VRWGraphList;
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
54 {
55  // Private data
56  //- reference to the mesh
58 
59  //- helper data for adding cells
61 
62  // Private member functions
63  //- calculate and return point faces
64  inline void calculatePointFaces()
65  {
66  const faceListPMG& faces = mesh_.faces();
67 
68  pointFacesPtr_ = new VRWGraph();
70 
72  };
73 
74  //- re-order positions of processor boundary faces
75  //- they should comea immediately after the internal faces
77 
78 protected:
79 
81  {
82  if( !pointFacesPtr_ )
84 
85  return *pointFacesPtr_;
86  };
87 
88 public:
89 
90  // Constructors
91  //- Construct from the reference to the mesh
93  :
94  mesh_(mesh),
95  pointFacesPtr_(NULL)
96  {
97  //mesh_.clearOut();
98  };
99 
100  // Destructor
102  {
103  this->clearOut();
104  };
105 
106  // Member functions
107  //- access to mesh points
108  inline pointFieldPMG& pointsAccess()
109  {
110  return mesh_.points_;
111  };
112 
113  //- access to mesh faces
114  inline faceListPMG& facesAccess()
115  {
116  return mesh_.faces_;
117  };
118 
119  //- access to cells
120  inline cellListPMG& cellsAccess()
121  {
122  return mesh_.cells_;
123  };
124 
125  //- access to processor boundary data
127  {
128  return mesh_.procBoundaries_;
129  }
130 
131  //- access to boundary data
133  {
134  return mesh_.boundaries_;
135  }
136 
137  //- functions which change the mesh
138  //- reorder boundary faces
139  void reorderBoundaryFaces();
140 
141  //- remove unused vertices
142  void removeUnusedVertices();
143 
144  //- remove faces
145  void removeFaces(const boolList& removeFace);
146 
147  //- remove duplicate faces from the mesh
148  void removeDuplicateFaces();
149 
150  //- remove cells
151  void removeCells
152  (
153  const boolList& removeCell,
154  const bool removeProcFaces = true
155  );
156 
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);
161 
162  //- replace the boundary with new boundary faces
163  void replaceBoundary
164  (
165  const wordList& patchNames,
166  const VRWGraph& boundaryFaces,
167  const labelLongList& faceOwners,
168  const labelLongList& facePatches
169  );
170 
171  //- add additional faces into processor patches
172  void addProcessorFaces
173  (
174  const VRWGraph& procFaces,
175  const labelLongList& facePatches
176  );
177 
178  //- add new processor patch and return its label
179  label addProcessorPatch(const label otherProcLabel);
180 
181  //- remove empty processor patch
183 
184  //- add buffer cells needed for exporting the mesh in the format
185  //- required by some solvers
186  void addBufferCells();
187 
188  //- zip up topologically open cells
189  void zipUpCells();
190 
191  //- reorder the cells and faces to reduce the matrix bandwidth
192  void renumberMesh();
193 
194  //- clear out unnecessary data (pointFacesPtr_);
195  inline void clearOut()
196  {
198  }
199 
200  //- clear out all allocated data
201  inline void clearAll()
202  {
203  clearOut();
204  mesh_.clearOut();
205  }
206 };
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::polyMeshGenModifier::pointFacesPtr_
VRWGraph * pointFacesPtr_
helper data for adding cells
Definition: polyMeshGenModifier.H:59
Foam::polyMeshGenModifier::removeFaces
void removeFaces(const boolList &removeFace)
remove faces
Definition: polyMeshGenModifierRemoveFaces.C:40
boolList.H
Foam::polyMeshGenModifier::removeDuplicateFaces
void removeDuplicateFaces()
remove duplicate faces from the mesh
Definition: polyMeshGenModifierRemoveFaces.C:246
Foam::polyMeshGenModifier::reorderProcBoundaryFaces
void reorderProcBoundaryFaces()
Definition: polyMeshGenModifierReorderBoundaryFaces.C:226
Foam::polyMeshGenModifier::removeEmptyProcessorPatches
bool removeEmptyProcessorPatches()
remove empty processor patch
Definition: polyMeshGenModifierAddProcessorFaces.C:171
Foam::polyMeshGenModifier::pointFaces
VRWGraph & pointFaces()
Definition: polyMeshGenModifier.H:79
VRWGraph.H
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::polyMeshGenModifier::addProcessorPatch
label addProcessorPatch(const label otherProcLabel)
add new processor patch and return its label
Definition: polyMeshGenModifierAddProcessorFaces.C:139
Foam::polyMeshGenModifier::addProcessorFaces
void addProcessorFaces(const VRWGraph &procFaces, const labelLongList &facePatches)
add additional faces into processor patches
Definition: polyMeshGenModifierAddProcessorFaces.C:41
Foam::polyMeshGenModifier::replaceBoundary
void replaceBoundary(const wordList &patchNames, const VRWGraph &boundaryFaces, const labelLongList &faceOwners, const labelLongList &facePatches)
replace the boundary with new boundary faces
Definition: polyMeshGenModifierReplaceBoundary.C:42
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::polyMeshGenPoints::points
const pointFieldPMG & points() const
access to points
Definition: polyMeshGenPointsI.H:44
Foam::polyMeshGenModifier::calculatePointFaces
void calculatePointFaces()
calculate and return point faces
Definition: polyMeshGenModifier.H:63
Foam::polyMeshGenCells::clearOut
void clearOut() const
clear all pointer data
Definition: polyMeshGenCells.C:254
Foam::polyMeshGenModifier::mesh_
polyMeshGen & mesh_
reference to the mesh
Definition: polyMeshGenModifier.H:56
Foam::VRWGraphList
Definition: VRWGraphList.H:51
Foam::cellListPMG
Definition: cellListPMG.H:49
Foam::polyMeshGenFaces::faces
const faceListPMG & faces() const
access to faces
Definition: polyMeshGenFacesI.H:43
Foam::polyMeshGenModifier::boundariesAccess
PtrList< boundaryPatch > & boundariesAccess()
access to boundary data
Definition: polyMeshGenModifier.H:131
Foam::LongList
Definition: LongList.H:55
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::polyMeshGenModifier::procBoundariesAccess
PtrList< processorBoundaryPatch > & procBoundariesAccess()
access to processor boundary data
Definition: polyMeshGenModifier.H:125
Foam::polyMeshGenModifier::cellsAccess
cellListPMG & cellsAccess()
access to cells
Definition: polyMeshGenModifier.H:119
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::polyMeshGenModifier::reorderBoundaryFaces
void reorderBoundaryFaces()
Definition: polyMeshGenModifierReorderBoundaryFaces.C:44
Foam::polyMeshGenFaces::procBoundaries_
PtrList< processorBoundaryPatch > procBoundaries_
Definition: polyMeshGenFaces.H:62
Foam::polyMeshGenModifier::clearOut
void clearOut()
clear out unnecessary data (pointFacesPtr_);
Definition: polyMeshGenModifier.H:194
polyMeshGen.H
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
patchNames
wordList patchNames(nPatches)
Foam::pointFieldPMG::size
label size() const
return the number of used elements
Definition: pointFieldPMGI.H:71
Foam::polyMeshGenModifier::removeUnusedVertices
void removeUnusedVertices()
remove unused vertices
Definition: polyMeshGenModifierRemoveUnusedVertices.C:37
Foam::polyMeshGenModifier::pointsAccess
pointFieldPMG & pointsAccess()
access to mesh points
Definition: polyMeshGenModifier.H:107
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::polyMeshGenModifier::~polyMeshGenModifier
~polyMeshGenModifier()
Definition: polyMeshGenModifier.H:100
Foam::polyMeshGenModifier::renumberMesh
void renumberMesh()
reorder the cells and faces to reduce the matrix bandwidth
Definition: polyMeshGenModifierRenumberMesh.C:42
VRWGraphList
This class is an implementation of a list of graphs with variable column width. The implementation is...
Foam::polyMeshGenModifier
Definition: polyMeshGenModifier.H:52
Foam::VRWGraph::reverseAddressing
void reverseAddressing(const label nRows, const GraphType &origGraph)
Definition: VRWGraphI.H:406
Foam::polyMeshGenFaces::faces_
faceListPMG faces_
list of faces
Definition: polyMeshGenFaces.H:57
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::polyMeshGenCells::cells_
cellListPMG cells_
list of cells
Definition: polyMeshGenCells.H:56
Foam::polyMeshGenModifier::addCell
void addCell(const faceList &cellFaces)
Definition: polyMeshGenModifierAddCells.C:172
Foam::polyMeshGenModifier::polyMeshGenModifier
polyMeshGenModifier(polyMeshGen &mesh)
Construct from the reference to the mesh.
Definition: polyMeshGenModifier.H:91
Foam::polyMeshGenModifier::clearAll
void clearAll()
clear out all allocated data
Definition: polyMeshGenModifier.H:200
Foam::polyMeshGenModifier::addCells
void addCells(const LongList< faceList > &cellFaces)
add cells (vertices must be added)
Definition: polyMeshGenModifierAddCells.C:37
Foam::polyMeshGenModifier::zipUpCells
void zipUpCells()
zip up topologically open cells
Definition: polyMeshGenModifierZipUpCells.C:42
Foam::polyMeshGenModifier::facesAccess
faceListPMG & facesAccess()
access to mesh faces
Definition: polyMeshGenModifier.H:113
Foam::polyMeshGenPoints::points_
pointFieldPMG points_
list of vertices
Definition: polyMeshGenPoints.H:64
Foam::polyMeshGenModifier::addBufferCells
void addBufferCells()
Definition: polyMeshGenModifierAddBufferCells.C:43
Foam::faceListPMG
Definition: faceListPMG.H:50
Foam::polyMeshGenFaces::boundaries_
PtrList< boundaryPatch > boundaries_
boundary data
Definition: polyMeshGenFaces.H:65
Foam::pointFieldPMG
Definition: pointFieldPMG.H:50
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::polyMeshGenModifier::removeCells
void removeCells(const boolList &removeCell, const bool removeProcFaces=true)
remove cells
Definition: polyMeshGenModifierRemoveCells.C:41