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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchWave
28 
29 Description
30  Takes a set of patches to start MeshWave from. After construction holds
31  distance at cells and distance at patches. Is e.g. used by wallDist to
32  construct volScalarField with correct distance to wall.
33 
34 SourceFiles
35  patchWave.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef patchWave_H
40 #define patchWave_H
41 
42 #include "cellDistFuncs.H"
43 #include "FieldField.H"
44 #include "MeshWave.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declaration of classes
52 class polyMesh;
53 class wallPoint;
54 
55 /*---------------------------------------------------------------------------*\
56  Class patchWave Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class patchWave
60 :
61  public cellDistFuncs
62 {
63  // Private Data
64 
65  //- Current patch subset (stored as patchIDs)
66  labelHashSet patchIDs_;
67 
68  //- Do accurate distance calculation for near-wall cells.
69  bool correctWalls_;
70 
71  //- Number of cells/faces unset after MeshWave has finished
72  label nUnset_;
73 
74  //- Distance at cell centres
75  scalarField distance_;
76 
77  //- Distance at patch faces
78  FieldField<Field, scalar> patchDistance_;
79 
80  //- Additional faces to be used as seeds for distance calculations
81  labelList sourceIDs_;
82 
83 
84  // Private Member Functions
85 
86  //- Set initial set of changed faces (= all faces of patches in
87  // patchIDs). Set changedFaces to labels of changed faces,
88  // changedInfo to face centres.
89  void setChangedFaces
90  (
91  const labelHashSet& patchIDs,
92  labelList& changedFaces,
93  List<wallPoint>& changedInfo
94  ) const;
95 
96  //- Copy MeshWave cell values. Return number of illegal/unset
97  // cells.
98  label getValues(const MeshWave<wallPoint>&);
99 
100 
101 public:
102 
103  // Constructors
104 
105  //- Construct from mesh and patches to initialize to 0 and flag
106  // whether or not to correct wall.
107  // Calculate for all cells. correctWalls : correct wall (face&point)
108  // cells for correct distance, searching neighbours.
109  patchWave
110  (
111  const polyMesh& mesh,
112  const labelHashSet& patchIDs,
113  bool correctWalls = true,
114  const labelList& sourceFaceIDs = labelList()
115  );
116 
117  //- Destructor
118  virtual ~patchWave();
119 
120 
121  // Member Functions
122 
123  //- Correct for mesh geom/topo changes
124  virtual void correct();
125 
126 
127  label nUnset() const
128  {
129  return nUnset_;
130  }
131 
132  const scalarField& distance() const
133  {
134  return distance_;
135  }
136 
137  //- Non const access so we can 'transfer' contents for efficiency
139  {
140  return distance_;
141  }
142 
144  {
145  return patchDistance_;
146  }
149  {
150  return patchDistance_;
151  }
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 #endif
162 
163 // ************************************************************************* //
const labelList patchIDs(pbm.indices(polyPatchNames, true))
virtual ~patchWave()
Destructor.
Definition: patchWave.C:165
patchWave(const polyMesh &mesh, const labelHashSet &patchIDs, bool correctWalls=true, const labelList &sourceFaceIDs=labelList())
Construct from mesh and patches to initialize to 0 and flag.
Definition: patchWave.C:144
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:51
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:59
FaceCellWave plus data.
Definition: MeshWave.H:55
const FieldField< Field, scalar > & patchDistance() const
Definition: patchWave.H:165
Takes a set of patches to start MeshWave from. After construction holds distance at cells and distanc...
Definition: patchWave.H:54
virtual void correct()
Correct for mesh geom/topo changes.
Definition: patchWave.C:171
label nUnset() const
Definition: patchWave.H:147
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
List< label > labelList
A List of labels.
Definition: List.H:62
const scalarField & distance() const
Definition: patchWave.H:152
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:98
Namespace for OpenFOAM.