initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / cellDist / cellDistFuncs.H
blob8dcd38d1a2eb68cad501bec7beda747ec9ef8cc6
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::cellDistFuncs
28 Description
29     Collection of functions used in wall distance calculation.
31 SourceFiles
32     cellDistFuncs.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
39 #include "scalarField.H"
40 #include "HashSet.H"
41 #include "Map.H"
42 #include "wordList.H"
43 #include "scalarField.H"
44 #include "point.H"
45 #include "primitivePatch.H"
46 #include "className.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
53 // Forward declaration of classes
54 class polyMesh;
55 class polyPatch;
56 class polyBoundaryMesh;
58 /*---------------------------------------------------------------------------*\
59                            Class cellDistFuncs Declaration
60 \*---------------------------------------------------------------------------*/
62 class cellDistFuncs
64     // Private Member Data
66         //- Reference to mesh
67         const polyMesh& mesh_;
70     // Private Member Functions
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);
77         //- Disallow default bitwise copy construct
78         cellDistFuncs(const cellDistFuncs&);
80         //- Disallow default bitwise assignment
81         void operator=(const cellDistFuncs&);
83 public:
85     ClassName("cellDistFuncs");
87     // Constructors
89         //- Construct from mesh
90         cellDistFuncs(const polyMesh& mesh);
93     // Member Functions
95         //- Access mesh
96         const polyMesh& mesh() const
97         {
98             return mesh_;
99         }
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
110         //  it from mesh_
111         scalar smallestDist
112         (
113             const point& p,
114             const polyPatch& patch,
115             const label nWallFaces,
116             const labelList& wallFaces,
117             label& meshFaceI
118         ) const;
120         //- Get faces sharing point with face on patch
121         label getPointNeighbours
122         (
123             const primitivePatch&,
124             const label patchFaceI,
125             labelList&
126         ) const;
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
138         (
139             const labelHashSet& patchIDs,
140             scalarField& wallDistCorrected,
141             Map<label>& nearestFace
142         ) const;
145         //- Correct all cells connected to wall (via point). Sets values in
146         //  wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
147         void correctBoundaryPointCells
148         (
149             const labelHashSet& patchIDs,
150             scalarField& wallDistCorrected,
151             Map<label>& nearestFace
152         ) const;
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 } // End namespace Foam
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 #endif
164 // ************************************************************************* //