FreeFOAM The Cross-Platform CFD Toolkit
cellDistFuncs.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::cellDistFuncs
26 
27 Description
28  Collection of functions used in wall distance calculation.
29 
30 SourceFiles
31  cellDistFuncs.C
32  cellDistFuncsTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
38 
39 #include <OpenFOAM/scalarField.H>
40 #include <OpenFOAM/HashSet.H>
41 #include <OpenFOAM/Map.H>
42 #include <OpenFOAM/wordList.H>
43 #include <OpenFOAM/scalarField.H>
44 #include <OpenFOAM/point.H>
46 #include <OpenFOAM/className.H>
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class polyMesh;
55 class polyPatch;
56 class polyBoundaryMesh;
57 
58 /*---------------------------------------------------------------------------*\
59  Class cellDistFuncs Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 {
64  // Private Member Data
65 
66  //- Reference to mesh
67  const polyMesh& mesh_;
68 
69 
70  // Private Member Functions
71 
72  //- Search for element in first n elements of labelList. Return index
73  // or -1.
74  static label findIndex(const label n, const labelList&, const label);
75 
76 
77  //- Disallow default bitwise copy construct
79 
80  //- Disallow default bitwise assignment
81  void operator=(const cellDistFuncs&);
82 
83 public:
84 
85  ClassName("cellDistFuncs");
86 
87  // Constructors
88 
89  //- Construct from mesh
90  cellDistFuncs(const polyMesh& mesh);
91 
92 
93  // Member Functions
94 
95  //- Access mesh
96  const polyMesh& mesh() const
97  {
98  return mesh_;
99  }
100 
101  //- Get patchIDs of named patches
102  labelHashSet getPatchIDs(const wordList&) const;
103 
104  //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
105  // Uses isA, not isType
106  template<class Type>
107  labelHashSet getPatchIDs() const;
108 
109  //- Calculate smallest true distance (and face index)
110  // from pt to faces wallFaces.
111  // For efficiency reasons we still pass in patch instead of extracting
112  // it from mesh_
113  scalar smallestDist
114  (
115  const point& p,
116  const polyPatch& patch,
117  const label nWallFaces,
118  const labelList& wallFaces,
119  label& meshFaceI
120  ) const;
121 
122  //- Get faces sharing point with face on patch
123  label getPointNeighbours
124  (
125  const primitivePatch&,
126  const label patchFaceI,
127  labelList&
128  ) const;
129 
130  //- Size of largest patch (out of supplied subset of patches)
131  label maxPatchSize(const labelHashSet& patchIDs) const;
132 
133  //- Sum of patch sizes (out of supplied subset of patches).
134  // Used in sizing arrays.
135  label sumPatchSize(const labelHashSet& patchIDs) const;
136 
137  //- Correct all cells connected to boundary (via face). Sets values in
138  // wallDistCorrected. Sets nearest wallface in nearestFace.
140  (
141  const labelHashSet& patchIDs,
142  scalarField& wallDistCorrected,
143  Map<label>& nearestFace
144  ) const;
145 
146 
147  //- Correct all cells connected to wall (via point). Sets values in
148  // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
150  (
151  const labelHashSet& patchIDs,
152  scalarField& wallDistCorrected,
153  Map<label>& nearestFace
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #ifdef NoRepository
165 # include "cellDistFuncsTemplates.C"
166 #endif
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************ vim: set sw=4 sts=4 et: ************************ //