OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

autoHexMeshDriver.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::autoHexMeshDriver
00027 
00028 Description
00029     main meshing driver.
00030 
00031 SourceFiles
00032     autoHexMeshDriver.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef autoHexMeshDriver_H
00037 #define autoHexMeshDriver_H
00038 
00039 #include "autoPtr.H"
00040 #include "dictionary.H"
00041 #include "wallPoint.H"
00042 #include "searchableSurfaces.H"
00043 #include "refinementSurfaces.H"
00044 #include "shellSurfaces.H"
00045 #include "meshRefinement.H"
00046 #include "decompositionMethod.H"
00047 #include "fvMeshDistribute.H"
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 // Class forward declarations
00055 class fvMesh;
00056 
00057 /*---------------------------------------------------------------------------*\
00058                            Class autoHexMeshDriver Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 class autoHexMeshDriver
00062 {
00063     // Static data members
00064 
00065         //- Extrusion controls
00066         enum extrudeMode
00067         {
00068             NOEXTRUDE,      
00069             EXTRUDE,        
00070             EXTRUDEREMOVE   
00072         };
00073 
00074 
00075     // Private classes
00076 
00077         //- Combine operator class for equalizing displacements.
00078         class minMagEqOp
00079         {
00080         public:
00081 
00082             void operator()(vector& x, const vector& y) const
00083             {
00084                 if (magSqr(y) < magSqr(x))
00085                 {
00086                     x = y;
00087                 }
00088             }
00089         };
00090 
00091         //- Combine operator class to combine normal with other normal.
00092         class nomalsCombine
00093         {
00094         public:
00095 
00096             void operator()(vector& x, const vector& y) const
00097             {
00098                 if (y != wallPoint::greatPoint)
00099                 {
00100                     if (x == wallPoint::greatPoint)
00101                     {
00102                         x = y;
00103                     }
00104                     else
00105                     {
00106                         x *= (x&y);
00107                     }
00108                 }
00109             }
00110         };
00111 
00112 
00113 
00114     // Private data
00115 
00116         //- Reference to mesh
00117         fvMesh& mesh_;
00118 
00119         //- Input dictionary
00120         const dictionary dict_;
00121 
00122         //- Debug level
00123         const label debug_;
00124 
00125         //- Merge distance
00126         const scalar mergeDist_;
00127 
00128 
00129         //- All surface based geometry
00130         autoPtr<searchableSurfaces> allGeometryPtr_;
00131 
00132         //- Shells (geometry for inside/outside refinement)
00133         autoPtr<shellSurfaces> shellsPtr_;
00134 
00135         //- Surfaces (geometry for intersection based refinement)
00136         autoPtr<refinementSurfaces> surfacesPtr_;
00137 
00138         //- Per refinement surface region the patch
00139         labelList globalToPatch_;
00140 
00141         //- Mesh refinement engine
00142         autoPtr<meshRefinement> meshRefinerPtr_;
00143 
00144         //- Decomposition engine
00145         autoPtr<decompositionMethod> decomposerPtr_;
00146 
00147         //- Mesh distribution engine
00148         autoPtr<fvMeshDistribute> distributorPtr_;
00149 
00150 
00151 
00152     // Private Member Functions
00153 
00154         //- Calculate merge distance. Check against writing tolerance.
00155         scalar getMergeDistance(const scalar mergeTol) const;
00156 
00157         //static void orientOutside(PtrList<searchableSurface>&);
00158 
00159         //- Disallow default bitwise copy construct
00160         autoHexMeshDriver(const autoHexMeshDriver&);
00161 
00162         //- Disallow default bitwise assignment
00163         void operator=(const autoHexMeshDriver&);
00164 
00165 public:
00166 
00167     //- Runtime type information
00168     ClassName("autoHexMeshDriver");
00169 
00170 
00171     // Constructors
00172 
00173         //- Construct from dictionary and mesh to modify
00174         autoHexMeshDriver
00175         (
00176             fvMesh& mesh,
00177             const bool overwrite,
00178             const dictionary& meshDict,
00179             const dictionary& decomposeDict
00180         );
00181 
00182 
00183     // Member Functions
00184 
00185         // Access
00186 
00187             //- reference to mesh
00188             const fvMesh& mesh() const
00189             {
00190                 return mesh_;
00191             }
00192             fvMesh& mesh()
00193             {
00194                 return mesh_;
00195             }
00196 
00197             //- Surfaces to base refinement on
00198             const refinementSurfaces& surfaces() const
00199             {
00200                 return surfacesPtr_();
00201             }
00202 
00203             //- Surfaces to volume refinement on
00204             const shellSurfaces& shells() const
00205             {
00206                 return shellsPtr_();
00207             }
00208 
00209             //- Per refinementsurface, per region the patch
00210             const labelList& globalToPatch() const
00211             {
00212                 return globalToPatch_;
00213             }
00214 
00215 
00216         // Meshing
00217 
00218             //- Write mesh
00219             void writeMesh(const string&) const;
00220 
00221             //- Do all : refine, snap, layers
00222             void doMesh();
00223 };
00224 
00225 
00226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00227 
00228 } // End namespace Foam
00229 
00230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00231 
00232 #endif
00233 
00234 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd