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