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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 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::cellDistFuncs
28 
29 Description
30  Collection of functions used in wall distance calculation.
31 
32 SourceFiles
33  cellDistFuncs.C
34  cellDistFuncsTemplates.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cellDistFuncs_H
39 #define cellDistFuncs_H
40 
41 #include "HashSet.H"
42 #include "Map.H"
43 #include "wordRe.H"
44 #include "scalarField.H"
45 #include "point.H"
46 #include "primitivePatch.H"
47 #include "className.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward declaration of classes
55 class polyMesh;
56 class polyPatch;
57 class polyBoundaryMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class cellDistFuncs Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class cellDistFuncs
64 {
65  // Private Member Data
66 
67  //- Reference to mesh
68  const polyMesh& mesh_;
69 
70 
71  // Private Member Functions
72 
73  //- Search for element in first n elements of labelList. Return index
74  // or -1.
75  static label findIndex(const label n, const labelList&, const label);
76 
77 
78  //- No copy construct
79  cellDistFuncs(const cellDistFuncs&) = delete;
80 
81  //- No copy assignment
82  void operator=(const cellDistFuncs&) = delete;
83 
84 public:
85 
86  ClassName("cellDistFuncs");
87 
88  // Constructors
89 
90  //- Construct from mesh
91  cellDistFuncs(const polyMesh& mesh);
92 
93 
94  // Member Functions
95 
96  //- Access mesh
97  const polyMesh& mesh() const
98  {
99  return mesh_;
100  }
101 
102  //- Return the set of patch IDs corresponding to the given names
104 
105  //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
106  // Uses isA, not isType
107  template<class Type>
108  labelHashSet getPatchIDs() const;
109 
110  //- Calculate smallest true distance (and face index)
111  // from pt to faces wallFaces.
112  // For efficiency reasons we still pass in patch instead of extracting
113  // it from mesh_
114  scalar smallestDist
115  (
116  const point& p,
117  const polyPatch& patch,
118  const label nWallFaces,
119  const labelList& wallFaces,
120  label& meshFacei
121  ) const;
122 
123  //- Get faces sharing point with face on patch
124  label getPointNeighbours
125  (
126  const primitivePatch&,
127  const label patchFacei,
128  labelList&
129  ) const;
130 
131  //- Size of largest patch (out of supplied subset of patches)
132  label maxPatchSize(const labelHashSet& patchIDs) const;
133 
134  //- Sum of patch sizes (out of supplied subset of patches).
135  // Used in sizing arrays.
136  label sumPatchSize(const labelHashSet& patchIDs) const;
137 
138  //- Correct all cells connected to boundary (via face). Sets values in
139  // wallDistCorrected. Sets nearest wallface in nearestFace.
141  (
142  const labelHashSet& patchIDs,
143  scalarField& wallDistCorrected,
144  Map<label>& nearestFace
145  ) const;
146 
147 
148  //- Correct all cells connected to wall (via point). Sets values in
149  // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
151  (
152  const labelHashSet& patchIDs,
153  scalarField& wallDistCorrected,
154  Map<label>& nearestFace
155  ) const;
156 };
157 
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 } // End namespace Foam
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #ifdef NoRepository
166  #include "cellDistFuncsTemplates.C"
167 #endif
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
nWallFaces
label nWallFaces(0)
scalarField.H
point.H
Foam::cellDistFuncs::maxPatchSize
label maxPatchSize(const labelHashSet &patchIDs) const
Size of largest patch (out of supplied subset of patches)
Definition: cellDistFuncs.C:227
Foam::cellDistFuncs::smallestDist
scalar smallestDist(const point &p, const polyPatch &patch, const label nWallFaces, const labelList &wallFaces, label &meshFacei) const
Calculate smallest true distance (and face index)
Definition: cellDistFuncs.C:85
Foam::Map< label >
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellDistFuncs::correctBoundaryPointCells
void correctBoundaryPointCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to wall (via point). Sets values in.
Definition: cellDistFuncs.C:326
Map.H
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field< scalar >
Foam::cellDistFuncs::getPatchIDs
labelHashSet getPatchIDs() const
Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:67
wordRe.H
className.H
Macro definitions for declaring ClassName(), NamespaceName(), etc.
Foam::cellDistFuncs::sumPatchSize
label sumPatchSize(const labelHashSet &patchIDs) const
Sum of patch sizes (out of supplied subset of patches).
Definition: cellDistFuncs.C:248
patchNames
wordList patchNames(nPatches)
Foam::cellDistFuncs::getPointNeighbours
label getPointNeighbours(const primitivePatch &, const label patchFacei, labelList &) const
Get faces sharing point with face on patch.
Definition: cellDistFuncs.C:119
HashSet.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:96
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:62
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::List< label >
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::cellDistFuncs::correctBoundaryFaceCells
void correctBoundaryFaceCells(const labelHashSet &patchIDs, scalarField &wallDistCorrected, Map< label > &nearestFace) const
Correct all cells connected to boundary (via face). Sets values in.
Definition: cellDistFuncs.C:270
Foam::cellDistFuncs::ClassName
ClassName("cellDistFuncs")
cellDistFuncsTemplates.C
primitivePatch.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85