FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

edgeSurface.H

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