OpenFOAM logo
Open Source CFD Toolkit

patchWave.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-2005 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     patchWave
00027 
00028 Description
00029     Takes a set of patches to start meshWave from. After construction holds
00030     distance at cells and distance at patches. Is e.g. used by wallDist to
00031     construct volScalarField with correct distance to wall.
00032 
00033 SourceFiles
00034     patchWave.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef patchWave_H
00039 #define patchWave_H
00040 
00041 #include "cellDistFuncs.H"
00042 #include "FieldField.H"
00043 
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 // Class forward declarations
00051 class polyMesh;
00052 class wallPoint;
00053 template<class Type> class meshWave;
00054 
00055 /*---------------------------------------------------------------------------*\
00056                            Class patchWave Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class patchWave
00060 :
00061     public cellDistFuncs
00062 {
00063     // Private Data
00064 
00065         //- Current patch subset (stored as patchIDs)
00066         labelHashSet patchIDs_;
00067 
00068         //- Do accurate distance calculation for near-wall cells.
00069         bool correctWalls_;
00070 
00071         //- Number of cells/faces unset after meshWave has finished
00072         label nUnset_;
00073 
00074         //- Distance at cell centres
00075         scalarField distance_;
00076 
00077         //- Distance at patch faces
00078         FieldField<Field, scalar> patchDistance_;
00079 
00080 
00081     // Private Member Functions
00082 
00083         //- Set initial set of changed faces (= all faces of patches in
00084         //  patchIDs). Set changedFaces to labels of changed faces,
00085         //  changedInfo to face centres.
00086         void setChangedFaces
00087         (
00088             const labelHashSet& patchIDs,
00089             labelList& changedFaces,
00090             List<wallPoint>& changedInfo
00091         ) const;
00092 
00093         //- Copy meshWave cell values. Return number of illegal/unset
00094         //  cells.
00095         label getValues(const meshWave<wallPoint>&);
00096 
00097 
00098 public:
00099 
00100     // Constructors
00101 
00102         //- Construct from mesh and patches to initialize to 0 and flag
00103         //  whether or not to correct wall.
00104         //  Calculate for all cells. correctWalls : correct wall (face&point)
00105         //  cells for correct distance, searching neighbours.
00106         patchWave
00107         (
00108             const polyMesh& mesh,
00109             const labelHashSet& patchIDs,
00110             bool correctWalls = true
00111         );
00112 
00113     // Destructor
00114 
00115         virtual ~patchWave();
00116 
00117 
00118     // Member Functions
00119 
00120         //- Correct for mesh geom/topo changes
00121         virtual void correct();
00122 
00123 
00124         label nUnset() const
00125         {
00126             return nUnset_;
00127         }
00128 
00129         const scalarField& distance() const
00130         {
00131             return distance_;
00132         }
00133 
00134         //- Non const access so we can 'transfer' contents for efficiency.
00135         scalarField& distance()
00136         {
00137             return distance_;
00138         }
00139 
00140         const FieldField<Field, scalar>& patchDistance() const
00141         {
00142             return patchDistance_;
00143         }
00144 
00145         FieldField<Field, scalar>& patchDistance()
00146         {
00147             return patchDistance_;
00148         }
00149 
00150 };
00151 
00152 
00153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00154 
00155 } // End namespace Foam
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #endif
00160 
00161 // ************************************************************************* //
For further information go to www.openfoam.org