edgeSurface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::edgeSurface
28 
29 Description
30  Description of surface in form of 'cloud of edges'.
31 
32  The 'cloud of edges':
33  - points
34  - edges
35  - faceEdges
36  - parentEdge (edge on surface this edge originates from)
37  and nothing more.
38 
39  (pointEdges constructed from above data)
40 
41  Constructed from triSurface and surfaceIntersection. (uses localPoints
42  of surface of course)
43 
44  Used to easily insert cuts and split faces.
45 
46 Note
47  - points with surface (local)points first, intersection points last
48  - edges with (split) surface edges first, intersection edges last.
49 
50 SourceFiles
51  edgeSurface.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef edgeSurface_H
56 #define edgeSurface_H
57 
58 #include "edgeList.H"
59 #include "labelList.H"
60 #include "pointField.H"
61 #include "typeInfo.H"
62 
63 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 
65 namespace Foam
66 {
67 
68 // Forward declaration of classes
69 class triSurface;
70 class surfaceIntersection;
71 
72 /*---------------------------------------------------------------------------*\
73  Class edgeSurface Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class edgeSurface
77 {
78 private:
79 
80  // Private data
81 
82  //- All points (0 .. nSurfacePoints_-1 are points from surface)
83  pointField points_;
84 
85  label nSurfacePoints_;
86 
87  //- All edges (0 .. nSurfaceEdges_-1 are (possibly split) surface edges)
88  edgeList edges_;
89 
90  label nSurfaceEdges_;
91 
92  //- Original surface edge. Valid only surfaceEdges.
93  labelList parentEdges_;
94 
95  //- From face to our edges_
96  labelListList faceEdges_;
97 
98  //- Constructed from above: pointEdges
99  labelListList pointEdges_;
100 
101 
102  // Private Member Functions
103 
104  //- Calculate pointEdges
105  void calcPointEdges();
106 
107 
108 public:
109 
110  ClassName("edgeSurface");
111 
112  // Constructors
113 
114  //- Construct from surface and intersection description
116  (
117  const triSurface& surf,
118  const bool isFirstSurface,
119  const surfaceIntersection& inter
120  );
121 
122 
123  // Member Functions
124 
125  // Access
126 
127  const pointField& points() const
128  {
129  return points_;
130  }
131 
132  label nSurfacePoints() const
133  {
134  return nSurfacePoints_;
135  }
136 
137  const edgeList& edges() const
138  {
139  return edges_;
140  }
141 
142  label nSurfaceEdges() const
143  {
144  return nSurfaceEdges_;
145  }
146 
147  bool isSurfaceEdge(const label edgeI) const
148  {
149  return edgeI < nSurfaceEdges_;
150  }
151 
152  //- Parent edge (original surface edge this edge came from).
153  // Valid only for edgeI < nSurfaceEdges_.
154  label parentEdge(const label edgeI) const
155  {
156  if (edgeI < nSurfaceEdges_)
157  {
158  return parentEdges_[edgeI];
159  }
160  else
161  {
163  << "Trying to get parent (i.e. surface) edge for"
164  << " intersection edge " << edgeI
165  << abort(FatalError);
166  return -1;
167  }
168  }
169 
170  //- From face to our edges_
171  const labelListList& faceEdges() const
172  {
173  return faceEdges_;
174  }
175 
176  //- Point to edge addressing
177  const labelListList& pointEdges() const
178  {
179  return pointEdges_;
180  }
181 
182 
183  // Edit
184 
185  //- Add intersection edges to a face. Used for connecting
186  // floating intersection on face to rest of face.
187  void addIntersectionEdges(const label facei, const edgeList&);
188 };
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace Foam
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Foam::edgeSurface::edgeSurface
edgeSurface(const triSurface &surf, const bool isFirstSurface, const surfaceIntersection &inter)
Construct from surface and intersection description.
Definition: edgeSurface.C:115
typeInfo.H
Foam::edgeSurface::isSurfaceEdge
bool isSurfaceEdge(const label edgeI) const
Definition: edgeSurface.H:146
Foam::edgeSurface::pointEdges
const labelListList & pointEdges() const
Point to edge addressing.
Definition: edgeSurface.H:176
Foam::edgeSurface::addIntersectionEdges
void addIntersectionEdges(const label facei, const edgeList &)
Add intersection edges to a face. Used for connecting.
Definition: edgeSurface.C:316
Foam::edgeSurface::points
const pointField & points() const
Definition: edgeSurface.H:126
labelList.H
Foam::Field< vector >
Foam::surfaceIntersection
Basic surface-surface intersection description. Constructed from two surfaces it creates a descriptio...
Definition: surfaceIntersection.H:130
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:76
Foam::edgeSurface::nSurfacePoints
label nSurfacePoints() const
Definition: edgeSurface.H:131
Foam::edgeSurface::edges
const edgeList & edges() const
Definition: edgeSurface.H:136
Foam::FatalError
error FatalError
edgeList.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::edgeSurface
Description of surface in form of 'cloud of edges'.
Definition: edgeSurface.H:75
pointField.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::List< edge >
Foam::edgeSurface::faceEdges
const labelListList & faceEdges() const
From face to our edges_.
Definition: edgeSurface.H:170
Foam::edgeSurface::nSurfaceEdges
label nSurfaceEdges() const
Definition: edgeSurface.H:141
Foam::edgeSurface::ClassName
ClassName("edgeSurface")
Foam::edgeSurface::parentEdge
label parentEdge(const label edgeI) const
Parent edge (original surface edge this edge came from).
Definition: edgeSurface.H:153