OpenFOAM logo
Open Source CFD Toolkit

cellDistFuncs.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     cellDistFuncs
00027 
00028 Description
00029     Collection of functions used in wall distance calculation.
00030 
00031 SourceFiles
00032     cellDistFuncs.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef cellDistFuncs_H
00037 #define cellDistFuncs_H
00038 
00039 #include "scalarField.H"
00040 #include "labelHashSet.H"
00041 #include "Map.H"
00042 #include "wordList.H"
00043 #include "scalarField.H"
00044 #include "point.H"
00045 #include "primitivePatch.H"
00046 #include "className.H"
00047 
00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00049 
00050 namespace Foam
00051 {
00052 
00053 // Class forward declarations
00054 class polyMesh;
00055 class polyPatch;
00056 class polyBoundaryMesh;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class cellDistFuncs Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class cellDistFuncs
00063 {
00064     // Private Member Data
00065 
00066         //- Reference to mesh
00067         const polyMesh& mesh_;
00068 
00069 
00070     // Private Member Functions
00071 
00072         //- Search for element in first n elements of labelList. Return index
00073         //  or -1.
00074         static label findIndex(const label n, const labelList&, const label);
00075 
00076 
00077         //- Disallow default bitwise copy construct
00078         cellDistFuncs(const cellDistFuncs&);
00079 
00080         //- Disallow default bitwise assignment
00081         void operator=(const cellDistFuncs&);
00082 
00083 public:
00084 
00085     ClassName("cellDistFuncs");
00086 
00087     // Constructors
00088 
00089         //- Construct from mesh
00090         cellDistFuncs(const polyMesh& mesh);
00091 
00092 
00093     // Member Functions
00094 
00095         //- Access mesh
00096         const polyMesh& mesh() const
00097         {
00098             return mesh_;
00099         }
00100 
00101         //- Get patchIDs of named patches
00102         labelHashSet getPatchIDs(const wordList&) const;
00103 
00104         //- Get patchIDs of certain type (e.g. 'processorPolyPatch')
00105         labelHashSet getPatchIDs(const word&) const;
00106 
00107         //- Calculate smallest true distance (and face index)
00108         //  from pt to faces wallFaces.
00109         //  For efficiency reasons we still pass in patch instead of extracting
00110         //  it from mesh_
00111         scalar smallestDist
00112         (
00113             const point& p,
00114             const polyPatch& patch,
00115             const label nWallFaces,
00116             const labelList& wallFaces,
00117             label& meshFaceI
00118         ) const;
00119 
00120         //- Get faces sharing point with face on patch
00121         label getPointNeighbours
00122         (
00123             const primitivePatch&,
00124             const label patchFaceI,
00125             labelList&
00126         ) const;
00127 
00128         //- Size of largest patch (out of supplied subset of patches)
00129         label maxPatchSize(const labelHashSet& patchIDs) const;
00130 
00131         //- Sum of patch sizes (out of supplied subset of patches). 
00132         //  Used in sizing arrays.
00133         label sumPatchSize(const labelHashSet& patchIDs) const;
00134 
00135         //- Correct all cells connected to boundary (via face). Sets values in
00136         //  wallDistCorrected. Sets nearest wallface in nearestFace.
00137         void correctBoundaryFaceCells
00138         (
00139             const labelHashSet& patchIDs,
00140             scalarField& wallDistCorrected,
00141             Map<label>& nearestFace
00142         ) const;
00143 
00144 
00145         //- Correct all cells connected to wall (via point). Sets values in
00146         //  wallDistCorrected. Uses/sets nearest wallFace in nearestFace.
00147         void correctBoundaryPointCells
00148         (
00149             const labelHashSet& patchIDs,
00150             scalarField& wallDistCorrected,
00151             Map<label>& nearestFace
00152         ) const;
00153 };
00154 
00155 
00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00157 
00158 } // End namespace Foam
00159 
00160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00161 
00162 #endif
00163 
00164 // ************************************************************************* //
For further information go to www.openfoam.org