indexedVertex.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2018 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  CGAL::indexedVertex
26 
27 Description
28  An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep
29  track of the Delaunay vertices in the tessellation.
30 
31 SourceFiles
32  indexedVertexI.H
33  indexedVertex.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef indexedVertex_H
38 #define indexedVertex_H
39 
40 #include "CGAL/Triangulation_3.h"
42 #include "tensor.H"
43 #include "triad.H"
44 #include "InfoProxy.H"
45 #include "point.H"
46 #include "indexedVertexEnum.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace CGAL
51 {
52 template<class Gt, class Vb> class indexedVertex;
53 }
54 
55 namespace Foam
56 {
57 
58 class Ostream;
59 class Istream;
60 
61 template<class Gt, class Vb> Ostream& operator<<
62 (
63  Ostream&,
65 );
66 
67 template<class Gt, class Vb> Ostream& operator<<
68 (
69  Ostream&,
71 );
72 
73 template<class Gt, class Vb> Istream& operator>>
74 (
75  Istream&,
77 );
78 
79 inline Istream& operator>>
80 (
81  Istream& is,
82  CGAL::Point_3<baseK>& p
83 );
84 
85 inline Ostream& operator<<
86 (
87  Ostream& os,
88  const CGAL::Point_3<baseK>& p
89 );
90 
91 } // End namespace Foam
92 
93 
94 namespace CGAL
95 {
96 
97 /*---------------------------------------------------------------------------*\
98  Class indexedVertex Declaration
99 \*---------------------------------------------------------------------------*/
100 
101 template<class Gt, class Vb = CGAL::Triangulation_vertex_base_3<Gt>>
102 class indexedVertex
103 :
105  public Vb
106 {
107  // Private data
108 
109  //- Type of pair-point
110  vertexType type_;
111 
112  //- The index for this Delaunay vertex. For referred vertices, the
113  // index is negative for vertices that are the outer (slave) of point
114  // pairs
115  Foam::label index_;
116 
117  //- Number of the processor that owns this vertex
118  int processor_;
119 
120  //- Required alignment of the dual cell of this vertex
121  Foam::tensor alignment_;
122 
123  //- Target size of the dual cell of this vertex
124  Foam::scalar targetCellSize_;
125 
126  //- Specify whether the vertex is fixed or movable.
127  bool vertexFixed_;
128 
129 
130 public:
132  typedef typename Vb::Triangulation_data_structure Tds;
133  typedef typename Vb::Point Point;
134  typedef typename Tds::Vertex_handle Vertex_handle;
135  typedef typename Tds::Cell_handle Cell_handle;
136 
137  template<class TDS2>
138  struct Rebind_TDS
139  {
140  typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
142  };
143 
144  // Constructors
145 
146  inline indexedVertex();
147 
148  inline indexedVertex(const Point& p);
149 
150  inline indexedVertex(const Point& p, vertexType type);
151 
152  inline indexedVertex(const Foam::point& p, vertexType type);
153 
154  inline indexedVertex
155  (
156  const Point& p,
157  Foam::label index,
159  int processor
160  );
161 
162  inline indexedVertex
163  (
164  const Foam::point& p,
165  Foam::label index,
167  int processor
168  );
169 
170  inline indexedVertex(const Point& p, Cell_handle f);
171 
172  inline indexedVertex(Cell_handle f);
173 
174 
175  // Member Functions
176 
177  inline Foam::label& index();
178 
179  inline Foam::label index() const;
180 
181  inline vertexType& type();
182 
183  inline vertexType type() const;
184 
185  inline Foam::tensor& alignment();
186 
187  inline const Foam::tensor& alignment() const;
188 
189  inline Foam::scalar& targetCellSize();
190 
191  inline Foam::scalar targetCellSize() const;
192 
193  //- Is point a far-point
194  inline bool farPoint() const;
195 
196  //- Is point internal, i.e. not on boundary
197  inline bool internalPoint() const;
198 
199  //- Is this a referred vertex
200  inline bool referred() const;
201 
202  //- Is this a "real" point on this processor, i.e. is internal or part
203  // of the boundary description, and not a "far" or "referred" point
204  inline bool real() const;
205 
206  // For referred vertices, what is the original processor index
207  inline int procIndex() const;
208 
209  // For referred vertices, set the original processor index
210  inline int& procIndex();
211 
212  //- Set the point to be internal
213  inline void setInternal();
214 
215  //- Is point internal and near the boundary
216  inline bool nearBoundary() const;
217 
218  //- Set the point to be near the boundary
219  inline void setNearBoundary();
220 
221  //- Is point internal and near a proc boundary
222  inline bool nearProcBoundary() const;
223 
224  //- Set the point to be near a proc boundary
225  inline void setNearProcBoundary();
226 
227  //- Either master or slave of pointPair.
228  inline bool boundaryPoint() const;
229 
230  //- Either original internal point or master of pointPair.
231  inline bool internalOrBoundaryPoint() const;
232 
233  //- Is point near the boundary or part of the boundary definition
234  inline bool nearOrOnBoundary() const;
235 
236  //- Part of a feature point
237  inline bool featurePoint() const;
238 
239  //- Part of a feature edge
240  inline bool featureEdgePoint() const;
241 
242  //- Part of a surface point pair
243  inline bool surfacePoint() const;
244 
245  inline bool internalBoundaryPoint() const;
246  inline bool internalBaffleSurfacePoint() const;
247  inline bool internalBaffleEdgePoint() const;
248 
249  inline bool externalBoundaryPoint() const;
250  inline bool externalBaffleSurfacePoint() const;
251  inline bool externalBaffleEdgePoint() const;
252 
253  inline bool constrained() const;
254 
255  //- Is the vertex fixed or movable
256  inline bool fixed() const;
257 
258  //- Fix the vertex so that it can't be moved
259  inline bool& fixed();
261  inline void operator=(const indexedVertex& rhs)
262  {
263  Vb::operator=(rhs);
264 
265  this->type_ = rhs.type();
266  this->index_ = rhs.index();
267  this->processor_ = rhs.procIndex();
268  this->alignment_ = rhs.alignment();
269  this->targetCellSize_ = rhs.targetCellSize();
270  this->vertexFixed_ = rhs.fixed();
271  }
273  inline bool operator==(const indexedVertex& rhs) const
274  {
275  return
276  (
277  // this->point() == rhs.point()
278  this->type_ == rhs.type()
279  && this->index_ == rhs.index()
280  && this->processor_ == rhs.procIndex()
281  && this->vertexFixed_ == rhs.fixed()
282  );
283  }
285  inline bool operator!=(const indexedVertex& rhs) const
286  {
287  return !(*this == rhs);
288  }
289 
290 
291  // Info
292 
293  //- Return info proxy.
294  // Used to print indexedVertex information to a stream
296  {
297  return *this;
298  }
299 
300  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
301  (
302  Foam::Ostream&,
304  );
305 
306  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
307  (
308  Foam::Ostream&,
309  const indexedVertex<Gt, Vb>&
310  );
311 
312  friend Foam::Istream& Foam::operator>> <Gt, Vb>
313  (
314  Foam::Istream&,
316  );
317 };
318 
319 
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321 
322 } // End namespace CGAL
323 
324 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
325 
326 #ifdef CGAL_INEXACT
327 namespace Foam
328 {
329  // For inexact representations where the storage type is a double, the data
330  // is contiguous. This may not be true for exact number types.
331  template<>
332  inline bool contiguous
333  <
335  <
336  K,
337  CGAL::Triangulation_vertex_base_3<K>
338  >
339  >()
340  {
341  return true;
342  }
343 
344 
345  template<>
346  inline bool contiguous<CGAL::Triangulation_vertex_base_3<K>::Point>()
347  {
348  return true;
349  }
350 
351 } // End namespace Foam
352 #endif
353 
354 
355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356 
357 #include "indexedVertexI.H"
358 
359 #ifdef NoRepository
360  #include "indexedVertex.C"
361 #endif
362 
363 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
364 
365 #endif
366 
367 // ************************************************************************* //
type
Types of root.
Definition: Roots.H:52
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
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
vertexType & type()
Foam::label & index()
CGAL::Triangulation_data_structure_3< Vb, Cb > Tds
Tds::Cell_handle Cell_handle
IOstream & fixed(IOstream &io)
Definition: IOstream.H:576
Foam::scalar & targetCellSize()
CGAL::Exact_predicates_exact_constructions_kernel K
void operator=(const indexedVertex &rhs)
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
Definition: indexedVertex.H:51
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
labelList f(nPoints)
Foam::tensor & alignment()
bool contiguous()
contiguous
Definition: contiguous.H:54
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:45
bool fixed() const
Is the vertex fixed or movable.
Tds::Vertex_handle Vertex_handle
volScalarField & p
bool operator!=(const particle &, const particle &)
Definition: particle.C:1150
Vb::template Rebind_TDS< TDS2 >::Other Vb2
Namespace for OpenFOAM.