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::localPointRegion 00026 00027 Description 00028 Takes mesh with 'baffles' (= boundary faces sharing points). 00029 Determines for selected points on boundary faces the 'point region' it is 00030 connected to. Each region can be visited by a cell-face-cell walk. 00031 Used in duplicating points after splitting baffles. 00032 00033 Regions are not consecutive per processor. They will be -1..nRegions_. 00034 00035 Note: coupled boundaries (cyclics, parallel) not fully tested. 00036 00037 SourceFiles 00038 localPointRegion.C 00039 00040 \*---------------------------------------------------------------------------*/ 00041 00042 #ifndef localPointRegion_H 00043 #define localPointRegion_H 00044 00045 #include <OpenFOAM/typeInfo.H> 00046 #include <OpenFOAM/Map.H> 00047 #include <OpenFOAM/labelList.H> 00048 #include <OpenFOAM/HashSet.H> 00049 #include <OpenFOAM/faceList.H> 00050 #include <OpenFOAM/boolList.H> 00051 00052 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00053 00054 namespace Foam 00055 { 00056 00057 // Forward declaration of classes 00058 class primitiveMesh; 00059 class polyMesh; 00060 class face; 00061 class mapPolyMesh; 00062 00063 /*---------------------------------------------------------------------------*\ 00064 Class localPointRegion Declaration 00065 \*---------------------------------------------------------------------------*/ 00066 00067 class localPointRegion 00068 { 00069 // Private data 00070 00072 //label nRegions_; 00073 00074 //- Per point that is to duplicated to the local index 00075 Map<label> meshPointMap_; 00076 00077 //- Per local point the regions it is in 00078 labelListList pointRegions_; 00079 00080 //- Per face that uses a duplicated point the local index 00081 Map<label> meshFaceMap_; 00082 00083 //- Per face the region of its points 00084 faceList faceRegions_; 00085 00086 00087 // Private Member Functions 00088 00089 //- Given minimum cell the points on a face are connected to 00090 // determine the points to be duplicated. 00091 void countPointRegions 00092 ( 00093 const polyMesh& mesh, 00094 const boolList& candidatePoint, 00095 const Map<label>& candidateFace, 00096 faceList& minRegion 00097 ); 00098 00099 //- Do all: calculate points that need to be duplicated. 00100 void calcPointRegions 00101 ( 00102 const polyMesh& mesh, 00103 boolList& candidatePoint 00104 ); 00105 00106 00107 //- Check if two faces are equal. If forward = false checks f1 in 00108 // reverse order. 00109 static bool isDuplicate 00110 ( 00111 const face& f0, 00112 const face& f1, 00113 const bool forward 00114 ); 00115 00116 public: 00117 00118 //- Runtime type information 00119 ClassName("localPointRegion"); 00120 00121 00122 // Constructors 00123 00124 //- Construct from mesh. Assumes all non-coupled boundary points 00125 // are candidates for duplication 00126 localPointRegion(const polyMesh& mesh); 00127 00128 //- Construct from mesh and candidate points for duplication 00129 localPointRegion 00130 ( 00131 const polyMesh& mesh, 00132 const labelList& candidatePoints 00133 ); 00134 00135 00136 // Member Functions 00137 00138 // Static Member Functions 00139 00140 //- Helper routine to find baffles (two boundary faces using the 00141 // same points but in reverse order) 00142 // Gets list of (boundary!) faces to check. Returns labelList 00143 // of same size as the input list 00144 // with -1 or index of other face in the input list. 00145 // Does not handle duplicate faces on both sides of processor patch 00146 static labelList findDuplicateFaces 00147 ( 00148 const primitiveMesh&, 00149 const labelList& 00150 ); 00151 00152 00153 // Access 00154 00156 //label nRegions() const 00157 //{ 00158 // return nRegions_; 00159 //} 00160 00161 //- Per point that is to be duplicated the local index 00162 const Map<label>& meshPointMap() const 00163 { 00164 return meshPointMap_; 00165 } 00166 00167 //- Per local point the regions it is in 00168 const labelListList& pointRegions() const 00169 { 00170 return pointRegions_; 00171 } 00172 00173 //- Per face that uses a duplicated point the local index 00174 const Map<label>& meshFaceMap() const 00175 { 00176 return meshFaceMap_; 00177 } 00178 00179 //- Per face the region of its points 00180 const faceList& faceRegions() const 00181 { 00182 return faceRegions_; 00183 } 00184 00185 00186 // Edit 00187 00188 //- Force recalculation of locally stored data on topological change 00189 void updateMesh(const mapPolyMesh&); 00190 }; 00191 00192 00193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00194 00195 } // End namespace Foam 00196 00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00198 00199 #endif 00200 00201 // ************************ vim: set sw=4 sts=4 et: ************************ //