initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / autoMesh / autoHexMesh / autoHexMeshDriver / autoHexMeshDriver.H
blob553f1690b8e9837e3ee5264d8bb5ef433b3d0629
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::autoHexMeshDriver
28 Description
29     main meshing driver.
31 SourceFiles
32     autoHexMeshDriver.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef autoHexMeshDriver_H
37 #define autoHexMeshDriver_H
39 #include "autoPtr.H"
40 #include "dictionary.H"
41 #include "pointField.H"
42 #include "boolList.H"
43 #include "wallPoint.H"
44 #include "searchableSurfaces.H"
45 #include "refinementSurfaces.H"
46 #include "shellSurfaces.H"
47 #include "meshRefinement.H"
48 #include "decompositionMethod.H"
49 #include "fvMeshDistribute.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 // Class forward declarations
57 class fvMesh;
59 /*---------------------------------------------------------------------------*\
60                            Class autoHexMeshDriver Declaration
61 \*---------------------------------------------------------------------------*/
63 class autoHexMeshDriver
65     // Static data members
67         //- Extrusion controls
68         enum extrudeMode
69         {
70             NOEXTRUDE,      /*!< Do not extrude. No layers added. */
71             EXTRUDE,        /*!< Extrude */
72             EXTRUDEREMOVE   /*!< Extrude but afterwards remove added */
73                             /*!< faces locally */
74         };
77     // Private classes
79         //- Combine operator class for equalizing displacements.
80         class minMagEqOp
81         {
82         public:
84             void operator()(vector& x, const vector& y) const
85             {
86                 if (magSqr(y) < magSqr(x))
87                 {
88                     x = y;
89                 }
90             }
91         };
93         //- Combine operator class to combine normal with other normal.
94         class nomalsCombine
95         {
96         public:
98             void operator()(vector& x, const vector& y) const
99             {
100                 if (y != wallPoint::greatPoint)
101                 {
102                     if (x == wallPoint::greatPoint)
103                     {
104                         x = y;
105                     }
106                     else
107                     {
108                         x *= (x&y);
109                     }
110                 }
111             }
112         };
116     // Private data
118         //- Reference to mesh
119         fvMesh& mesh_;
121         //- Input dictionary
122         const dictionary dict_;
124         //- Debug level
125         const label debug_;
127         //- Merge distance
128         const scalar mergeDist_;
131         //- All surface based geometry
132         autoPtr<searchableSurfaces> allGeometryPtr_;
134         //- Shells (geometry for inside/outside refinement)
135         autoPtr<shellSurfaces> shellsPtr_;
137         //- Surfaces (geometry for intersection based refinement)
138         autoPtr<refinementSurfaces> surfacesPtr_;
140         //- Per refinement surface region the patch
141         labelList globalToPatch_;
143         //- Mesh refinement engine
144         autoPtr<meshRefinement> meshRefinerPtr_;
146         //- Decomposition engine
147         autoPtr<decompositionMethod> decomposerPtr_;
149         //- Mesh distribution engine
150         autoPtr<fvMeshDistribute> distributorPtr_;
154     // Private Member Functions
156         //- Calculate merge distance. Check against writing tolerance.
157         scalar getMergeDistance(const scalar mergeTol) const;
159         //static void orientOutside(PtrList<searchableSurface>&);
161         //- Disallow default bitwise copy construct
162         autoHexMeshDriver(const autoHexMeshDriver&);
164         //- Disallow default bitwise assignment
165         void operator=(const autoHexMeshDriver&);
167 public:
169     //- Runtime type information
170     ClassName("autoHexMeshDriver");
173     // Constructors
175         //- Construct from dictionary and mesh to modify
176         autoHexMeshDriver
177         (
178             fvMesh& mesh,
179             const dictionary& meshDict,
180             const dictionary& decomposeDict
181         );
184     // Member Functions
186         // Access
188             //- reference to mesh
189             const fvMesh& mesh() const
190             {
191                 return mesh_;
192             }
193             fvMesh& mesh()
194             {
195                 return mesh_;
196             }
198             //- Surfaces to base refinement on
199             const refinementSurfaces& surfaces() const
200             {
201                 return surfacesPtr_();
202             }
204             //- Surfaces to volume refinement on
205             const shellSurfaces& shells() const
206             {
207                 return shellsPtr_();
208             }
210             //- Per refinementsurface, per region the patch
211             const labelList& globalToPatch() const
212             {
213                 return globalToPatch_;
214             }
217         // Meshing
219             //- Write mesh
220             void writeMesh(const string&) const;
222             //- Do all : refine, snap, layers
223             void doMesh();
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 } // End namespace Foam
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 #endif
235 // ************************************************************************* //