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.
33 cellDistFuncsTemplates.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef cellDistFuncs_H
38 #define cellDistFuncs_H
40 #include "scalarField.H"
44 #include "scalarField.H"
46 #include "primitivePatch.H"
47 #include "className.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 // Forward declaration of classes
57 class polyBoundaryMesh;
59 /*---------------------------------------------------------------------------*\
60 Class cellDistFuncs Declaration
61 \*---------------------------------------------------------------------------*/
65 // Private Member Data
68 const polyMesh& mesh_;
71 // Private Member Functions
73 //- Search for element in first n elements of labelList. Return index
75 static label findIndex(const label n, const labelList&, const label);
78 //- Disallow default bitwise copy construct
79 cellDistFuncs(const cellDistFuncs&);
81 //- Disallow default bitwise assignment
82 void operator=(const cellDistFuncs&);
86 ClassName("cellDistFuncs");
90 //- Construct from mesh
91 cellDistFuncs(const polyMesh& mesh);
97 const polyMesh& mesh() const
102 //- Get patchIDs of named patches
103 labelHashSet getPatchIDs(const wordList&) const;
105 //- Get patchIDs of/derived off certain type (e.g. 'processorPolyPatch')
106 // Uses isA, not isType
108 labelHashSet getPatchIDs() const;
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
117 const polyPatch& patch,
118 const label nWallFaces,
119 const labelList& wallFaces,
123 //- Get faces sharing point with face on patch
124 label getPointNeighbours
126 const primitivePatch&,
127 const label patchFaceI,
131 //- Size of largest patch (out of supplied subset of patches)
132 label maxPatchSize(const labelHashSet& patchIDs) const;
134 //- Sum of patch sizes (out of supplied subset of patches).
135 // Used in sizing arrays.
136 label sumPatchSize(const labelHashSet& patchIDs) const;
138 //- Correct all cells connected to boundary (via face). Sets values in
139 // wallDistCorrected. Sets nearest wallface in nearestFace.
140 void correctBoundaryFaceCells
142 const labelHashSet& patchIDs,
143 scalarField& wallDistCorrected,
144 Map<label>& nearestFace
148 //- Correct all cells connected to wall (via point). Sets values in
149 // wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
150 void correctBoundaryPointCells
152 const labelHashSet& patchIDs,
153 scalarField& wallDistCorrected,
154 Map<label>& nearestFace
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 # include "cellDistFuncsTemplates.C"
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 // ************************************************************************* //