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