|
|
|
combineFaces.HGo to the documentation of this file.00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2009 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 Foam::combineFaces 00027 00028 Description 00029 Combines boundary faces into single face. The faces get the patch 00030 of the first face ('the master') 00031 00032 SourceFiles 00033 combineFaces.C 00034 00035 \*---------------------------------------------------------------------------*/ 00036 00037 #ifndef combineFaces_H 00038 #define combineFaces_H 00039 00040 #include "indirectPrimitivePatch.H" 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 // Forward declaration of classes 00048 class polyMesh; 00049 class polyTopoChange; 00050 class mapPolyMesh; 00051 class face; 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class combineFaces Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 class combineFaces 00058 { 00059 // Private data 00060 00061 //- Reference to mesh 00062 const polyMesh& mesh_; 00063 00064 //- Whether undoable 00065 const bool undoable_; 00066 00067 //- If undoable: masterface for every set. 00068 labelList masterFace_; 00069 00070 //- If undoable: per set the vertices of all the faces in the set. 00071 List<faceList> faceSetsVertices_; 00072 00073 //- If undoable: saved point labels. 00074 labelList savedPointLabels_; 00075 00076 //- If undoable: saved coordinates of above points. 00077 pointField savedPoints_; 00078 00079 00080 00081 // Private Member Functions 00082 00083 //- Test if face is convex. Allow slight concavity through 00084 // minConcaveCos. 00085 static bool convexFace 00086 ( 00087 const scalar minConcaveCos, 00088 const pointField&, 00089 const face& 00090 ); 00091 00092 //- Test if set of faces (in primitivePatch) can be combined into 00093 // single face. Uses convexFace. 00094 static bool validFace 00095 ( 00096 const scalar minConcaveCos, 00097 const indirectPrimitivePatch& 00098 ); 00099 00100 //- Create cell-local map from face to region (formed by merging faces 00101 // across edges) 00102 void regioniseFaces 00103 ( 00104 const scalar minCos, 00105 const label cellI, 00106 const labelList& cEdges, 00107 Map<label>& faceRegion 00108 ) const; 00109 00110 //- Does merging faces invalidate (unmerged) neighbouring faces? 00111 bool faceNeighboursValid 00112 ( 00113 const label cellI, 00114 const Map<label>& faceRegion 00115 ) const; 00116 00117 00118 00119 //- Disallow default bitwise copy construct 00120 combineFaces(const combineFaces&); 00121 00122 //- Disallow default bitwise assignment 00123 void operator=(const combineFaces&); 00124 00125 public: 00126 00127 //- Runtime type information 00128 ClassName("combineFaces"); 00129 00130 00131 // Constructors 00132 00133 //- Construct from mesh 00134 combineFaces(const polyMesh& mesh, const bool undoable = false); 00135 00136 00137 // Member Functions 00138 00139 // Access 00140 00141 //- If undoable: masterface for every set. 00142 const labelList& masterFace() const 00143 { 00144 return masterFace_; 00145 } 00146 00147 //- If undoable: set of original point labels of stored points 00148 const labelList& savedPointLabels() const 00149 { 00150 return savedPointLabels_; 00151 } 00152 00153 00154 // Helper functions 00155 00156 //- Extract lists of all (non-coupled) boundary faces on selected 00157 // cells that can be merged. Uses getFaceRegions. 00158 labelListList getMergeSets 00159 ( 00160 const scalar featureCos, 00161 const scalar minConcaveCos, 00162 const labelHashSet& boundaryCells 00163 ) const; 00164 00165 //- Extract lists of all (non-coupled) boundary faces that can 00166 // be merged. Uses getFaceRegions. 00167 labelListList getMergeSets 00168 ( 00169 const scalar featureCos, 00170 const scalar minConcaveCos 00171 ) const; 00172 00173 //- Gets outside of patch as a face (in mesh point labels) 00174 static face getOutsideFace(const indirectPrimitivePatch&); 00175 00176 00177 // Topology changes 00178 00179 //- Play commands into polyTopoChange to combine faces. Gets 00180 // labelListList of sets of faces to combine. Does no check 00181 // for whether resulting face is legal. 00182 void setRefinement 00183 ( 00184 const labelListList&, 00185 polyTopoChange& 00186 ); 00187 00188 //- Force recalculation of locally stored data on topological change 00189 void updateMesh(const mapPolyMesh&); 00190 00191 //- Play commands into polyTopoChange to reinsert original faces. 00192 // No other topo changes can be done inbetween setRefinement and 00193 // setUnrefinement. Can be called multiple times to undo parts 00194 // of the last setRefinement call. 00195 // Gets the master face labels whose sets need to be restored. 00196 // Returns maps from added restored point to 00197 // original point label (i.e. content of savedPointLabels_). 00198 // (only restoredPoints are actually set; rest are just for 00199 // generalness) 00200 void setUnrefinement 00201 ( 00202 const labelList& masterFaces, 00203 polyTopoChange& meshMod, 00204 Map<label>& restoredPoints, 00205 Map<label>& restoredFaces, 00206 Map<label>& restoredCells 00207 ); 00208 }; 00209 00210 00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00212 00213 } // End namespace Foam 00214 00215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00216 00217 #endif 00218 00219 // ************************************************************************* // |