00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::cellDistFuncs 00026 00027 Description 00028 Collection of functions used in wall distance calculation. 00029 00030 SourceFiles 00031 cellDistFuncs.C 00032 cellDistFuncsTemplates.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef cellDistFuncs_H 00037 #define cellDistFuncs_H 00038 00039 #include <OpenFOAM/scalarField.H> 00040 #include <OpenFOAM/HashSet.H> 00041 #include <OpenFOAM/Map.H> 00042 #include <OpenFOAM/wordList.H> 00043 #include <OpenFOAM/scalarField.H> 00044 #include <OpenFOAM/point.H> 00045 #include <OpenFOAM/primitivePatch.H> 00046 #include <OpenFOAM/className.H> 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 // Forward declaration of classes 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/derived off certain type (e.g. 'processorPolyPatch') 00105 // Uses isA, not isType 00106 template<class Type> 00107 labelHashSet getPatchIDs() const; 00108 00109 //- Calculate smallest true distance (and face index) 00110 // from pt to faces wallFaces. 00111 // For efficiency reasons we still pass in patch instead of extracting 00112 // it from mesh_ 00113 scalar smallestDist 00114 ( 00115 const point& p, 00116 const polyPatch& patch, 00117 const label nWallFaces, 00118 const labelList& wallFaces, 00119 label& meshFaceI 00120 ) const; 00121 00122 //- Get faces sharing point with face on patch 00123 label getPointNeighbours 00124 ( 00125 const primitivePatch&, 00126 const label patchFaceI, 00127 labelList& 00128 ) const; 00129 00130 //- Size of largest patch (out of supplied subset of patches) 00131 label maxPatchSize(const labelHashSet& patchIDs) const; 00132 00133 //- Sum of patch sizes (out of supplied subset of patches). 00134 // Used in sizing arrays. 00135 label sumPatchSize(const labelHashSet& patchIDs) const; 00136 00137 //- Correct all cells connected to boundary (via face). Sets values in 00138 // wallDistCorrected. Sets nearest wallface in nearestFace. 00139 void correctBoundaryFaceCells 00140 ( 00141 const labelHashSet& patchIDs, 00142 scalarField& wallDistCorrected, 00143 Map<label>& nearestFace 00144 ) const; 00145 00146 00147 //- Correct all cells connected to wall (via point). Sets values in 00148 // wallDistCorrected. Uses/sets nearest wallFace in nearestFace. 00149 void correctBoundaryPointCells 00150 ( 00151 const labelHashSet& patchIDs, 00152 scalarField& wallDistCorrected, 00153 Map<label>& nearestFace 00154 ) const; 00155 }; 00156 00157 00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00159 00160 } // End namespace Foam 00161 00162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00163 00164 #ifdef NoRepository 00165 # include "cellDistFuncsTemplates.C" 00166 #endif 00167 00168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00169 00170 #endif 00171 00172 // ************************ vim: set sw=4 sts=4 et: ************************ //