initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / triSurface / booleanOps / intersectedSurface / edgeSurface.H
blob73fe36815be72b6dcd968115d320f5d7b99d3c97
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::edgeSurface
28 Description
29     Description of surface in form of 'cloud of edges'.
31     The 'cloud of edges':
32     - points
33     - edges
34     - faceEdges
35     - parentEdge (edge on surface this edge originates from)
36     and nothing more.
38     (pointEdges constructed from above data)
40     Constructed from triSurface and surfaceIntersection. (uses localPoints
41     of surface of course)
43     Used to easily insert cuts and split faces.
45 Note
46     - points with surface (local)points first, intersection points last
47     - edges with (split) surface edges first, intersection edges last.
49 SourceFiles
50     edgeSurface.C
52 \*---------------------------------------------------------------------------*/
54 #ifndef edgeSurface_H
55 #define edgeSurface_H
57 #include "edgeList.H"
58 #include "labelList.H"
59 #include "pointField.H"
60 #include "typeInfo.H"
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 namespace Foam
67 // Forward declaration of classes
68 class triSurface;
69 class surfaceIntersection;
71 /*---------------------------------------------------------------------------*\
72                            Class edgeSurface Declaration
73 \*---------------------------------------------------------------------------*/
75 class edgeSurface
77 private:
79     // Private data
81         //- All points (0 .. nSurfacePoints_-1 are points from surface)
82         pointField points_;
84         label nSurfacePoints_;
86         //- All edges (0 .. nSurfaceEdges_-1 are (possibly split) surface edges)
87         edgeList edges_;
89         label nSurfaceEdges_;
91         //- Original surface edge. Valid only surfaceEdges.
92         labelList parentEdges_;
94         //- From face to our edges_
95         labelListList faceEdges_;
98         //- Constructed from above: pointEdges
99         labelListList pointEdges_;
102     // Private Member Functions
104         //- Dump edges in obj format
105         static void writeOBJ(const pointField&, const edgeList&, Ostream&);
107         //- Dump selected edges in obj format
108         static void writeOBJ
109         (
110             const pointField&,
111             const edgeList&,
112             const labelList&,
113             Ostream&
114         );
116         //- Calculate pointEdges
117         void calcPointEdges();
121 public:
123     ClassName("edgeSurface");
125     // Constructors
127         //- Construct from surface and intersection description
128         edgeSurface
129         (
130             const triSurface& surf,
131             const bool isFirstSurface,
132             const surfaceIntersection& inter
133         );
136     // Member Functions
138         // Access
140             const pointField& points() const
141             {
142                 return points_;
143             }
145             label nSurfacePoints() const
146             {
147                 return nSurfacePoints_;
148             }
150             const edgeList& edges() const
151             {
152                 return edges_;
153             }
155             label nSurfaceEdges() const
156             {
157                 return nSurfaceEdges_;
158             }
160             bool isSurfaceEdge(const label edgeI) const
161             {
162                 return edgeI < nSurfaceEdges_;
163             }
165             //- Parent edge (original surface edge this edge came from).
166             //  Valid only for edgeI < nSurfaceEdges_.
167             label parentEdge(const label edgeI) const
168             {
169                 if (edgeI < nSurfaceEdges_)
170                 {
171                     return parentEdges_[edgeI];
172                 }
173                 else
174                 {
175                     FatalErrorIn
176                     (
177                         "edgeSurface::parentEdge(const label edgeI) const"
178                     )   << "Trying to get parent (i.e. surface) edge for"
179                         << " intersection edge " << edgeI
180                         << abort(FatalError);
181                     return -1;
182                 }
183             }
185             //- From face to our edges_
186             const labelListList& faceEdges() const
187             {
188                 return faceEdges_;
189             }
191             //- point to edge addressing
192             const labelListList& pointEdges() const
193             {
194                 return pointEdges_;
195             }
198         // Edit
200             //- Add intersection edges to a face. Used for connecting
201             //  floating intersection on face to rest of face.
202             void addIntersectionEdges(const label faceI, const edgeList&);
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 #endif
214 // ************************************************************************* //