|
|
|
edgeSurface.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::edgeSurface 00027 00028 Description 00029 Description of surface in form of 'cloud of edges'. 00030 00031 The 'cloud of edges': 00032 - points 00033 - edges 00034 - faceEdges 00035 - parentEdge (edge on surface this edge originates from) 00036 and nothing more. 00037 00038 (pointEdges constructed from above data) 00039 00040 Constructed from triSurface and surfaceIntersection. (uses localPoints 00041 of surface of course) 00042 00043 Used to easily insert cuts and split faces. 00044 00045 Note 00046 - points with surface (local)points first, intersection points last 00047 - edges with (split) surface edges first, intersection edges last. 00048 00049 SourceFiles 00050 edgeSurface.C 00051 00052 \*---------------------------------------------------------------------------*/ 00053 00054 #ifndef edgeSurface_H 00055 #define edgeSurface_H 00056 00057 #include "edgeList.H" 00058 #include "labelList.H" 00059 #include "pointField.H" 00060 #include "typeInfo.H" 00061 00062 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00063 00064 namespace Foam 00065 { 00066 00067 // Forward declaration of classes 00068 class triSurface; 00069 class surfaceIntersection; 00070 00071 /*---------------------------------------------------------------------------*\ 00072 Class edgeSurface Declaration 00073 \*---------------------------------------------------------------------------*/ 00074 00075 class edgeSurface 00076 { 00077 private: 00078 00079 // Private data 00080 00081 //- All points (0 .. nSurfacePoints_-1 are points from surface) 00082 pointField points_; 00083 00084 label nSurfacePoints_; 00085 00086 //- All edges (0 .. nSurfaceEdges_-1 are (possibly split) surface edges) 00087 edgeList edges_; 00088 00089 label nSurfaceEdges_; 00090 00091 //- Original surface edge. Valid only surfaceEdges. 00092 labelList parentEdges_; 00093 00094 //- From face to our edges_ 00095 labelListList faceEdges_; 00096 00097 00098 //- Constructed from above: pointEdges 00099 labelListList pointEdges_; 00100 00101 00102 // Private Member Functions 00103 00104 //- Dump edges in obj format 00105 static void writeOBJ(const pointField&, const edgeList&, Ostream&); 00106 00107 //- Dump selected edges in obj format 00108 static void writeOBJ 00109 ( 00110 const pointField&, 00111 const edgeList&, 00112 const labelList&, 00113 Ostream& 00114 ); 00115 00116 //- Calculate pointEdges 00117 void calcPointEdges(); 00118 00119 00120 00121 public: 00122 00123 ClassName("edgeSurface"); 00124 00125 // Constructors 00126 00127 //- Construct from surface and intersection description 00128 edgeSurface 00129 ( 00130 const triSurface& surf, 00131 const bool isFirstSurface, 00132 const surfaceIntersection& inter 00133 ); 00134 00135 00136 // Member Functions 00137 00138 // Access 00139 00140 const pointField& points() const 00141 { 00142 return points_; 00143 } 00144 00145 label nSurfacePoints() const 00146 { 00147 return nSurfacePoints_; 00148 } 00149 00150 const edgeList& edges() const 00151 { 00152 return edges_; 00153 } 00154 00155 label nSurfaceEdges() const 00156 { 00157 return nSurfaceEdges_; 00158 } 00159 00160 bool isSurfaceEdge(const label edgeI) const 00161 { 00162 return edgeI < nSurfaceEdges_; 00163 } 00164 00165 //- Parent edge (original surface edge this edge came from). 00166 // Valid only for edgeI < nSurfaceEdges_. 00167 label parentEdge(const label edgeI) const 00168 { 00169 if (edgeI < nSurfaceEdges_) 00170 { 00171 return parentEdges_[edgeI]; 00172 } 00173 else 00174 { 00175 FatalErrorIn 00176 ( 00177 "edgeSurface::parentEdge(const label edgeI) const" 00178 ) << "Trying to get parent (i.e. surface) edge for" 00179 << " intersection edge " << edgeI 00180 << abort(FatalError); 00181 return -1; 00182 } 00183 } 00184 00185 //- From face to our edges_ 00186 const labelListList& faceEdges() const 00187 { 00188 return faceEdges_; 00189 } 00190 00191 //- point to edge addressing 00192 const labelListList& pointEdges() const 00193 { 00194 return pointEdges_; 00195 } 00196 00197 00198 // Edit 00199 00200 //- Add intersection edges to a face. Used for connecting 00201 // floating intersection on face to rest of face. 00202 void addIntersectionEdges(const label faceI, const edgeList&); 00203 }; 00204 00205 00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00207 00208 } // End namespace Foam 00209 00210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00211 00212 #endif 00213 00214 // ************************************************************************* // |