|
|
|
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-2007 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 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 // Class forward declarations 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 coordinates. 00074 pointField savedPoints_; 00075 00076 00077 // Private Member Functions 00078 00079 //- Test if face is convex. Allow slight concavity through 00080 // minConcaveCos. 00081 static bool convexFace 00082 ( 00083 const scalar minConcaveCos, 00084 const pointField&, 00085 const face& 00086 ); 00087 00088 //- Test if set of faces (in primitivePatch) can be combined into 00089 // single face. Uses convexFace. 00090 static bool validFace 00091 ( 00092 const scalar minConcaveCos, 00093 const indirectPrimitivePatch& 00094 ); 00095 00096 //- Create cell-local map from face to region (formed by merging faces 00097 // across edges) 00098 void regioniseFaces 00099 ( 00100 const scalar minCos, 00101 const label cellI, 00102 Map<label>& faceRegion 00103 ) const; 00104 00105 //- Does merging faces invalidate (unmerged) neighbouring faces? 00106 bool faceNeighboursValid 00107 ( 00108 const label cellI, 00109 const Map<label>& faceRegion 00110 ) const; 00111 00112 //- Disallow default bitwise copy construct 00113 combineFaces(const combineFaces&); 00114 00115 //- Disallow default bitwise assignment 00116 void operator=(const combineFaces&); 00117 00118 public: 00119 00120 //- Runtime type information 00121 ClassName("combineFaces"); 00122 00123 00124 // Constructors 00125 00126 //- Construct from mesh 00127 combineFaces(const polyMesh& mesh, const bool undoable = false); 00128 00129 00130 // Member Functions 00131 00132 // Access 00133 00134 //- If undoable: masterface for every set. 00135 const labelList& masterFace() const 00136 { 00137 return masterFace_; 00138 } 00139 00140 00141 // Helper functions 00142 00143 //- Extract lists of all (non-coupled) boundary faces that can 00144 // be merged. Uses getFaceRegions. 00145 labelListList getMergeSets 00146 ( 00147 const scalar featureCos, 00148 const scalar minConcaveCos 00149 ) const; 00150 00151 //- Gets outside of patch as a face (in mesh point labels) 00152 static face getOutsideFace(const indirectPrimitivePatch&); 00153 00154 00155 // Topology changes 00156 00157 //- Play commands into polyTopoChange to combine faces. Gets 00158 // labelListList of sets of faces to combine. Does no check 00159 // for whether resulting face is legal. 00160 void setRefinement 00161 ( 00162 const labelListList&, 00163 polyTopoChange& 00164 ); 00165 00166 //- Force recalculation of locally stored data on topological change 00167 void updateMesh(const mapPolyMesh&); 00168 00169 //- Play commands into polyTopoChange to reinsert original faces. 00170 // No other topo changes can be done inbetween setRefinement and 00171 // setUnrefinement. Gets the master face labels whose sets need 00172 // to be restored. 00173 void setUnrefinement 00174 ( 00175 const labelList& masterFaces, 00176 polyTopoChange& meshMod 00177 ); 00178 00179 }; 00180 00181 00182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00183 00184 } // End namespace Foam 00185 00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00187 00188 #endif 00189 00190 // ************************************************************************* // |