indexedVertex.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  CGAL::indexedVertex
29 
30 Description
31  An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep
32  track of the Delaunay vertices in the tessellation.
33 
34 SourceFiles
35  indexedVertexI.H
36  indexedVertex.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef indexedVertex_H
41 #define indexedVertex_H
42 
43 #include "CGAL/Triangulation_3.h"
45 #include "tensor.H"
46 #include "triad.H"
47 #include "InfoProxy.H"
48 #include "point.H"
49 #include "indexedVertexEnum.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace CGAL
54 {
55 template<class Gt, class Vb> class indexedVertex;
56 }
57 
58 namespace Foam
59 {
60 
61 class Ostream;
62 class Istream;
63 
64 template<class Gt, class Vb> Ostream& operator<<
65 (
66  Ostream&,
68 );
69 
70 template<class Gt, class Vb> Ostream& operator<<
71 (
72  Ostream&,
74 );
75 
76 template<class Gt, class Vb> Istream& operator>>
77 (
78  Istream&,
80 );
81 
82 inline Istream& operator>>
83 (
84  Istream& is,
85  CGAL::Point_3<baseK>& p
86 );
87 
88 inline Ostream& operator<<
89 (
90  Ostream& os,
91  const CGAL::Point_3<baseK>& p
92 );
93 
94 } // End namespace Foam
95 
96 
97 namespace CGAL
98 {
99 
100 /*---------------------------------------------------------------------------*\
101  Class indexedVertex Declaration
102 \*---------------------------------------------------------------------------*/
103 
104 template<class Gt, class Vb = CGAL::Triangulation_vertex_base_3<Gt>>
105 class indexedVertex
106 :
108  public Vb
109 {
110  // Private Data
111 
112  //- Type of pair-point
113  vertexType type_;
114 
115  //- The index for this Delaunay vertex. For referred vertices, the
116  // index is negative for vertices that are the outer (slave) of point
117  // pairs
118  Foam::label index_;
119 
120  //- Number of the processor that owns this vertex
121  int processor_;
122 
123  //- Required alignment of the dual cell of this vertex
124  Foam::tensor alignment_;
125 
126  //- Target size of the dual cell of this vertex
127  Foam::scalar targetCellSize_;
128 
129  //- Specify whether the vertex is fixed or movable.
130  bool vertexFixed_;
131 
132 
133 public:
134 
135  typedef typename Vb::Triangulation_data_structure Tds;
136  typedef typename Vb::Point Point;
137  typedef typename Tds::Vertex_handle Vertex_handle;
138  typedef typename Tds::Cell_handle Cell_handle;
139 
140  template<class TDS2>
141  struct Rebind_TDS
142  {
143  typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
145  };
146 
147 
148  // Generated Methods
149 
150  //- Copy construct
151  indexedVertex(const indexedVertex&) = default;
152 
153 
154  // Constructors
155 
156  inline indexedVertex();
157 
158  inline indexedVertex(const Point& p);
159 
160  inline indexedVertex(const Point& p, vertexType type);
161 
162  inline indexedVertex(const Foam::point& p, vertexType type);
163 
164  inline indexedVertex
165  (
166  const Point& p,
167  Foam::label index,
168  vertexType type,
169  int processor
170  );
171 
172  inline indexedVertex
173  (
174  const Foam::point& p,
175  Foam::label index,
176  vertexType type,
177  int processor
178  );
179 
180  inline indexedVertex(const Point& p, Cell_handle f);
181 
182  inline indexedVertex(Cell_handle f);
183 
184 
185  // Member Functions
186 
187  inline Foam::label& index();
188 
189  inline Foam::label index() const;
190 
191  inline vertexType& type();
192 
193  inline vertexType type() const;
194 
195  inline Foam::tensor& alignment();
196 
197  inline const Foam::tensor& alignment() const;
198 
199  inline Foam::scalar& targetCellSize();
200 
201  inline Foam::scalar targetCellSize() const;
202 
203  //- Is point a far-point
204  inline bool farPoint() const;
205 
206  //- Is point internal, i.e. not on boundary
207  inline bool internalPoint() const;
208 
209  //- Is this a referred vertex
210  inline bool referred() const;
211 
212  //- Is this a "real" point on this processor, i.e. is internal or part
213  // of the boundary description, and not a "far" or "referred" point
214  inline bool real() const;
215 
216  // For referred vertices, what is the original processor index
217  inline int procIndex() const;
218 
219  // For referred vertices, set the original processor index
220  inline int& procIndex();
221 
222  //- Set the point to be internal
223  inline void setInternal();
224 
225  //- Is point internal and near the boundary
226  inline bool nearBoundary() const;
227 
228  //- Set the point to be near the boundary
229  inline void setNearBoundary();
230 
231  //- Is point internal and near a proc boundary
232  inline bool nearProcBoundary() const;
233 
234  //- Set the point to be near a proc boundary
235  inline void setNearProcBoundary();
236 
237  //- Either master or slave of pointPair.
238  inline bool boundaryPoint() const;
239 
240  //- Either original internal point or master of pointPair.
241  inline bool internalOrBoundaryPoint() const;
242 
243  //- Is point near the boundary or part of the boundary definition
244  inline bool nearOrOnBoundary() const;
245 
246  //- Part of a feature point
247  inline bool featurePoint() const;
248 
249  //- Part of a feature edge
250  inline bool featureEdgePoint() const;
251 
252  //- Part of a surface point pair
253  inline bool surfacePoint() const;
254 
255  inline bool internalBoundaryPoint() const;
256  inline bool internalBaffleSurfacePoint() const;
257  inline bool internalBaffleEdgePoint() const;
258 
259  inline bool externalBoundaryPoint() const;
260  inline bool externalBaffleSurfacePoint() const;
261  inline bool externalBaffleEdgePoint() const;
262 
263  inline bool constrained() const;
264 
265  //- Is the vertex fixed or movable
266  inline bool fixed() const;
267 
268  //- Fix the vertex so that it can't be moved
269  inline bool& fixed();
270 
271 
272  // Member Operators
273 
274  //- Copy assignment
275  inline void operator=(const indexedVertex& rhs)
276  {
277  Vb::operator=(rhs);
278 
279  this->type_ = rhs.type();
280  this->index_ = rhs.index();
281  this->processor_ = rhs.procIndex();
282  this->alignment_ = rhs.alignment();
283  this->targetCellSize_ = rhs.targetCellSize();
284  this->vertexFixed_ = rhs.fixed();
285  }
286 
287  inline bool operator==(const indexedVertex& rhs) const
288  {
289  return
290  (
291  //this->point() == rhs.point()
292  this->type_ == rhs.type()
293  && this->index_ == rhs.index()
294  && this->processor_ == rhs.procIndex()
295  && this->vertexFixed_ == rhs.fixed()
296  );
297  }
298 
299  inline bool operator!=(const indexedVertex& rhs) const
300  {
301  return !(*this == rhs);
302  }
303 
304 
305  // IOstream Operators
306 
307  //- Info proxy, to print information to a stream
309  {
310  return *this;
311  }
312 
313  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
314  (
315  Foam::Ostream&,
317  );
318 
319  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
320  (
321  Foam::Ostream&,
322  const indexedVertex<Gt, Vb>&
323  );
324 
325  friend Foam::Istream& Foam::operator>> <Gt, Vb>
326  (
327  Foam::Istream&,
329  );
330 };
331 
332 
333 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
334 
335 } // End namespace CGAL
336 
337 
338 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
339 
340 #ifdef CGAL_INEXACT
341 namespace Foam
342 {
343  // For inexact representations where the storage type is a double, the data
344  // is contiguous. This may not be true for exact number types.
345 
346  template<>
347  struct is_contiguous
348  <
349  CGAL::indexedVertex<K, CGAL::Triangulation_vertex_base_3<K>>
350  > : std::true_type {};
351 
352  template<>
353  struct is_contiguous
354  <
355  CGAL::Triangulation_vertex_base_3<K>::Point
356  > : std::true_type {};
357 
358 } // End namespace Foam
359 #endif
360 
361 
362 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
363 
364 #include "indexedVertexI.H"
365 
366 #ifdef NoRepository
367  #include "indexedVertex.C"
368 #endif
369 
370 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
371 
372 #endif
373 
374 // ************************************************************************* //
Foam::Tensor< scalar >
CGAL::indexedVertex::alignment
Foam::tensor & alignment()
Definition: indexedVertexI.H:189
CGAL::indexedVertex::nearOrOnBoundary
bool nearOrOnBoundary() const
Is point near the boundary or part of the boundary definition.
Definition: indexedVertexI.H:300
p
volScalarField & p
Definition: createFieldRefs.H:8
CGAL::indexedVertex::setNearBoundary
void setNearBoundary()
Set the point to be near the boundary.
Definition: indexedVertexI.H:279
Foam::InfoProxy
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:47
CGAL::indexedVertex::type
vertexType & type()
Definition: indexedVertexI.H:174
CGAL::indexedVertex::Point
Vb::Point Point
Definition: indexedVertex.H:135
InfoProxy.H
point.H
CGAL::indexedVertex::featureEdgePoint
bool featureEdgePoint() const
Part of a feature edge.
Definition: indexedVertexI.H:358
triad.H
CGAL::indexedVertex::internalBoundaryPoint
bool internalBoundaryPoint() const
Definition: indexedVertexI.H:307
CGAL::indexedVertex::featurePoint
bool featurePoint() const
Part of a feature point.
Definition: indexedVertexI.H:351
CGAL::indexedVertex
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
Definition: indexedVertex.H:54
CGAL::indexedVertex::Vertex_handle
Tds::Vertex_handle Vertex_handle
Definition: indexedVertex.H:136
CGAL
Definition: indexedCell.H:56
CGAL::indexedVertex::indexedVertex
indexedVertex()
Definition: indexedVertexI.H:33
CGAL::indexedVertex::internalBaffleEdgePoint
bool internalBaffleEdgePoint() const
Definition: indexedVertexI.H:319
tensor.H
CGAL::indexedVertex::setInternal
void setInternal()
Set the point to be internal.
Definition: indexedVertexI.H:265
indexedVertexEnum.H
CGAL::indexedVertex::farPoint
bool farPoint() const
Is point a far-point.
Definition: indexedVertexI.H:217
CGAL::indexedVertex::fixed
bool fixed() const
Is the vertex fixed or movable.
Definition: indexedVertexI.H:372
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
CGAL::indexedVertex::nearProcBoundary
bool nearProcBoundary() const
Is point internal and near a proc boundary.
CGAL::indexedVertex::index
Foam::label & index()
Definition: indexedVertexI.H:159
CGAL::indexedVertex::Rebind_TDS::Vb2
Vb::template Rebind_TDS< TDS2 >::Other Vb2
Definition: indexedVertex.H:142
Foam::indexedVertexEnum
Definition: indexedVertexEnum.H:48
CGAL::indexedVertex::surfacePoint
bool surfacePoint() const
Part of a surface point pair.
Definition: indexedVertexI.H:365
CGAL::indexedVertex::info
Foam::InfoProxy< indexedVertex< Gt, Vb > > info() const
Info proxy, to print information to a stream.
Definition: indexedVertex.H:307
CGAL::indexedVertex::operator==
bool operator==(const indexedVertex &rhs) const
Definition: indexedVertex.H:286
CGAL::indexedVertex::targetCellSize
Foam::scalar & targetCellSize()
Definition: indexedVertexI.H:203
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
CGAL::indexedVertex::Tds
Vb::Triangulation_data_structure Tds
Definition: indexedVertex.H:134
CGAL::indexedVertex::externalBaffleEdgePoint
bool externalBaffleEdgePoint() const
Definition: indexedVertexI.H:337
CGAL::indexedVertex::nearBoundary
bool nearBoundary() const
Is point internal and near the boundary.
Definition: indexedVertexI.H:272
CGAL::indexedVertex::internalBaffleSurfacePoint
bool internalBaffleSurfacePoint() const
Definition: indexedVertexI.H:313
CGAL::indexedVertex::referred
bool referred() const
Is this a referred vertex.
Definition: indexedVertexI.H:231
CGAL::indexedVertex::procIndex
int procIndex() const
Definition: indexedVertexI.H:251
indexedVertex.C
f
labelList f(nPoints)
Foam::Vector< scalar >
CGAL::indexedVertex::Rebind_TDS
Definition: indexedVertex.H:140
CGAL::indexedVertex::internalPoint
bool internalPoint() const
Is point internal, i.e. not on boundary.
Definition: indexedVertexI.H:224
CGAL::indexedVertex::Cell_handle
Tds::Cell_handle Cell_handle
Definition: indexedVertex.H:137
indexedVertexI.H
CGAL::indexedVertex::externalBaffleSurfacePoint
bool externalBaffleSurfacePoint() const
Definition: indexedVertexI.H:331
CGAL::indexedVertex::internalOrBoundaryPoint
bool internalOrBoundaryPoint() const
Either original internal point or master of pointPair.
Definition: indexedVertexI.H:293
Point
CGAL::Point_3< K > Point
Definition: CGALIndexedPolyhedron.H:53
CGAL::indexedVertex::externalBoundaryPoint
bool externalBoundaryPoint() const
Definition: indexedVertexI.H:325
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
CGAL::indexedVertex::operator=
void operator=(const indexedVertex &rhs)
Copy assignment.
Definition: indexedVertex.H:274
CGAL::indexedVertex::setNearProcBoundary
void setNearProcBoundary()
Set the point to be near a proc boundary.
CGAL::indexedVertex::boundaryPoint
bool boundaryPoint() const
Either master or slave of pointPair.
Definition: indexedVertexI.H:286
CGAL::indexedVertex::Rebind_TDS::Other
indexedVertex< Gt, Vb2 > Other
Definition: indexedVertex.H:143
CGAL::indexedVertex::constrained
bool constrained() const
Definition: indexedVertexI.H:344
CGALTriangulation3DKernel.H
CGAL::indexedVertex::real
bool real() const
Is this a "real" point on this processor, i.e. is internal or part.
Definition: indexedVertexI.H:244
CGAL::indexedVertex::operator!=
bool operator!=(const indexedVertex &rhs) const
Definition: indexedVertex.H:298