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

shellSurfaces.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::shellSurfaces
00026 
00027 Description
00028     Encapsulates queries for volume refinement ('refine all cells within
00029     shell').
00030 
00031 SourceFiles
00032     shellSurfaces.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef shellSurfaces_H
00037 #define shellSurfaces_H
00038 
00039 #include <meshTools/searchableSurface.H>
00040 #include <OpenFOAM/Tuple2.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 class searchableSurfaces;
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class shellSurfaces Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 class shellSurfaces
00054 {
00055 public:
00056 
00057     // Public data types
00058 
00059         //- Volume refinement controls
00060         enum refineMode
00061         {
00062             INSIDE,         // Refine all inside shell
00063             OUTSIDE,        // ,,         outside
00064             DISTANCE        // Refine based on distance to shell
00065         };
00066 
00067 
00068 private:
00069 
00070     // Private data
00071 
00072         //- Reference to all geometry.
00073         const searchableSurfaces& allGeometry_;
00074 
00075         //- Indices of surfaces that are shells
00076         labelList shells_;
00077 
00078         //- Per shell whether to refine inside or outside
00079         List<refineMode> modes_;
00080 
00081         //- Per shell the list of ranges
00082         List<scalarField> distances_;
00083 
00084         //- Per shell per distance the refinement level
00085         labelListList levels_;
00086 
00087 
00088     // Private data
00089 
00090         //- refineMode names
00091         static const NamedEnum<refineMode, 3> refineModeNames_;
00092 
00093 
00094     // Private Member Functions
00095 
00096         //- Helper function for initialisation.
00097         void setAndCheckLevels
00098         (
00099             const label shellI,
00100             const List<Tuple2<scalar, label> >&
00101         );
00102 
00103         void orient();
00104 
00105         void findHigherLevel
00106         (
00107             const pointField& pt,
00108             const label shellI,
00109             labelList& maxLevel
00110         ) const;
00111 
00112 public:
00113 
00114     // Constructors
00115 
00116         //- Construct from components
00117         shellSurfaces
00118         (
00119             const searchableSurfaces& allGeometry,
00120             const labelList& shells,
00121             const List<refineMode>& modes,
00122             const List<scalarField>& distances,
00123             const labelListList& levels
00124         );
00125 
00126         //- Construct from geometry and dictionaries
00127         shellSurfaces
00128         (
00129             const searchableSurfaces& allGeometry,
00130             const PtrList<dictionary>& shellDicts
00131         );
00132 
00133         //- Construct from geometry and dictionary
00134         shellSurfaces
00135         (
00136             const searchableSurfaces& allGeometry,
00137             const dictionary& shellsDict
00138         );
00139 
00140 
00141     // Member Functions
00142 
00143         // Access
00144 
00145             //const List<scalarField>& distances() const
00146             //{
00147             //    return distances_;
00148             //}
00149             //
00151             //const labelListList& levels() const
00152             //{
00153             //    return levels_;
00154             //}
00155 
00156 
00157         // Query
00158 
00159             //- Highest shell level
00160             label maxLevel() const;
00161 
00162             //- Find shell level higher than ptLevel
00163             void findHigherLevel
00164             (
00165                 const pointField& pt,
00166                 const labelList& ptLevel,
00167                 labelList& maxLevel
00168             ) const;
00169 
00170 };
00171 
00172 
00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00174 
00175 } // End namespace Foam
00176 
00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00178 
00179 #endif
00180 
00181 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines