1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Collection of functions used in wall distance calculation.
34 \*---------------------------------------------------------------------------*/
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
39 #include "scalarField.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 //- Get patchIDs of named patches
102 labelHashSet getPatchIDs(const wordList&) const;
104 //- Get patchIDs of certain type (e.g. 'processorPolyPatch')
105 labelHashSet getPatchIDs(const word&) const;
107 //- Calculate smallest true distance (and face index)
108 // from pt to faces wallFaces.
109 // For efficiency reasons we still pass in patch instead of extracting
114 const polyPatch& patch,
115 const label nWallFaces,
116 const labelList& wallFaces,
120 //- Get faces sharing point with face on patch
121 label getPointNeighbours
123 const primitivePatch&,
124 const label patchFaceI,
128 //- Size of largest patch (out of supplied subset of patches)
129 label maxPatchSize(const labelHashSet& patchIDs) const;
131 //- Sum of patch sizes (out of supplied subset of patches).
132 // Used in sizing arrays.
133 label sumPatchSize(const labelHashSet& patchIDs) const;
135 //- Correct all cells connected to boundary (via face). Sets values in
136 // wallDistCorrected. Sets nearest wallface in nearestFace.
137 void correctBoundaryFaceCells
139 const labelHashSet& patchIDs,
140 scalarField& wallDistCorrected,
141 Map<label>& nearestFace
145 //- Correct all cells connected to wall (via point). Sets values in
146 // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
147 void correctBoundaryPointCells
149 const labelHashSet& patchIDs,
150 scalarField& wallDistCorrected,
151 Map<label>& nearestFace
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 } // End namespace Foam
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 // ************************************************************************* //