OpenFOAM logo
Open Source CFD Toolkit

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