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