File: graph_traits_Polyhedron_3.h

package info (click to toggle)
cgal 5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,084 kB
  • sloc: cpp: 742,056; ansic: 182,102; sh: 647; python: 411; makefile: 280; javascript: 110
file content (498 lines) | stat: -rw-r--r-- 19,049 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
// Copyright (c) 2007  GeometryFactory (France).  All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL: https://github.com/CGAL/cgal/blob/v5.2/Polyhedron/include/CGAL/boost/graph/graph_traits_Polyhedron_3.h $
// $Id: graph_traits_Polyhedron_3.h 10834e4 2020-06-30T16:37:59+02:00 Laurent Rineau
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s)     : Andreas Fabri, Fernando Cacciola

#ifndef CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H
#define CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H

#include <CGAL/boost/graph/graph_traits_HalfedgeDS.h>

#include <CGAL/Polyhedron_3.h>
#include <CGAL/Iterator_range.h>
#include <CGAL/HalfedgeDS_decorator.h>

#define CGAL_HDS_PARAM_ template < class Traits, class Items, class Alloc> class HDS

//
// NOTE: The BGL algorithms are NOT const-correct: i.e., they take a "G const&"
// but instantiate "graph_traits<G>" instead of "graph_traits<G const>"
// This is known Boost bug which will eventually be fixed, but in the meantime we need
// to coerce both const and non-const specializations.
// That is, HDS_graph_traits<G const> is really the same as HDS_graph_traits<G>
// so graph_traits<G> is also the same as graph_traits<G const>.
// Therefore, while, for instance, "graph_traits<G const>::vertex_descriptor"
// is conceptually const-correct, it actually corresponds to the non-const handle,
// hence the const_cast<> used below in the functions implementation.
//

namespace boost
{

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >
   : CGAL::HDS_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >
{
  typedef typename Gt::Point_3 vertex_property_type;
};

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const >
   : CGAL::HDS_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> > // See NOTE above!
{};

} // namespace boost

