|
|
|
orientedSurface.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 orientedSurface 00027 00028 Description 00029 Given point flip all faces such that normals point in same direction. 00030 00031 SourceFiles 00032 orientedSurface.C 00033 00034 \*---------------------------------------------------------------------------*/ 00035 00036 #ifndef orientedSurface_H 00037 #define orientedSurface_H 00038 00039 #include "triSurface.H" 00040 #include "typeInfo.H" 00041 00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00043 00044 namespace Foam 00045 { 00046 00047 // Class forward declarations 00048 00049 /*---------------------------------------------------------------------------*\ 00050 Class orientedSurface Declaration 00051 \*---------------------------------------------------------------------------*/ 00052 00053 class orientedSurface 00054 : 00055 public triSurface 00056 { 00057 // Data types 00058 00059 //- Enumeration listing whether face needs to be flipped. 00060 enum sideStat 00061 { 00062 UNVISITED, 00063 FLIP, 00064 NOFLIP 00065 }; 00066 00067 00068 // Private Member Functions 00069 00070 //- Return true if face uses edge from start to end. 00071 static bool edgeOrder(const labelledTri&, const edge&); 00072 00073 //- Return true if edge is used in opposite order in faces 00074 static bool consistentEdge 00075 ( 00076 const edge& e, 00077 const labelledTri& f0, 00078 const labelledTri& f1 00079 ); 00080 00081 //- From changed faces get the changed edges 00082 static labelList faceToEdge 00083 ( 00084 const triSurface&, 00085 const labelList& changedFaces 00086 ); 00087 00088 //- From changed edges check the orientation of the connected faces 00089 // and flip them. Return changed faces. 00090 static labelList edgeToFace 00091 ( 00092 const triSurface&, 00093 const labelList& changedEdges, 00094 labelList& flip 00095 ); 00096 00097 //- Given nearest point and face check orientation to nearest face 00098 // and flip if nessecary (only marked in flipState) and propagate. 00099 static void propagateOrientation 00100 ( 00101 const triSurface&, 00102 const point& outsidePoint, 00103 const bool orientOutside, 00104 const label nearestFaceI, 00105 const point& nearestPt, 00106 labelList& flipState 00107 ); 00108 00109 //- Given flipState reverse triangles of *this. Return true if 00110 // anything flipped. 00111 static bool flipSurface(triSurface& s, const labelList& flipState); 00112 00113 public: 00114 00115 ClassName("orientedSurface"); 00116 00117 00118 // Constructors 00119 00120 //- Construct null 00121 orientedSurface(); 00122 00123 //- Construct from triSurface and sample point which is either 00124 // outside (orientOutside = true) or inside (orientOutside = false). 00125 // Uses linear search to find nearest. 00126 orientedSurface 00127 ( 00128 const triSurface&, 00129 const point& samplePoint, 00130 const bool orientOutside = true 00131 ); 00132 00133 //- Construct from triSurface. Calculates outside point as being 00134 // outside the bounding box of the surface. 00135 orientedSurface(const triSurface&, const bool orientOutside = true); 00136 00137 00138 // Member Functions 00139 00140 //- Flip faces such that normals are consistent with point: 00141 // orientOutside=true : point outside surface 00142 // orientOutside=false : point inside surface 00143 static bool orient(triSurface&, const point&, const bool orientOutside); 00144 00145 }; 00146 00147 00148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00149 00150 } // End namespace Foam 00151 00152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00153 00154 #endif 00155 00156 // ************************************************************************* // |