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) 2013-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  CGAL::indexedVertex
28 
29 Description
30  An indexed form of CGAL::Triangulation_vertex_base_2<K> used to keep
31  track of the vertices in the triangulation.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef Foam_CGAL_indexedVertex_H
36 #define Foam_CGAL_indexedVertex_H
37 
38 // Silence boost bind deprecation warnings (before CGAL-5.2.1)
39 #include "CGAL/version.h"
40 #if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
41 #define BOOST_BIND_GLOBAL_PLACEHOLDERS
42 #endif
43 #pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
44 #pragma clang diagnostic ignored "-Wdeprecated-builtins"
45 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
46 
47 // ------------------------------------------------------------------------- //
48 
49 #include "CGAL/Triangulation_2.h"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace CGAL
54 {
55 
56 // Forward declaration of friend functions and operators
57 
58 template<class Gt, class Vb>
59 class indexedVertex;
60 
61 template<class Gt, class Vb>
62 bool pointPair
63 (
64  const indexedVertex<Gt, Vb>& v0,
65  const indexedVertex<Gt, Vb>& v1
66 );
67 
68 template<class Gt, class Vb>
70 (
71  const indexedVertex<Gt, Vb>& v0,
72  const indexedVertex<Gt, Vb>& v1,
73  const indexedVertex<Gt, Vb>& v2
74 );
75 
76 template<class Gt, class Vb>
77 bool outsideTriangle
78 (
79  const indexedVertex<Gt, Vb>& v0,
80  const indexedVertex<Gt, Vb>& v1,
81  const indexedVertex<Gt, Vb>& v2
82 );
83 
84 /*---------------------------------------------------------------------------*\
85  Class indexedVertex Declaration
86 \*---------------------------------------------------------------------------*/
87 
88 template<class Gt, class Vb=CGAL::Triangulation_vertex_base_2<Gt>>
89 class indexedVertex
90 :
91  public Vb
92 {
93  // Private data
94 
95  //- The index for this triangle vertex
96  int index_;
97 
98  //- Index of pair-point :
99  // NEAR_BOUNDARY_POINT : internal near boundary point.
100  // INTERNAL_POINT : internal point.
101  // FAR_POINT : far-point.
102  // >= 0 : part of point-pair. Index of other point.
103  // Lowest numbered is inside one (master).
104  int type_;
105 
106 
107 public:
108 
110  {
113  MIRROR_POINT = -2,
114  FAR_POINT = -1
115  };
118  typedef typename Vb::Face_handle Face_handle;
119  typedef typename Vb::Point Point;
120 
121  template<class TDS2>
122  struct Rebind_TDS
123  {
124  typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2;
126  };
127 
128 
129  // Constructors
130 
131  inline indexedVertex();
132 
133  inline indexedVertex(const Point& p);
134 
135  inline indexedVertex(const Point& p, const int index, const int& type);
136 
137  inline indexedVertex(const Point& p, Face_handle f);
138 
139  inline indexedVertex(Face_handle f);
140 
141 
142  // Member Functions
143 
144  inline int& index();
145 
146  inline int index() const;
147 
148  inline int& type();
149 
150  inline int type() const;
151 
152  //- Is point a far-point
153  inline bool farPoint() const;
154 
155  //- Is point internal, i.e. not on boundary
156  inline bool internalPoint() const;
157 
158  //- Is point internal and near the boundary
159  inline bool nearBoundary() const;
160 
161  //- Set the point to be near the boundary
162  inline void setNearBoundary();
163 
164  //- Is point a mirror point
165  inline bool mirrorPoint() const;
166 
167  //- Either master or slave of pointPair.
168  inline bool pairPoint() const;
169 
170  //- Master of a pointPair is the lowest numbered one.
171  inline bool ppMaster() const;
172 
173  //- Slave of a pointPair is the highest numbered one.
174  inline bool ppSlave() const;
175 
176  //- Either original internal point or master of pointPair.
177  inline bool internalOrBoundaryPoint() const;
178 
179  //- Is point near the boundary or part of the boundary definition
180  inline bool nearOrOnBoundary() const;
181 
182 
183  // Friend Functions
184 
185  //- Do the two given vertices constitute a boundary point-pair
186  friend bool pointPair <Gt, Vb>
187  (
188  const indexedVertex<Gt, Vb>& v0,
189  const indexedVertex<Gt, Vb>& v1
190  );
191 
192  //- Do the three given vertices constitute a boundary triangle
193  friend bool boundaryTriangle <Gt, Vb>
194  (
195  const indexedVertex<Gt, Vb>& v0,
196  const indexedVertex<Gt, Vb>& v1,
197  const indexedVertex<Gt, Vb>& v2
198  );
199 
200  //- Do the three given vertices constitute an outside triangle
201  friend bool outsideTriangle <Gt, Vb>
202  (
203  const indexedVertex<Gt, Vb>& v0,
204  const indexedVertex<Gt, Vb>& v1,
205  const indexedVertex<Gt, Vb>& v2
206  );
207 
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace CGAL
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include "indexedVertexI.H"
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
void setNearBoundary()
Set the point to be near the boundary.
bool farPoint() const
Is point a far-point.
bool pairPoint() const
Either master or slave of pointPair.
bool ppMaster() const
Master of a pointPair is the lowest numbered one.
vertexType & type()
bool internalPoint() const
Is point internal, i.e. not on boundary.
Foam::label & index()
bool pointPair(const indexedVertex< Gt, Vb > &v0, const indexedVertex< Gt, Vb > &v1)
bool ppSlave() const
Slave of a pointPair is the highest numbered one.
Vb::Face_handle Face_handle
bool nearOrOnBoundary() const
Is point near the boundary or part of the boundary definition.
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
Definition: indexedVertex.H:61
bool mirrorPoint() const
Is point a mirror point.
Specializations for CGAL-related routines.
Definition: indexedCell.H:62
bool boundaryTriangle(const indexedVertex< Gt, Vb > &v0, const indexedVertex< Gt, Vb > &v1, const indexedVertex< Gt, Vb > &v2)
labelList f(nPoints)
Tds::Vertex_handle Vertex_handle
indexedVertex< Gt, Vb2 > Other
volScalarField & p
bool internalOrBoundaryPoint() const
Either original internal point or master of pointPair.
Vb::template Rebind_TDS< TDS2 >::Other Vb2
bool outsideTriangle(const indexedVertex< Gt, Vb > &v0, const indexedVertex< Gt, Vb > &v1, const indexedVertex< Gt, Vb > &v2)
bool nearBoundary() const
Is point internal and near the boundary.