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

patchDataWave.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::patchDataWave
00027 
00028 Description
00029     Takes a set of patches to start MeshWave from.
00030 
00031     Holds after construction distance at cells and distance at patches
00032     (like patchWave), but also additional transported data.
00033     It is used, for example, in the y+ calculation.
00034 
00035 See Also
00036    The patchWave class.
00037 
00038 SourceFiles
00039     patchDataWave.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef patchDataWave_H
00044 #define patchDataWave_H
00045 
00046 #include "cellDistFuncs.H"
00047 #include "FieldField.H"
00048 #include "UPtrList.H"
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Forward declaration of classes
00056 class polyMesh;
00057 class wallPoint;
00058 template<class Type> class MeshWave;
00059 
00060 /*---------------------------------------------------------------------------*\
00061                            Class patchDataWave Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 template<class TransferType>
00065 class patchDataWave
00066 :
00067     public cellDistFuncs
00068 {
00069 
00070 private:
00071 
00072     typedef typename TransferType::dataType Type;
00073 
00074 
00075     // Private Member Data
00076 
00077         //- Current patch subset (stored as patchIDs)
00078         labelHashSet patchIDs_;
00079 
00080         //- Reference to initial extra data at patch faces
00081         const UPtrList<Field<Type> >& initialPatchValuePtrs_;
00082 
00083         //- Do accurate distance calculation for near-wall cells.
00084         bool correctWalls_;
00085 
00086         //
00087         // After construction:
00088         //
00089 
00090         //- Number of cells/faces unset after MeshWave has finished
00091         label nUnset_;
00092 
00093         //- Distance at cell centres
00094         scalarField distance_;
00095 
00096         //- Distance at patch faces
00097         FieldField<Field, scalar> patchDistance_;
00098 
00099         //- Extra data at cell centres
00100         Field<Type> cellData_;
00101 
00102         //- Extra data at patch faces
00103         FieldField<Field, Type> patchData_;
00104 
00105 
00106     // Private Member Functions
00107 
00108         //- Set initial set of changed faces
00109         void setChangedFaces
00110         (
00111             const labelHashSet& patchIDs,
00112             labelList&,
00113             List<TransferType>&
00114         ) const;
00115 
00116         //- Copy MeshWave values into *this
00117         label getValues(const MeshWave<TransferType>&);
00118 
00119 
00120 public:
00121 
00122     // Constructors
00123 
00124         //- Construct from mesh, information on patches to initialize and flag
00125         //  whether or not to correct wall.
00126         //  Calculate for all cells. correctWalls : correct wall (face&point)
00127         //  cells for correct distance, searching neighbours.
00128         patchDataWave
00129         (
00130             const polyMesh& mesh,
00131             const labelHashSet& patchIDs,
00132             const UPtrList<Field<Type> >& initialPatchValuePtrs,
00133             bool correctWalls = true
00134         );
00135 
00136 
00137     // Destructor
00138 
00139         virtual ~patchDataWave();
00140 
00141 
00142     // Member Functions
00143 
00144         //- Correct for mesh geom/topo changes
00145         virtual void correct();
00146 
00147 
00148         const scalarField& distance() const
00149         {
00150             return distance_;
00151         }
00152 
00153         //- Non const access so we can 'transfer' contents for efficiency.
00154         scalarField& distance()
00155         {
00156             return distance_;
00157         }
00158 
00159         const FieldField<Field, scalar>& patchDistance() const
00160         {
00161             return patchDistance_;
00162         }
00163 
00164         FieldField<Field, scalar>& patchDistance()
00165         {
00166             return patchDistance_;
00167         }
00168 
00169         const Field<Type>& cellData() const
00170         {
00171             return cellData_;
00172         }
00173 
00174         Field<Type>& cellData()
00175         {
00176             return cellData_;
00177         }
00178 
00179         const FieldField<Field, Type>& patchData() const
00180         {
00181             return patchData_;
00182         }
00183 
00184         FieldField<Field, Type>& patchData()
00185         {
00186             return patchData_;
00187         }
00188 
00189         label nUnset() const
00190         {
00191             return nUnset_;
00192         }
00193 };
00194 
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 } // End namespace Foam
00199 
00200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00201 
00202 #ifdef NoRepository
00203 #   include "patchDataWave.C"
00204 #endif
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #endif
00209 
00210 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd