|
|
|
PatchTools.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::PatchTools 00027 00028 Description 00029 A collection of tools for searching, sorting PrimitivePatch information. 00030 00031 The class could also be extended to include more that just static methods. 00032 00033 SourceFiles 00034 PatchTools.C 00035 PatchToolsCheck.C 00036 PatchToolsEdgeOwner.C 00037 PatchToolsSearch.C 00038 PatchToolsSortEdges.C 00039 00040 \*---------------------------------------------------------------------------*/ 00041 00042 #ifndef PatchTools_H 00043 #define PatchTools_H 00044 00045 #include "PrimitivePatch.H" 00046 #include "HashSet.H" 00047 00048 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00049 00050 namespace Foam 00051 { 00052 00053 /*---------------------------------------------------------------------------*\ 00054 Class PatchTools Declaration 00055 \*---------------------------------------------------------------------------*/ 00056 00057 class PatchTools 00058 { 00059 public: 00060 00061 //- Check for orientation issues. 00062 // Returns true if problems were found. 00063 // If a normal flips across an edge, places it in the HashSet 00064 template 00065 < 00066 class Face, 00067 template<class> class FaceList, 00068 class PointField, 00069 class PointType 00070 > 00071 static bool checkOrientation 00072 ( 00073 const PrimitivePatch<Face, FaceList, PointField, PointType>&, 00074 const bool report = false, 00075 labelHashSet* marked = 0 00076 ); 00077 00078 00079 //- Fill faceZone with currentZone for every face reachable 00080 // from faceI without crossing edge marked in borderEdge. 00081 // Note: faceZone has to be sized nFaces before calling. 00082 template 00083 < 00084 class BoolListType, 00085 class Face, 00086 template<class> class FaceList, 00087 class PointField, 00088 class PointType 00089 > 00090 static void markZone 00091 ( 00092 const PrimitivePatch<Face, FaceList, PointField, PointType>&, 00093 const BoolListType& borderEdge, 00094 const label faceI, 00095 const label currentZone, 00096 labelList& faceZone 00097 ); 00098 00099 //- Size and fills faceZone with zone of face. 00100 // Zone is area reachable by edge crossing without crossing borderEdge. 00101 // Returns number of zones. 00102 template 00103 < 00104 class BoolListType, 00105 class Face, 00106 template<class> class FaceList, 00107 class PointField, 00108 class PointType 00109 > 00110 static label markZones 00111 ( 00112 const PrimitivePatch<Face, FaceList, PointField, PointType>&, 00113 const BoolListType& borderEdge, 00114 labelList& faceZone 00115 ); 00116 00117 //- Determine the mapping for a sub-patch. 00118 // Only include faces for which bool-list entry is true. 00119 // @param[in] includeFaces faces to include 00120 // @param[out] pointMap mapping new to old localPoints 00121 // @param[out] faceMap mapping new to old faces 00122 template 00123 < 00124 class BoolListType, 00125 class Face, 00126 template<class> class FaceList, 00127 class PointField, 00128 class PointType 00129 > 00130 static void subsetMap 00131 ( 00132 const PrimitivePatch<Face, FaceList, PointField, PointType>&, 00133 const BoolListType& includeFaces, 00134 labelList& pointMap, 00135 labelList& faceMap 00136 ); 00137 00138 //- Return edge-face addressing sorted by angle around the edge. 00139 // Orientation is anticlockwise looking from edge.vec(localPoints()) 00140 template 00141 < 00142 class Face, 00143 template<class> class FaceList, 00144 class PointField, 00145 class PointType 00146 > 00147 static labelListList sortedEdgeFaces 00148 ( 00149 const PrimitivePatch<Face, FaceList, PointField, PointType>& 00150 ); 00151 00152 00153 //- If 2 face neighbours: label of face where ordering of edge 00154 // is consistent with righthand walk. 00155 // If 1 neighbour: label of only face. 00156 // If >2 neighbours: undetermined. 00157 template 00158 < 00159 class Face, 00160 template<class> class FaceList, 00161 class PointField, 00162 class PointType 00163 > 00164 static labelList edgeOwner 00165 ( 00166 const PrimitivePatch<Face, FaceList, PointField, PointType>& 00167 ); 00168 00169 00170 }; 00171 00172 00173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00174 00175 } // End namespace Foam 00176 00177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00178 00179 #ifdef NoRepository 00180 # include "PatchTools.C" 00181 #endif 00182 00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00184 00185 #endif 00186 00187 // ************************************************************************* // |