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

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