FreeFOAM The Cross-Platform CFD Toolkit
autoHexMeshDriver.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) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
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::autoHexMeshDriver
26 
27 Description
28  main meshing driver.
29 
30 SourceFiles
31  autoHexMeshDriver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef autoHexMeshDriver_H
36 #define autoHexMeshDriver_H
37 
38 #include <OpenFOAM/autoPtr.H>
39 #include <OpenFOAM/dictionary.H>
40 #include <meshTools/wallPoint.H>
43 #include <autoMesh/shellSurfaces.H>
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Class forward declarations
54 class fvMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class autoHexMeshDriver Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62  // Static data members
63 
64  //- Extrusion controls
65  enum extrudeMode
66  {
67  NOEXTRUDE,
68  EXTRUDE,
69  EXTRUDEREMOVE
71  };
72 
73 
74  // Private classes
75 
76  //- Combine operator class for equalizing displacements.
77  class minMagEqOp
78  {
79  public:
80 
81  void operator()(vector& x, const vector& y) const
82  {
83  if (magSqr(y) < magSqr(x))
84  {
85  x = y;
86  }
87  }
88  };
89 
90  //- Combine operator class to combine normal with other normal.
91  class nomalsCombine
92  {
93  public:
94 
95  void operator()(vector& x, const vector& y) const
96  {
97  if (y != wallPoint::greatPoint)
98  {
99  if (x == wallPoint::greatPoint)
100  {
101  x = y;
102  }
103  else
104  {
105  x *= (x&y);
106  }
107  }
108  }
109  };
110 
111 
112 
113  // Private data
114 
115  //- Reference to mesh
116  fvMesh& mesh_;
117 
118  //- Input dictionary
119  const dictionary dict_;
120 
121  //- Debug level
122  const label debug_;
123 
124  //- Merge distance
125  const scalar mergeDist_;
126 
127 
128  //- All surface based geometry
129  autoPtr<searchableSurfaces> allGeometryPtr_;
130 
131  //- Shells (geometry for inside/outside refinement)
132  autoPtr<shellSurfaces> shellsPtr_;
133 
134  //- Surfaces (geometry for intersection based refinement)
135  autoPtr<refinementSurfaces> surfacesPtr_;
136 
137  //- Per refinement surface region the patch
138  labelList globalToPatch_;
139 
140  //- Mesh refinement engine
141  autoPtr<meshRefinement> meshRefinerPtr_;
142 
143  //- Decomposition engine
144  autoPtr<decompositionMethod> decomposerPtr_;
145 
146  //- Mesh distribution engine
147  autoPtr<fvMeshDistribute> distributorPtr_;
148 
149 
150 
151  // Private Member Functions
152 
153  //- Calculate merge distance. Check against writing tolerance.
154  scalar getMergeDistance(const scalar mergeTol) const;
155 
156  //static void orientOutside(PtrList<searchableSurface>&);
157 
158  //- Disallow default bitwise copy construct
160 
161  //- Disallow default bitwise assignment
162  void operator=(const autoHexMeshDriver&);
163 
164 public:
165 
166  //- Runtime type information
167  ClassName("autoHexMeshDriver");
168 
169 
170  // Constructors
171 
172  //- Construct from dictionary and mesh to modify
174  (
175  fvMesh& mesh,
176  const bool overwrite,
177  const dictionary& meshDict,
178  const dictionary& decomposeDict
179  );
180 
181 
182  // Member Functions
183 
184  // Access
185 
186  //- reference to mesh
187  const fvMesh& mesh() const
188  {
189  return mesh_;
190  }
192  {
193  return mesh_;
194  }
195 
196  //- Surfaces to base refinement on
198  {
199  return surfacesPtr_();
200  }
201 
202  //- Surfaces to volume refinement on
203  const shellSurfaces& shells() const
204  {
205  return shellsPtr_();
206  }
207 
208  //- Per refinementsurface, per region the patch
209  const labelList& globalToPatch() const
210  {
211  return globalToPatch_;
212  }
213 
214 
215  // Meshing
216 
217  //- Write mesh
218  void writeMesh(const string&) const;
219 
220  //- Do all : refine, snap, layers
221  void doMesh();
222 };
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************ vim: set sw=4 sts=4 et: ************************ //