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

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