FreeFOAM The Cross-Platform CFD Toolkit
patchWave.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::patchWave
26 
27 Description
28  Takes a set of patches to start MeshWave from. After construction holds
29  distance at cells and distance at patches. Is e.g. used by wallDist to
30  construct volScalarField with correct distance to wall.
31 
32 SourceFiles
33  patchWave.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef patchWave_H
38 #define patchWave_H
39 
41 #include <OpenFOAM/FieldField.H>
42 
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class polyMesh;
51 class wallPoint;
52 template<class Type> class MeshWave;
53 
54 /*---------------------------------------------------------------------------*\
55  Class patchWave Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class patchWave
59 :
60  public cellDistFuncs
61 {
62  // Private Data
63 
64  //- Current patch subset (stored as patchIDs)
65  labelHashSet patchIDs_;
66 
67  //- Do accurate distance calculation for near-wall cells.
68  bool correctWalls_;
69 
70  //- Number of cells/faces unset after MeshWave has finished
71  label nUnset_;
72 
73  //- Distance at cell centres
74  scalarField distance_;
75 
76  //- Distance at patch faces
77  FieldField<Field, scalar> patchDistance_;
78 
79 
80  // Private Member Functions
81 
82  //- Set initial set of changed faces (= all faces of patches in
83  // patchIDs). Set changedFaces to labels of changed faces,
84  // changedInfo to face centres.
85  void setChangedFaces
86  (
87  const labelHashSet& patchIDs,
88  labelList& changedFaces,
89  List<wallPoint>& changedInfo
90  ) const;
91 
92  //- Copy MeshWave cell values. Return number of illegal/unset
93  // cells.
94  label getValues(const MeshWave<wallPoint>&);
95 
96 
97 public:
98 
99  // Constructors
100 
101  //- Construct from mesh and patches to initialize to 0 and flag
102  // whether or not to correct wall.
103  // Calculate for all cells. correctWalls : correct wall (face&point)
104  // cells for correct distance, searching neighbours.
105  patchWave
106  (
107  const polyMesh& mesh,
108  const labelHashSet& patchIDs,
109  bool correctWalls = true
110  );
111 
112  // Destructor
113 
114  virtual ~patchWave();
115 
116 
117  // Member Functions
118 
119  //- Correct for mesh geom/topo changes
120  virtual void correct();
121 
122 
123  label nUnset() const
124  {
125  return nUnset_;
126  }
127 
128  const scalarField& distance() const
129  {
130  return distance_;
131  }
132 
133  //- Non const access so we can 'transfer' contents for efficiency.
135  {
136  return distance_;
137  }
138 
140  {
141  return patchDistance_;
142  }
143 
145  {
146  return patchDistance_;
147  }
148 
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************ vim: set sw=4 sts=4 et: ************************ //