BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / meshTools / cellDist / cellDistFuncs.H
blob11c29d5650c21239139fcb82b1429bd3163e9220
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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/>.
24 Class
25     Foam::cellDistFuncs
27 Description
28     Collection of functions used in wall distance calculation.
30 SourceFiles
31     cellDistFuncs.C
32     cellDistFuncsTemplates.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef cellDistFuncs_H
37 #define cellDistFuncs_H
39 #include "scalarField.H"
40 #include "HashSet.H"
41 #include "Map.H"
42 #include "wordReList.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         //- 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
106         template<class Type>
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
112         //  it from mesh_
113         scalar smallestDist
114         (
115             const point& p,
116             const polyPatch& patch,
117             const label nWallFaces,
118             const labelList& wallFaces,
119             label& meshFaceI
120         ) const;
122         //- Get faces sharing point with face on patch
123         label getPointNeighbours
124         (
125             const primitivePatch&,
126             const label patchFaceI,
127             labelList&
128         ) const;
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
140         (
141             const labelHashSet& patchIDs,
142             scalarField& wallDistCorrected,
143             Map<label>& nearestFace
144         ) const;
147         //- Correct all cells connected to wall (via point). Sets values in
148         //  wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
149         void correctBoundaryPointCells
150         (
151             const labelHashSet& patchIDs,
152             scalarField& wallDistCorrected,
153             Map<label>& nearestFace
154         ) const;
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 } // End namespace Foam
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 #ifdef NoRepository
165 #   include "cellDistFuncsTemplates.C"
166 #endif
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 #endif
172 // ************************************************************************* //