namespace CGAL {

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertices_size_type
num_vertices(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  return p.size_of_vertices();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edges_size_type
num_edges(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  return p.size_of_halfedges() / 2;
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::degree_size_type
degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor v
       , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return v->vertex_degree();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::degree_size_type
out_degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor v
           , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return v->vertex_degree();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::degree_size_type
in_degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor v
          , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return v->vertex_degree();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::degree_size_type
degree(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::face_descriptor f
       , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return f->facet_degree();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor
source(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_descriptor e
       , const CGAL::Polyhedron_3<Gt,I,HDS,A> & )
{
  return e.halfedge()->opposite()->vertex();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor
target(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_descriptor e
       , const CGAL::Polyhedron_3<Gt,I,HDS,A> & )
{
  return e.halfedge()->vertex();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
std::pair<
  typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_descriptor
  , bool>
edge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor u
     , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor v
     , const CGAL::Polyhedron_3<Gt,I,HDS,A> &)
{
  typedef CGAL::Polyhedron_3<Gt,I,HDS,A> P;
  typedef typename P::Halfedge_around_vertex_circulator Circ;
  typedef boost::graph_traits< P > Traits;
  typedef typename Traits::edge_descriptor edge;

  // circulate around the inedges of u
  Circ c(u->halfedge()), d(u->halfedge());
  if(c != 0) {
    do {
      if(c->opposite()->vertex() == v) {
        return std::make_pair(edge(c->opposite()), true);
      }
    } while (++c != d);
  }

  return std::make_pair(edge(), false);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
inline Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_iterator>
vertices( const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_iterator Iter;
  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
  return make_range( Iter(ncp.vertices_begin()), Iter(ncp.vertices_end()) );
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
inline Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_iterator>
edges( const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_iterator_i Iter_i;
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::edge_iterator Iter;
  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
  return make_range( Iter(Iter_i(ncp.halfedges_begin())), Iter(Iter_i(ncp.halfedges_end()) ));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
inline Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::in_edge_iterator>
in_edges( typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor u
          , const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::in_edge_iterator Iter;
  return make_range(Iter(halfedge(u,p),p), Iter(halfedge(u,p),p,1));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
inline Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::out_edge_iterator>
out_edges( typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::vertex_descriptor u
           , const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::out_edge_iterator Iter;
  return make_range(Iter(halfedge(u,p),p), Iter(halfedge(u,p),p,1));
}

//
// MutableHalfedgeGraph
//

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor
add_vertex(CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  return g.hds().vertices_push_back(typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Vertex());
}


template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor
add_vertex(const typename boost::graph_traits<CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_property_type& p
           , CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  return g.hds().vertices_push_back(typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Vertex(p));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
remove_vertex(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor v
             , CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  g.hds().vertices_erase(v);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor
add_edge(CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  return typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor(
    g.hds().edges_push_back(typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Halfedge(),
                            typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Halfedge()));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
remove_edge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor e
            , CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  g.hds().edges_erase(e.halfedge());
}


template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
set_target(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h1
         , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor v
         , CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  // set_face has become private in the halfedge provided by
  // polyhedron for unknown reasons, although it used to be public
  // once.

  // We sneak in anyway. Inheritance can't keep us out.
  typedef typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Halfedge::Base Sneak;
  static_cast<Sneak&>(*h1).set_vertex(v);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
set_next(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h1
         , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h2
         , CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  typedef typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Halfedge::Base Sneak;
  static_cast<Sneak&>(*h1).set_next(h2);
  static_cast<Sneak&>(*h2).set_prev(h1);
}

//
// MutableFaceGraph
//

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor
add_face(CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  return g.hds().faces_push_back(typename CGAL::Polyhedron_3<Gt,I,HDS,A>::HalfedgeDS::Face());
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A, class InputIterator>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt, I, HDS, A> >::face_descriptor
add_face(InputIterator begin, InputIterator end, CGAL::Polyhedron_3<Gt, I, HDS, A>& g)
{
  return g.hds().add_facet(begin, end);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
remove_face(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor f
            , CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  g.hds().faces_erase(f);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
set_face(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
  , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor f
  , CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  // set_face has become private in the halfedge provided by
  // polyhedron for unknown reasons, although it used to be public
  // once.

  // We sneak in anyway. Inheritance can't keep us out.
  typedef typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Halfedge::Base Sneak;
  static_cast<Sneak&>(*h).set_face(f);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
set_halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor f
  , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
  , CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  typedef typename CGAL::Polyhedron_3<Gt, I, HDS, A>::Halfedge_data_structure Hds;
  CGAL::HalfedgeDS_decorator<Hds> D(g.hds());
  D.set_face_halfedge(f, h);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
set_halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor v
  , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
  , CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  typedef typename CGAL::Polyhedron_3<Gt,I,HDS,A>::Vertex::Base Sneak;
  static_cast<Sneak&>(*v).set_halfedge(h);
}


//
// HalfedgeGraph
//
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor
edge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
     , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor(h);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor e
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return e.halfedge();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor v
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return v->halfedge();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
std::pair< typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
           , bool>
halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor u
         , typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor v
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  std::pair< typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edge_descriptor
             , bool> e = edge(u, v, g);
  return std::make_pair(e.first.halfedge(), e.second);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
opposite(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return h->opposite();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor
source(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>& g)
{
  return target(opposite(h, g), g);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertex_descriptor
target(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return h->vertex();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
next(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor outedge
     , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return outedge->next();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
prev(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor outedge
     , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return outedge->prev();
}


//
// HalfedgeListGraph
//

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_iterator>
halfedges(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_iterator Iter;
  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
  return make_range(Iter(ncp.halfedges_begin()), Iter(ncp.halfedges_end()));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedges_size_type
num_halfedges(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  return p.size_of_halfedges();
}

// FaceGraph
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor
face(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor h
     , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return h->face();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::halfedge_descriptor
halfedge(typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::face_descriptor f
         , const CGAL::Polyhedron_3<Gt,I,HDS,A>&)
{
  return f->halfedge();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
inline Iterator_range<typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::face_iterator >
faces(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  typedef typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::face_iterator face_iterator;
  CGAL::Polyhedron_3<Gt,I,HDS,A>& ncp = const_cast<CGAL::Polyhedron_3<Gt,I,HDS,A>&>(p);
  return make_range( face_iterator(ncp.facets_begin()), face_iterator(ncp.facets_end()));
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> const>::faces_size_type
num_faces(const CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  return p.size_of_facets();
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void
reserve(CGAL::Polyhedron_3<Gt,I,HDS,A>& p,
        typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::vertices_size_type nv,
        typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::edges_size_type ne,
        typename boost::graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >::faces_size_type nf)
{
  p.reserve(nv, 2*ne, nf);
}

template<class Gt, class I, CGAL_HDS_PARAM_, class A>
void normalize_border(CGAL::Polyhedron_3<Gt,I,HDS,A>& p)
{
  p.normalize_border();
}

} // namespace CGAL


#ifndef CGAL_NO_DEPRECATED_CODE

namespace CGAL {
template<class Gt, class I, CGAL_HDS_PARAM_, class A>
struct halfedge_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >
   : CGAL::HDS_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> >
{
  typedef CGAL::HDS_graph_traits< CGAL::Polyhedron_3<Gt,I,HDS,A> > Base;
  typedef typename Gt::Point_3 Point;
  typedef typename Base::edge_iterator undirected_edge_iterator;
};
} // namespace CGAL
#include <CGAL/boost/graph/backward_compatibility_functions.h>

namespace boost {
  // The following functions were defined in the namespace boost
  using CGAL::vertices;
  using CGAL::edges;
  using CGAL::num_vertices;
  using CGAL::num_edges;
  using CGAL::out_edges;
  using CGAL::in_edges;
  using CGAL::target;
  using CGAL::source;
} // namespace boost

#endif //CGAL_NO_DEPRECATED_CODE

#undef CGAL_HDS_PARAM_

#include <CGAL/boost/graph/properties_Polyhedron_3.h>

#endif // CGAL_BOOST_GRAPH_GRAPH_TRAITS_POLYHEDRON_3_H