initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / cellDist / patchWave / patchDataWave.H
blob5e52652d36742ac31f5da76dcbbd35bf083ca5c3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::patchDataWave
28 Description
29     Takes a set of patches to start MeshWave from.
31     Holds after construction distance at cells and distance at patches
32     (like patchWave), but also additional transported data.
33     It is used, for example, in the y+ calculation.
35 See Also
36    The patchWave class.
38 SourceFiles
39     patchDataWave.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef patchDataWave_H
44 #define patchDataWave_H
46 #include "cellDistFuncs.H"
47 #include "FieldField.H"
48 #include "UPtrList.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 namespace Foam
55 // Forward declaration of classes
56 class polyMesh;
57 class wallPoint;
58 template<class Type> class MeshWave;
60 /*---------------------------------------------------------------------------*\
61                            Class patchDataWave Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class TransferType>
65 class patchDataWave
67     public cellDistFuncs
70 private:
72     typedef typename TransferType::dataType Type;
75     // Private Member Data
77         //- Current patch subset (stored as patchIDs)
78         labelHashSet patchIDs_;
80         //- Reference to initial extra data at patch faces
81         const UPtrList<Field<Type> >& initialPatchValuePtrs_;
83         //- Do accurate distance calculation for near-wall cells.
84         bool correctWalls_;
86         //
87         // After construction:
88         //
90         //- Number of cells/faces unset after MeshWave has finished
91         label nUnset_;
93         //- Distance at cell centres
94         scalarField distance_;
96         //- Distance at patch faces
97         FieldField<Field, scalar> patchDistance_;
99         //- Extra data at cell centres
100         Field<Type> cellData_;
102         //- Extra data at patch faces
103         FieldField<Field, Type> patchData_;
106     // Private Member Functions
108         //- Set initial set of changed faces
109         void setChangedFaces
110         (
111             const labelHashSet& patchIDs,
112             labelList&,
113             List<TransferType>&
114         ) const;
116         //- Copy MeshWave values into *this
117         label getValues(const MeshWave<TransferType>&);
120 public:
122     // Constructors
124         //- Construct from mesh, information on patches to initialize and flag
125         //  whether or not to correct wall.
126         //  Calculate for all cells. correctWalls : correct wall (face&point)
127         //  cells for correct distance, searching neighbours.
128         patchDataWave
129         (
130             const polyMesh& mesh,
131             const labelHashSet& patchIDs,
132             const UPtrList<Field<Type> >& initialPatchValuePtrs,
133             bool correctWalls = true
134         );
137     // Destructor
139         virtual ~patchDataWave();
142     // Member Functions
144         //- Correct for mesh geom/topo changes
145         virtual void correct();
148         const scalarField& distance() const
149         {
150             return distance_;
151         }
153         //- Non const access so we can 'transfer' contents for efficiency.
154         scalarField& distance()
155         {
156             return distance_;
157         }
159         const FieldField<Field, scalar>& patchDistance() const
160         {
161             return patchDistance_;
162         }
164         FieldField<Field, scalar>& patchDistance()
165         {
166             return patchDistance_;
167         }
169         const Field<Type>& cellData() const
170         {
171             return cellData_;
172         }
174         Field<Type>& cellData()
175         {
176             return cellData_;
177         }
179         const FieldField<Field, Type>& patchData() const
180         {
181             return patchData_;
182         }
184         FieldField<Field, Type>& patchData()
185         {
186             return patchData_;
187         }
189         label nUnset() const
190         {
191             return nUnset_;
192         }
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 } // End namespace Foam
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 #ifdef NoRepository
203 #   include "patchDataWave.C"
204 #endif
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 #endif
210 // ************************************************************************* //