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::patchWave 00026 00027 Description 00028 Takes a set of patches to start MeshWave from. After construction holds 00029 distance at cells and distance at patches. Is e.g. used by wallDist to 00030 construct volScalarField with correct distance to wall. 00031 00032 SourceFiles 00033 patchWave.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef patchWave_H 00038 #define patchWave_H 00039 00040 #include <meshTools/cellDistFuncs.H> 00041 #include <OpenFOAM/FieldField.H> 00042 00043 00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00045 00046 namespace Foam 00047 { 00048 00049 // Forward declaration of classes 00050 class polyMesh; 00051 class wallPoint; 00052 template<class Type> class MeshWave; 00053 00054 /*---------------------------------------------------------------------------*\ 00055 Class patchWave Declaration 00056 \*---------------------------------------------------------------------------*/ 00057 00058 class patchWave 00059 : 00060 public cellDistFuncs 00061 { 00062 // Private Data 00063 00064 //- Current patch subset (stored as patchIDs) 00065 labelHashSet patchIDs_; 00066 00067 //- Do accurate distance calculation for near-wall cells. 00068 bool correctWalls_; 00069 00070 //- Number of cells/faces unset after MeshWave has finished 00071 label nUnset_; 00072 00073 //- Distance at cell centres 00074 scalarField distance_; 00075 00076 //- Distance at patch faces 00077 FieldField<Field, scalar> patchDistance_; 00078 00079 00080 // Private Member Functions 00081 00082 //- Set initial set of changed faces (= all faces of patches in 00083 // patchIDs). Set changedFaces to labels of changed faces, 00084 // changedInfo to face centres. 00085 void setChangedFaces 00086 ( 00087 const labelHashSet& patchIDs, 00088 labelList& changedFaces, 00089 List<wallPoint>& changedInfo 00090 ) const; 00091 00092 //- Copy MeshWave cell values. Return number of illegal/unset 00093 // cells. 00094 label getValues(const MeshWave<wallPoint>&); 00095 00096 00097 public: 00098 00099 // Constructors 00100 00101 //- Construct from mesh and patches to initialize to 0 and flag 00102 // whether or not to correct wall. 00103 // Calculate for all cells. correctWalls : correct wall (face&point) 00104 // cells for correct distance, searching neighbours. 00105 patchWave 00106 ( 00107 const polyMesh& mesh, 00108 const labelHashSet& patchIDs, 00109 bool correctWalls = true 00110 ); 00111 00112 // Destructor 00113 00114 virtual ~patchWave(); 00115 00116 00117 // Member Functions 00118 00119 //- Correct for mesh geom/topo changes 00120 virtual void correct(); 00121 00122 00123 label nUnset() const 00124 { 00125 return nUnset_; 00126 } 00127 00128 const scalarField& distance() const 00129 { 00130 return distance_; 00131 } 00132 00133 //- Non const access so we can 'transfer' contents for efficiency. 00134 scalarField& distance() 00135 { 00136 return distance_; 00137 } 00138 00139 const FieldField<Field, scalar>& patchDistance() const 00140 { 00141 return patchDistance_; 00142 } 00143 00144 FieldField<Field, scalar>& patchDistance() 00145 { 00146 return patchDistance_; 00147 } 00148 00149 }; 00150 00151 00152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00153 00154 } // End namespace Foam 00155 00156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00157 00158 #endif 00159 00160 // ************************ vim: set sw=4 sts=4 et: ************************ //