initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / cellDist / patchWave / patchWave.H
blobe1462f33581f3fc88880852721c16ad36fdbb72d
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::patchWave
28 Description
29     Takes a set of patches to start MeshWave from. After construction holds
30     distance at cells and distance at patches. Is e.g. used by wallDist to
31     construct volScalarField with correct distance to wall.
33 SourceFiles
34     patchWave.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef patchWave_H
39 #define patchWave_H
41 #include "cellDistFuncs.H"
42 #include "FieldField.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 // Forward declaration of classes
51 class polyMesh;
52 class wallPoint;
53 template<class Type> class MeshWave;
55 /*---------------------------------------------------------------------------*\
56                            Class patchWave Declaration
57 \*---------------------------------------------------------------------------*/
59 class patchWave
61     public cellDistFuncs
63     // Private Data
65         //- Current patch subset (stored as patchIDs)
66         labelHashSet patchIDs_;
68         //- Do accurate distance calculation for near-wall cells.
69         bool correctWalls_;
71         //- Number of cells/faces unset after MeshWave has finished
72         label nUnset_;
74         //- Distance at cell centres
75         scalarField distance_;
77         //- Distance at patch faces
78         FieldField<Field, scalar> patchDistance_;
81     // Private Member Functions
83         //- Set initial set of changed faces (= all faces of patches in
84         //  patchIDs). Set changedFaces to labels of changed faces,
85         //  changedInfo to face centres.
86         void setChangedFaces
87         (
88             const labelHashSet& patchIDs,
89             labelList& changedFaces,
90             List<wallPoint>& changedInfo
91         ) const;
93         //- Copy MeshWave cell values. Return number of illegal/unset
94         //  cells.
95         label getValues(const MeshWave<wallPoint>&);
98 public:
100     // Constructors
102         //- Construct from mesh and patches to initialize to 0 and flag
103         //  whether or not to correct wall.
104         //  Calculate for all cells. correctWalls : correct wall (face&point)
105         //  cells for correct distance, searching neighbours.
106         patchWave
107         (
108             const polyMesh& mesh,
109             const labelHashSet& patchIDs,
110             bool correctWalls = true
111         );
113     // Destructor
115         virtual ~patchWave();
118     // Member Functions
120         //- Correct for mesh geom/topo changes
121         virtual void correct();
124         label nUnset() const
125         {
126             return nUnset_;
127         }
129         const scalarField& distance() const
130         {
131             return distance_;
132         }
134         //- Non const access so we can 'transfer' contents for efficiency.
135         scalarField& distance()
136         {
137             return distance_;
138         }
140         const FieldField<Field, scalar>& patchDistance() const
141         {
142             return patchDistance_;
143         }
145         FieldField<Field, scalar>& patchDistance()
146         {
147             return patchDistance_;
148         }
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 } // End namespace Foam
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 #endif
161 // ************************************************************************* //