autoRefineDriver.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::autoRefineDriver
26 
27 Description
28 
29 SourceFiles
30  autoRefineDriver.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef autoRefineDriver_H
35 #define autoRefineDriver_H
36 
37 #include "wordPairHashTable.H"
38 #include "labelList.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward declaration of classes
46 class refinementParameters;
47 class snapParameters;
48 
49 class meshRefinement;
50 class decompositionMethod;
51 class fvMeshDistribute;
52 
53 /*---------------------------------------------------------------------------*\
54  Class autoRefineDriver Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class autoRefineDriver
58 {
59  // Private data
60 
61  //- Mesh+surface
63 
64  //- Reference to decomposition method
66 
67  //- Reference to mesh distribution engine
69 
70  //- From surface region to patch
72 
73  //- From surface region to patch
75 
76 
77  // Private Member Functions
78 
79  //- Refine all cells pierced by explicit feature edges
81  (
82  const refinementParameters& refineParams,
83  const label maxIter,
84  const label minRefine
85  );
86 
87  //- Refine all cells containing small surface features
89  (
90  const refinementParameters& refineParams,
91  const label maxIter
92  );
93 
94  //- Refine all cells interacting with the surface
96  (
97  const refinementParameters& refineParams,
98  const label maxIter
99  );
100 
101  //- Refine all cells in small gaps
103  (
104  const refinementParameters& refineParams,
105  const label maxIter
106  );
107 
108  //- Refine all cells in large gaps
110  (
111  const refinementParameters& refineParams,
112  const bool spreadGapSize,
113  const label maxIter
114  );
115 
116  //- Refine cells with almost all sides refined
118  (
119  const refinementParameters& refineParams,
120  const label nFaces,
121  const label maxIter
122  );
123 
124  //- Refine cells with opposite faces with differing refinement level
126  (
127  const refinementParameters& refineParams,
128  const label maxIter
129  );
130 
131  //- Remove all cells within intersected region
132  void removeInsideCells
133  (
134  const refinementParameters& refineParams,
135  const label nBufferLayers
136  );
137 
138  //- Remove all cells inside/outside shell
140  (
141  const refinementParameters& refineParams,
142  const label maxIter
143  );
144 
145  //- Add baffles and remove unreachable cells
146  void baffleAndSplitMesh
147  (
148  const refinementParameters& refineParams,
149  const snapParameters& snapParams,
150  const bool handleSnapProblems,
151  const dictionary& motionDict
152  );
153 
154  //- Add zones
155  void zonify
156  (
157  const refinementParameters& refineParams,
158  wordPairHashTable& zonesToFaceZone
159  );
160 
162  (
163  const refinementParameters& refineParams,
164  const snapParameters& snapParams,
165  const bool handleSnapProblems,
166  const dictionary& motionDict
167  );
168 
169  //- Merge refined boundary faces (from exposing coarser cell)
170  void mergePatchFaces
171  (
172  const bool geometricMerge,
173  const refinementParameters& refineParams,
174  const dictionary& motionDict
175  );
176 
177  //- Disallow default bitwise copy construct
179 
180  //- Disallow default bitwise assignment
181  void operator=(const autoRefineDriver&);
182 
183 
184 public:
185 
186  //- Runtime type information
187  ClassName("autoRefineDriver");
188 
189 
190  // Constructors
191 
192  //- Construct from components
194  (
195  meshRefinement& meshRefiner,
196  decompositionMethod& decomposer,
197  fvMeshDistribute& distributor,
198  const labelList& globalToMasterPatch,
199  const labelList& globalToSlavePatch
200  );
201 
202 
203  // Member Functions
204 
205  //- Do all the refinement
206  void doRefine
207  (
208  const dictionary& refineDict,
209  const refinementParameters& refineParams,
210  const snapParameters& snapParams,
211  const bool prepareForSnapping,
212  const bool mergePatchFaces,
213  const dictionary& motionDict
214  );
215 
216  //- Helper: add faceZones and patches
217  static void addFaceZones
218  (
219  meshRefinement& meshRefiner,
220  const refinementParameters& refineParams,
221  const HashTable<Pair<word> >& faceZoneToPatches
222  );
223 
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 } // End namespace Foam
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 #endif
234 
235 // ************************************************************************* //
Foam::autoRefineDriver::meshRefiner_
meshRefinement & meshRefiner_
Mesh+surface.
Definition: autoRefineDriver.H:61
Foam::autoRefineDriver::addFaceZones
static void addFaceZones(meshRefinement &meshRefiner, const refinementParameters &refineParams, const HashTable< Pair< word > > &faceZoneToPatches)
Helper: add faceZones and patches.
Definition: autoRefineDriver.C:1762
Foam::autoRefineDriver::decomposer_
decompositionMethod & decomposer_
Reference to decomposition method.
Definition: autoRefineDriver.H:64
Foam::autoRefineDriver::baffleAndSplitMesh
void baffleAndSplitMesh(const refinementParameters &refineParams, const snapParameters &snapParams, const bool handleSnapProblems, const dictionary &motionDict)
Add baffles and remove unreachable cells.
Definition: autoRefineDriver.C:1511
Foam::autoRefineDriver::removeInsideCells
void removeInsideCells(const refinementParameters &refineParams, const label nBufferLayers)
Remove all cells within intersected region.
Definition: autoRefineDriver.C:1290
Foam::autoRefineDriver::splitAndMergeBaffles
void splitAndMergeBaffles(const refinementParameters &refineParams, const snapParameters &snapParams, const bool handleSnapProblems, const dictionary &motionDict)
Definition: autoRefineDriver.C:1637
Foam::autoRefineDriver
Definition: autoRefineDriver.H:56
Foam::autoRefineDriver::refinementInterfaceRefine
label refinementInterfaceRefine(const refinementParameters &refineParams, const label maxIter)
Refine cells with opposite faces with differing refinement level.
Definition: autoRefineDriver.C:950
Foam::autoRefineDriver::bigGapOnlyRefine
label bigGapOnlyRefine(const refinementParameters &refineParams, const bool spreadGapSize, const label maxIter)
Refine all cells in large gaps.
Definition: autoRefineDriver.C:662
Foam::autoRefineDriver::zonify
void zonify(const refinementParameters &refineParams, wordPairHashTable &zonesToFaceZone)
Add zones.
Definition: autoRefineDriver.C:1574
Foam::autoRefineDriver::featureEdgeRefine
label featureEdgeRefine(const refinementParameters &refineParams, const label maxIter, const label minRefine)
Refine all cells pierced by explicit feature edges.
Definition: autoRefineDriver.C:76
Foam::autoRefineDriver::gapOnlyRefine
label gapOnlyRefine(const refinementParameters &refineParams, const label maxIter)
Refine all cells in small gaps.
Definition: autoRefineDriver.C:431
Foam::snapParameters
Simple container to keep together snap specific information.
Definition: snapParameters.H:50
Foam::autoRefineDriver::globalToMasterPatch_
const labelList globalToMasterPatch_
From surface region to patch.
Definition: autoRefineDriver.H:70
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
labelList.H
Foam::autoRefineDriver::mergePatchFaces
void mergePatchFaces(const bool geometricMerge, const refinementParameters &refineParams, const dictionary &motionDict)
Merge refined boundary faces (from exposing coarser cell)
Definition: autoRefineDriver.C:1836
Foam::refinementParameters
Simple container to keep together refinement specific information.
Definition: refinementParameters.H:55
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::decompositionMethod
Abstract base class for decomposition.
Definition: decompositionMethod.H:48
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::autoRefineDriver::operator=
void operator=(const autoRefineDriver &)
Disallow default bitwise assignment.
Foam::autoRefineDriver::danglingCellRefine
label danglingCellRefine(const refinementParameters &refineParams, const label nFaces, const label maxIter)
Refine cells with almost all sides refined.
Definition: autoRefineDriver.C:804
Foam::autoRefineDriver::autoRefineDriver
autoRefineDriver(const autoRefineDriver &)
Disallow default bitwise copy construct.
Foam::HashTable
An STL-conforming hash table.
Definition: HashTable.H:61
Foam::autoRefineDriver::smallFeatureRefine
label smallFeatureRefine(const refinementParameters &refineParams, const label maxIter)
Refine all cells containing small surface features.
Definition: autoRefineDriver.C:186
wordPairHashTable.H
Foam::autoRefineDriver::distributor_
fvMeshDistribute & distributor_
Reference to mesh distribution engine.
Definition: autoRefineDriver.H:67
Foam::Pair< word >
Foam::autoRefineDriver::surfaceOnlyRefine
label surfaceOnlyRefine(const refinementParameters &refineParams, const label maxIter)
Refine all cells interacting with the surface.
Definition: autoRefineDriver.C:308
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::autoRefineDriver::doRefine
void doRefine(const dictionary &refineDict, const refinementParameters &refineParams, const snapParameters &snapParams, const bool prepareForSnapping, const bool mergePatchFaces, const dictionary &motionDict)
Do all the refinement.
Definition: autoRefineDriver.C:1887
Foam::meshRefinement
Helper class which maintains intersections of (changing) mesh with (static) surfaces.
Definition: meshRefinement.H:82
Foam::autoRefineDriver::shellRefine
label shellRefine(const refinementParameters &refineParams, const label maxIter)
Remove all cells inside/outside shell.
Definition: autoRefineDriver.C:1338
Foam::autoRefineDriver::globalToSlavePatch_
const labelList globalToSlavePatch_
From surface region to patch.
Definition: autoRefineDriver.H:73
Foam::fvMeshDistribute
Sends/receives parts of mesh+fvfields to neighbouring processors. Used in load balancing.
Definition: fvMeshDistribute.H:70
Foam::autoRefineDriver::ClassName
ClassName("autoRefineDriver")
Runtime type information.