FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::autoHexMeshDriver
00026 
00027 Description
00028     main meshing driver.
00029 
00030 SourceFiles
00031     autoHexMeshDriver.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef autoHexMeshDriver_H
00036 #define autoHexMeshDriver_H
00037 
00038 #include <OpenFOAM/autoPtr.H>
00039 #include <OpenFOAM/dictionary.H>
00040 #include <meshTools/wallPoint.H>
00041 #include <meshTools/searchableSurfaces.H>
00042 #include <autoMesh/refinementSurfaces.H>
00043 #include <autoMesh/shellSurfaces.H>
00044 #include <autoMesh/meshRefinement.H>
00045 #include <decompositionMethods/decompositionMethod.H>
00046 #include <dynamicMesh/fvMeshDistribute.H>
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 // Class forward declarations
00054 class fvMesh;
00055 
00056 /*---------------------------------------------------------------------------*\
00057                            Class autoHexMeshDriver Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class autoHexMeshDriver
00061 {
00062     // Static data members
00063 
00064         //- Extrusion controls
00065         enum extrudeMode
00066         {
00067             NOEXTRUDE,      
00068             EXTRUDE,        
00069             EXTRUDEREMOVE   
00071         };
00072 
00073 
00074     // Private classes
00075 
00076         //- Combine operator class for equalizing displacements.
00077         class minMagEqOp
00078         {
00079         public:
00080 
00081             void operator()(vector& x, const vector& y) const
00082             {
00083                 if (magSqr(y) < magSqr(x))
00084                 {
00085                     x = y;
00086                 }
00087             }
00088         };
00089 
00090         //- Combine operator class to combine normal with other normal.
00091         class nomalsCombine
00092         {
00093         public:
00094 
00095             void operator()(vector& x, const vector& y) const
00096             {
00097                 if (y != wallPoint::greatPoint)
00098                 {
00099                     if (x == wallPoint::greatPoint)
00100                     {
00101                         x = y;
00102                     }
00103                     else
00104                     {
00105                         x *= (x&y);
00106                     }
00107                 }
00108             }
00109         };
00110 
00111 
00112 
00113     // Private data
00114 
00115         //- Reference to mesh
00116         fvMesh& mesh_;
00117 
00118         //- Input dictionary
00119         const dictionary dict_;
00120 
00121         //- Debug level
00122         const label debug_;
00123 
00124         //- Merge distance
00125         const scalar mergeDist_;
00126 
00127 
00128         //- All surface based geometry
00129         autoPtr<searchableSurfaces> allGeometryPtr_;
00130 
00131         //- Shells (geometry for inside/outside refinement)
00132         autoPtr<shellSurfaces> shellsPtr_;
00133 
00134         //- Surfaces (geometry for intersection based refinement)
00135         autoPtr<refinementSurfaces> surfacesPtr_;
00136 
00137         //- Per refinement surface region the patch
00138         labelList globalToPatch_;
00139 
00140         //- Mesh refinement engine
00141         autoPtr<meshRefinement> meshRefinerPtr_;
00142 
00143         //- Decomposition engine
00144         autoPtr<decompositionMethod> decomposerPtr_;
00145 
00146         //- Mesh distribution engine
00147         autoPtr<fvMeshDistribute> distributorPtr_;
00148 
00149 
00150 
00151     // Private Member Functions
00152 
00153         //- Calculate merge distance. Check against writing tolerance.
00154         scalar getMergeDistance(const scalar mergeTol) const;
00155 
00156         //static void orientOutside(PtrList<searchableSurface>&);
00157 
00158         //- Disallow default bitwise copy construct
00159         autoHexMeshDriver(const autoHexMeshDriver&);
00160 
00161         //- Disallow default bitwise assignment
00162         void operator=(const autoHexMeshDriver&);
00163 
00164 public:
00165 
00166     //- Runtime type information
00167     ClassName("autoHexMeshDriver");
00168 
00169 
00170     // Constructors
00171 
00172         //- Construct from dictionary and mesh to modify
00173         autoHexMeshDriver
00174         (
00175             fvMesh& mesh,
00176             const bool overwrite,
00177             const dictionary& meshDict,
00178             const dictionary& decomposeDict
00179         );
00180 
00181 
00182     // Member Functions
00183 
00184         // Access
00185 
00186             //- reference to mesh
00187             const fvMesh& mesh() const
00188             {
00189                 return mesh_;
00190             }
00191             fvMesh& mesh()
00192             {
00193                 return mesh_;
00194             }
00195 
00196             //- Surfaces to base refinement on
00197             const refinementSurfaces& surfaces() const
00198             {
00199                 return surfacesPtr_();
00200             }
00201 
00202             //- Surfaces to volume refinement on
00203             const shellSurfaces& shells() const
00204             {
00205                 return shellsPtr_();
00206             }
00207 
00208             //- Per refinementsurface, per region the patch
00209             const labelList& globalToPatch() const
00210             {
00211                 return globalToPatch_;
00212             }
00213 
00214 
00215         // Meshing
00216 
00217             //- Write mesh
00218             void writeMesh(const string&) const;
00219 
00220             //- Do all : refine, snap, layers
00221             void doMesh();
00222 };
00223 
00224 
00225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00226 
00227 } // End namespace Foam
00228 
00229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00230 
00231 #endif
00232 
00233 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines