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