1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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
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/>.
28 Collection of functions used in wall distance calculation.
32 cellDistFuncsTemplates.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
39 #include "scalarField.H"
42 #include "wordReList.H"
43 #include "scalarField.H"
45 #include "primitivePatch.H"
46 #include "className.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 // Forward declaration of classes
56 class polyBoundaryMesh;
58 /*---------------------------------------------------------------------------*\
59 Class cellDistFuncs Declaration
60 \*---------------------------------------------------------------------------*/
64 // Private Member Data
67 const polyMesh& mesh_;
70 // Private Member Functions
72 //- Search for element in first n elements of labelList. Return index
74 static label findIndex(const label n, const labelList&, const label);
77 //- Disallow default bitwise copy construct
78 cellDistFuncs(const cellDistFuncs&);
80 //- Disallow default bitwise assignment
81 void operator=(const cellDistFuncs&);
85 ClassName("cellDistFuncs");
89 //- Construct from mesh
90 cellDistFuncs(const polyMesh& mesh);
96 const polyMesh& mesh() const
101 //- Return the set of patch IDs corresponding to the given names
102 labelHashSet getPatchIDs(const wordReList& patchNames) const;
104 //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
105 // Uses isA, not isType
107 labelHashSet getPatchIDs() const;
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
116 const polyPatch& patch,
117 const label nWallFaces,
118 const labelList& wallFaces,
122 //- Get faces sharing point with face on patch
123 label getPointNeighbours
125 const primitivePatch&,
126 const label patchFaceI,
130 //- Size of largest patch (out of supplied subset of patches)
131 label maxPatchSize(const labelHashSet& patchIDs) const;
133 //- Sum of patch sizes (out of supplied subset of patches).
134 // Used in sizing arrays.
135 label sumPatchSize(const labelHashSet& patchIDs) const;
137 //- Correct all cells connected to boundary (via face). Sets values in
138 // wallDistCorrected. Sets nearest wallface in nearestFace.
139 void correctBoundaryFaceCells
141 const labelHashSet& patchIDs,
142 scalarField& wallDistCorrected,
143 Map<label>& nearestFace
147 //- Correct all cells connected to wall (via point). Sets values in
148 // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
149 void correctBoundaryPointCells
151 const labelHashSet& patchIDs,
152 scalarField& wallDistCorrected,
153 Map<label>& nearestFace
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 # include "cellDistFuncsTemplates.C"
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 // ************************************************************************* //