![]() |
|
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 meshCutAndRemove 00027 00028 Description 00029 like meshCutter but also removes non-anchor side of cell. 00030 00031 SourceFiles 00032 meshCutAndRemove.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef meshCutAndRemove_H 00037 #define meshCutAndRemove_H 00038 00039 #include "edgeVertex.H" 00040 #include "boolList.H" 00041 #include "labelList.H" 00042 #include "typeInfo.H" 00043 #include "DynamicList.H" 00044 #include "Map.H" 00045 00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00047 00048 namespace Foam 00049 { 00050 00051 // Class forward declarations 00052 class Time; 00053 class polyTopoChange; 00054 class cellCuts; 00055 class polyMesh; 00056 class face; 00057 00058 /*---------------------------------------------------------------------------*\ 00059 Class meshCutAndRemove Declaration 00060 \*---------------------------------------------------------------------------*/ 00061 00062 class meshCutAndRemove 00063 : 00064 public edgeVertex 00065 { 00066 // Private data 00067 00068 //- Faces added in last setRefinement. Per split cell label of added 00069 // face 00070 Map<label> addedFaces_; 00071 00072 //- Points added in last setRefinement. Per split edge label of added 00073 // point 00074 HashTable<label, edge, Hash<edge> > addedPoints_; 00075 00076 00077 // Private Static Functions 00078 00079 // Returns -1 or index in elems1 of first shared element. 00080 static label firstCommon(const labelList& lst1, const labelList& lst2); 00081 00082 //- Do the elements of edge appear in consecutive order in the list 00083 static bool isIn(const edge&, const labelList&); 00084 00085 00086 // Private Member Functions 00087 00088 //- Returns -1 or the cell in cellLabels that is cut. 00089 label findCutCell(const cellCuts&, const labelList&) const; 00090 00091 //- Returns first pointI in pointLabels that uses an internal 00092 // face. Used to find point to inflate cell/face from (has to be 00093 // connected to internal face) 00094 label findInternalFacePoint(const labelList& pointLabels) const; 00095 00096 //- Find point on face that is part of original mesh and that is 00097 // point connected to the patch 00098 label findPatchFacePoint(const face& f, const label patchI) const; 00099 00100 //- Get new owner and neighbour of face. Checks anchor points to see if 00101 // need to get original or added cell. 00102 void faceCells 00103 ( 00104 const cellCuts& cuts, 00105 const label exposedPatchI, 00106 const label faceI, 00107 label& own, 00108 label& nei, 00109 label& patchID 00110 ) const; 00111 00112 //- Get patch information for face. 00113 void getZoneInfo 00114 ( 00115 const label faceI, 00116 label& zoneID, 00117 label& zoneFlip 00118 ) const; 00119 00120 //- Adds a face from point. Flips face if owner>neighbour 00121 void addFace 00122 ( 00123 polyTopoChange& meshMod, 00124 const label faceI, 00125 const label masterPointI, 00126 const face& newFace, 00127 const label owner, 00128 const label neighbour, 00129 const label patchID 00130 ); 00131 00132 //- Modifies existing faceI for either new owner/neighbour or 00133 // new face points. Checks if anything changed and flips face 00134 // if owner>neighbour 00135 void modFace 00136 ( 00137 polyTopoChange& meshMod, 00138 const label faceI, 00139 const face& newFace, 00140 const label owner, 00141 const label neighbour, 00142 const label patchID 00143 ); 00144 00145 // Copies face starting from startFp. Jumps cuts. Marks visited 00146 // vertices in visited. 00147 void copyFace 00148 ( 00149 const face& f, 00150 const label startFp, 00151 const label endFp, 00152 face& newFace 00153 ) const; 00154 00155 //- Split face along cut into two faces. Faces are in same point 00156 // order as original face (i.e. maintain normal direction) 00157 void splitFace 00158 ( 00159 const face& f, 00160 const label v0, 00161 const label v1, 00162 00163 face& f0, 00164 face& f1 00165 ) const; 00166 00167 //- Add cuts of edges to face 00168 face addEdgeCutsToFace(const label faceI) const; 00169 00170 //- Convert loop of cuts into face. 00171 face loopToFace 00172 ( 00173 const label cellI, 00174 const labelList& loop 00175 ) const; 00176 00177 00178 00179 //- Disallow default bitwise copy construct 00180 meshCutAndRemove(const meshCutAndRemove&); 00181 00182 //- Disallow default bitwise assignment 00183 void operator=(const meshCutAndRemove&); 00184 00185 public: 00186 00187 //- Runtime type information 00188 ClassName("meshCutAndRemove"); 00189 00190 00191 // Constructors 00192 00193 //- Construct from mesh 00194 meshCutAndRemove(const polyMesh& mesh); 00195 00196 00197 // Member Functions 00198 00199 // Edit 00200 00201 //- Do actual cutting with cut description. Inserts mesh changes 00202 // into meshMod. 00203 // cuts: all loops and topological information 00204 // cutPatch: for every cell that has loop the patch number 00205 // exposedPatch: patch for other exposed faces 00206 void setRefinement 00207 ( 00208 const label exposedPatchI, 00209 const cellCuts& cuts, 00210 const labelList& cutPatch, 00211 polyTopoChange& meshMod 00212 ); 00213 00214 //- Force recalculation of locally stored data on topological change 00215 void updateMesh(const mapPolyMesh&); 00216 00217 00218 // Access 00219 00220 //- Faces added. Per split cell label of added face 00221 const Map<label>& addedFaces() const 00222 { 00223 return addedFaces_; 00224 } 00225 00226 //- Points added. Per split edge label of added point. 00227 // (note: fairly useless across topology changes since one of the 00228 // points of the edge will probably disappear) 00229 const HashTable<label, edge, Hash<edge> >& addedPoints() const 00230 { 00231 return addedPoints_; 00232 } 00233 }; 00234 00235 00236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00237 00238 } // End namespace Foam 00239 00240 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00241 00242 #endif 00243 00244 // ************************************************************************* //