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 | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::edgeSurface
26 
27 Description
28  Description of surface in form of 'cloud of edges'.
29 
30  The 'cloud of edges':
31  - points
32  - edges
33  - faceEdges
34  - parentEdge (edge on surface this edge originates from)
35  and nothing more.
36 
37  (pointEdges constructed from above data)
38 
39  Constructed from triSurface and surfaceIntersection. (uses localPoints
40  of surface of course)
41 
42  Used to easily insert cuts and split faces.
43 
44 Note
45  - points with surface (local)points first, intersection points last
46  - edges with (split) surface edges first, intersection edges last.
47 
48 SourceFiles
49  edgeSurface.C
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #ifndef edgeSurface_H
54 #define edgeSurface_H
55 
56 #include "edgeList.H"
57 #include "labelList.H"
58 #include "pointField.H"
59 #include "typeInfo.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 // Forward declaration of classes
67 class triSurface;
68 class surfaceIntersection;
69 
70 /*---------------------------------------------------------------------------*\
71  Class edgeSurface Declaration
72 \*---------------------------------------------------------------------------*/
73 
74 class edgeSurface
75 {
76 private:
77 
78  // Private data
79 
80  //- All points (0 .. nSurfacePoints_-1 are points from surface)
82 
84 
85  //- All edges (0 .. nSurfaceEdges_-1 are (possibly split) surface edges)
87 
89 
90  //- Original surface edge. Valid only surfaceEdges.
92 
93  //- From face to our edges_
95 
96 
97  //- Constructed from above: pointEdges
99 
100 
101  // Private Member Functions
102 
103  //- Dump edges in obj format
104  static void writeOBJ(const pointField&, const edgeList&, Ostream&);
105 
106  //- Dump selected edges in obj format
107  static void writeOBJ
108  (
109  const pointField&,
110  const edgeList&,
111  const labelList&,
112  Ostream&
113  );
114 
115  //- Calculate pointEdges
116  void calcPointEdges();
117 
118 
119 public:
120 
121  ClassName("edgeSurface");
122 
123  // Constructors
124 
125  //- Construct from surface and intersection description
127  (
128  const triSurface& surf,
129  const bool isFirstSurface,
130  const surfaceIntersection& inter
131  );
132 
133 
134  // Member Functions
135 
136  // Access
137 
138  const pointField& points() const
139  {
140  return points_;
141  }
142 
143  label nSurfacePoints() const
144  {
145  return nSurfacePoints_;
146  }
147 
148  const edgeList& edges() const
149  {
150  return edges_;
151  }
152 
153  label nSurfaceEdges() const
154  {
155  return nSurfaceEdges_;
156  }
157 
158  bool isSurfaceEdge(const label edgeI) const
159  {
160  return edgeI < nSurfaceEdges_;
161  }
162 
163  //- Parent edge (original surface edge this edge came from).
164  // Valid only for edgeI < nSurfaceEdges_.
165  label parentEdge(const label edgeI) const
166  {
167  if (edgeI < nSurfaceEdges_)
168  {
169  return parentEdges_[edgeI];
170  }
171  else
172  {
174  << "Trying to get parent (i.e. surface) edge for"
175  << " intersection edge " << edgeI
176  << abort(FatalError);
177  return -1;
178  }
179  }
180 
181  //- From face to our edges_
182  const labelListList& faceEdges() const
183  {
184  return faceEdges_;
185  }
186 
187  //- Point to edge addressing
188  const labelListList& pointEdges() const
189  {
190  return pointEdges_;
191  }
192 
193 
194  // Edit
195 
196  //- Add intersection edges to a face. Used for connecting
197  // floating intersection on face to rest of face.
198  void addIntersectionEdges(const label faceI, const edgeList&);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
Foam::edgeSurface::addIntersectionEdges
void addIntersectionEdges(const label faceI, const edgeList &)
Add intersection edges to a face. Used for connecting.
Definition: edgeSurface.C:343
Foam::edgeSurface::pointEdges_
labelListList pointEdges_
Constructed from above: pointEdges.
Definition: edgeSurface.H:97
Foam::edgeSurface::edgeSurface
edgeSurface(const triSurface &surf, const bool isFirstSurface, const surfaceIntersection &inter)
Construct from surface and intersection description.
Definition: edgeSurface.C:128
typeInfo.H
Foam::edgeSurface::faceEdges_
labelListList faceEdges_
From face to our edges_.
Definition: edgeSurface.H:93
Foam::edgeSurface::isSurfaceEdge
bool isSurfaceEdge(const label edgeI) const
Definition: edgeSurface.H:157
Foam::edgeSurface::pointEdges
const labelListList & pointEdges() const
Point to edge addressing.
Definition: edgeSurface.H:187
Foam::edgeSurface::points
const pointField & points() const
Definition: edgeSurface.H:137
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
labelList.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::surfaceIntersection
Basic surface-surface intersection description. Constructed from two surfaces it creates a descriptio...
Definition: surfaceIntersection.H:80
Foam::triSurface
Triangulated surface description with patch information.
Definition: triSurface.H:57
Foam::edgeSurface::calcPointEdges
void calcPointEdges()
Calculate pointEdges.
Definition: edgeSurface.C:90
Foam::edgeSurface::points_
pointField points_
All points (0 .. nSurfacePoints_-1 are points from surface)
Definition: edgeSurface.H:80
Foam::edgeSurface::nSurfacePoints
label nSurfacePoints() const
Definition: edgeSurface.H:142
Foam::edgeSurface::edges
const edgeList & edges() const
Definition: edgeSurface.H:147
Foam::FatalError
error FatalError
edgeList.H
Foam::edgeSurface::nSurfacePoints_
label nSurfacePoints_
Definition: edgeSurface.H:82
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::edgeSurface
Description of surface in form of 'cloud of edges'.
Definition: edgeSurface.H:73
pointField.H
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::edgeSurface::faceEdges
const labelListList & faceEdges() const
From face to our edges_.
Definition: edgeSurface.H:181
Foam::edgeSurface::nSurfaceEdges
label nSurfaceEdges() const
Definition: edgeSurface.H:152
Foam::edgeSurface::ClassName
ClassName("edgeSurface")
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::edgeSurface::parentEdge
label parentEdge(const label edgeI) const
Parent edge (original surface edge this edge came from).
Definition: edgeSurface.H:164
Foam::edgeSurface::edges_
edgeList edges_
All edges (0 .. nSurfaceEdges_-1 are (possibly split) surface edges)
Definition: edgeSurface.H:85
Foam::edgeSurface::nSurfaceEdges_
label nSurfaceEdges_
Definition: edgeSurface.H:87
Foam::edgeSurface::parentEdges_
labelList parentEdges_
Original surface edge. Valid only surfaceEdges.
Definition: edgeSurface.H:90
Foam::edgeSurface::writeOBJ
static void writeOBJ(const pointField &, const edgeList &, Ostream &)
Dump edges in obj format.
Definition: edgeSurface.C:44