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-2020 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  indexedVertex(const indexedVertex& p) = default;
175 
176 
177  // Member Functions
178 
179  inline Foam::label& index();
180 
181  inline Foam::label index() const;
182 
183  inline vertexType& type();
184 
185  inline vertexType type() const;
186 
187  inline Foam::tensor& alignment();
188 
189  inline const Foam::tensor& alignment() const;
190 
191  inline Foam::scalar& targetCellSize();
192 
193  inline Foam::scalar targetCellSize() const;
194 
195  //- Is point a far-point
196  inline bool farPoint() const;
197 
198  //- Is point internal, i.e. not on boundary
199  inline bool internalPoint() const;
200 
201  //- Is this a referred vertex
202  inline bool referred() const;
203 
204  //- Is this a "real" point on this processor, i.e. is internal or part
205  // of the boundary description, and not a "far" or "referred" point
206  inline bool real() const;
207 
208  // For referred vertices, what is the original processor index
209  inline int procIndex() const;
210 
211  // For referred vertices, set the original processor index
212  inline int& procIndex();
213 
214  //- Set the point to be internal
215  inline void setInternal();
216 
217  //- Is point internal and near the boundary
218  inline bool nearBoundary() const;
219 
220  //- Set the point to be near the boundary
221  inline void setNearBoundary();
222 
223  //- Is point internal and near a proc boundary
224  inline bool nearProcBoundary() const;
225 
226  //- Set the point to be near a proc boundary
227  inline void setNearProcBoundary();
228 
229  //- Either master or slave of pointPair.
230  inline bool boundaryPoint() const;
231 
232  //- Either original internal point or master of pointPair.
233  inline bool internalOrBoundaryPoint() const;
234 
235  //- Is point near the boundary or part of the boundary definition
236  inline bool nearOrOnBoundary() const;
237 
238  //- Part of a feature point
239  inline bool featurePoint() const;
240 
241  //- Part of a feature edge
242  inline bool featureEdgePoint() const;
243 
244  //- Part of a surface point pair
245  inline bool surfacePoint() const;
246 
247  inline bool internalBoundaryPoint() const;
248  inline bool internalBaffleSurfacePoint() const;
249  inline bool internalBaffleEdgePoint() const;
250 
251  inline bool externalBoundaryPoint() const;
252  inline bool externalBaffleSurfacePoint() const;
253  inline bool externalBaffleEdgePoint() const;
254 
255  inline bool constrained() const;
256 
257  //- Is the vertex fixed or movable
258  inline bool fixed() const;
259 
260  //- Fix the vertex so that it can't be moved
261  inline bool& fixed();
263  inline void operator=(const indexedVertex& rhs)
264  {
265  Vb::operator=(rhs);
266 
267  this->type_ = rhs.type();
268  this->index_ = rhs.index();
269  this->processor_ = rhs.procIndex();
270  this->alignment_ = rhs.alignment();
271  this->targetCellSize_ = rhs.targetCellSize();
272  this->vertexFixed_ = rhs.fixed();
273  }
275  inline bool operator==(const indexedVertex& rhs) const
276  {
277  return
278  (
279  // this->point() == rhs.point()
280  this->type_ == rhs.type()
281  && this->index_ == rhs.index()
282  && this->processor_ == rhs.procIndex()
283  && this->vertexFixed_ == rhs.fixed()
284  );
285  }
287  inline bool operator!=(const indexedVertex& rhs) const
288  {
289  return !(*this == rhs);
290  }
291 
292 
293  // Info
294 
295  //- Return info proxy.
296  // Used to print indexedVertex information to a stream
298  {
299  return *this;
300  }
301 
302  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
303  (
304  Foam::Ostream&,
306  );
307 
308  friend Foam::Ostream& Foam::operator<< <Gt, Vb>
309  (
310  Foam::Ostream&,
311  const indexedVertex<Gt, Vb>&
312  );
313 
314  friend Foam::Istream& Foam::operator>> <Gt, Vb>
315  (
316  Foam::Istream&,
318  );
319 };
320 
321 
322 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
323 
324 } // End namespace CGAL
325 
326 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
327 
328 #ifdef CGAL_INEXACT
329 namespace Foam
330 {
331  // For inexact representations where the storage type is a double, the data
332  // is contiguous. This may not be true for exact number types.
333  template<>
334  inline bool contiguous
335  <
337  <
338  K,
339  CGAL::Triangulation_vertex_base_3<K>
340  >
341  >()
342  {
343  return true;
344  }
345 
346 
347  template<>
348  inline bool contiguous<CGAL::Triangulation_vertex_base_3<K>::Point>()
349  {
350  return true;
351  }
352 
353 } // End namespace Foam
354 #endif
355 
356 
357 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 
359 #include "indexedVertexI.H"
360 
361 #ifdef NoRepository
362  #include "indexedVertex.C"
363 #endif
364 
365 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
366 
367 #endif
368 
369 // ************************************************************************* //
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:573
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:54
labelList f(nPoints)
Foam::tensor & alignment()
bool contiguous()
contiguous
Definition: contiguous.H:53
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:45
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
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:1205
Vb::template Rebind_TDS< TDS2 >::Other Vb2
Namespace for OpenFOAM.