/usr/include/CGAL/boost/graph/Dual.h is in libcgal-dev 4.7-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | // Copyright (c) 2015 GeometryFactory (France). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Andreas Fabri
#ifndef CGAL_BGL_DUAL_H
#define CGAL_BGL_DUAL_H
#include <CGAL/boost/graph/properties.h>
#include <boost/range/distance.hpp>
namespace CGAL {
template <typename Primal_>
class Dual
{
const Primal_& primal_;
public:
typedef Primal_ Primal;
Dual(const Primal& primal)
: primal_(primal)
{}
const Primal& primal() const
{
return primal_;
}
};
} // namespace CGAL
namespace boost {
template <typename Primal>
class graph_traits<CGAL::Dual<Primal> >
{
typedef boost::graph_traits<Primal> GTP;
struct Dual_traversal_category : public virtual boost::bidirectional_graph_tag,
public virtual boost::vertex_list_graph_tag,
public virtual boost::edge_list_graph_tag
{};
public:
typedef typename GTP::face_descriptor vertex_descriptor;
typedef typename GTP::vertex_descriptor face_descriptor;
typedef typename GTP::halfedge_descriptor halfedge_descriptor;
typedef typename GTP::edge_descriptor edge_descriptor;
typedef typename GTP::directed_category directed_category;
typedef boost::allow_parallel_edge_tag edge_parallel_category;
typedef Dual_traversal_category traversal_category;
typedef typename GTP::faces_size_type vertices_size_type;
typedef typename GTP::vertices_size_type faces_size_type;
typedef typename GTP::edges_size_type edges_size_type;
typedef typename GTP::halfedges_size_type halfedges_size_type;
typedef typename GTP::degree_size_type degree_size_type;
typedef typename GTP::face_iterator vertex_iterator;
typedef typename GTP::vertex_iterator face_iterator;
typedef typename GTP::halfedge_iterator halfedge_iterator;
typedef typename GTP::edge_iterator edge_iterator;
typedef CGAL::Halfedge_around_face_iterator<Primal> in_edge_iterator;
typedef CGAL::Opposite_edge_around_face_iterator<Primal> out_edge_iterator;
static vertex_descriptor null_vertex() { return vertex_descriptor(); }
static face_descriptor null_face() { return face_descriptor(); }
static halfedge_descriptor null_halfedge() { return halfedge_descriptor(); }
};
template<typename P>
struct graph_traits< const CGAL::Dual<P> >
: public graph_traits< CGAL::Dual<P> >
{};
namespace internal{
template <class G>
struct Dual_vertex_index_pmap{
typedef typename boost::property_map<G, boost::face_index_t>::type Property_map;
Property_map m_pmap;
typedef typename boost::graph_traits<G>::face_descriptor key_type;
typedef typename Property_map::value_type value_type;
typedef typename Property_map::reference reference;
typedef typename Property_map::category category;
Dual_vertex_index_pmap(const G& g)
: m_pmap( get(boost::face_index, g) )
{}
friend reference get(const Dual_vertex_index_pmap<G>& pmap, key_type fd) {
return get(pmap.m_pmap, fd);
}
};
template <class G>
struct Dual_face_index_pmap{
typedef typename boost::property_map<G, boost::vertex_index_t>::type Property_map;
Property_map m_pmap;
typedef typename boost::graph_traits<G>::vertex_descriptor key_type;
typedef typename Property_map::value_type value_type;
typedef typename Property_map::reference reference;
typedef typename Property_map::category category;
Dual_face_index_pmap(const G& g)
: m_pmap( get(boost::vertex_index, g) )
{}
friend reference get(const Dual_face_index_pmap<G>& pmap, key_type vd) {
return get(pmap.m_pmap, vd);
}
};
} //end of namespace internal
template <typename P>
struct property_map<CGAL::Dual<P>, boost::vertex_index_t>
{
typedef internal::Dual_vertex_index_pmap<P> type;
typedef internal::Dual_vertex_index_pmap<P> const_type;
};
template <typename P>
struct property_map<CGAL::Dual<P>, boost::face_index_t>
{
typedef internal::Dual_face_index_pmap<P> type;
typedef internal::Dual_face_index_pmap<P> const_type;
};
} // namespace boost
namespace CGAL {
template <typename P>
typename boost::internal::Dual_vertex_index_pmap<P>
get(boost::vertex_index_t, const Dual<P>& dual)
{
return typename boost::internal::Dual_vertex_index_pmap<P>(dual.primal());
}
template <typename P>
typename boost::internal::Dual_face_index_pmap<P>
get(boost::face_index_t, const Dual<P>& dual)
{
return typename boost::internal::Dual_face_index_pmap<P>(dual.primal());
}
template <typename P>
typename boost::graph_traits<CGAL::Dual<P> >::vertices_size_type
num_vertices(const CGAL::Dual<P>& dual)
{
return num_faces(dual.primal());
}
template <typename P>
Iterator_range<typename boost::graph_traits<Dual<P> >::vertex_iterator>
vertices(const CGAL::Dual<P>& dual)
{
return faces(dual.primal());
}
template <typename P>
Iterator_range<typename boost::graph_traits<Dual<P> >::halfedge_iterator>
halfedges(const CGAL::Dual<P>& dual)
{
return halfedges(dual.primal());
}
template <typename P>
Iterator_range<typename boost::graph_traits<Dual<P> >::edge_iterator>
edges(const CGAL::Dual<P>& dual)
{
return edges(dual.primal());
}
template <typename P>
typename boost::graph_traits<Dual<P> >::vertex_descriptor
source(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return face(opposite(h,primal),primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::vertex_descriptor
target(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return face(h,primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::vertex_descriptor
source(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return face(opposite(halfedge(h,primal),primal),primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::vertex_descriptor
target(typename boost::graph_traits<Dual<P> >::edge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return face(halfedge(h,primal),primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
halfedge(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
const Dual<P>& dual)
{
return halfedge(v, dual.primal());
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
halfedge(typename boost::graph_traits<Dual<P> >::face_descriptor f,
const Dual<P>& dual)
{
return halfedge(f, dual.primal());
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
halfedge(typename boost::graph_traits<Dual<P> >::edge_descriptor e,
const Dual<P>& dual)
{
return halfedge(e, dual.primal());
}
template <typename P>
typename boost::graph_traits<Dual<P> >::face_descriptor
face(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return target(h,primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
opposite(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
return opposite(h, dual.primal());
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
next(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return opposite(prev(h,primal),primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::halfedge_descriptor
prev(typename boost::graph_traits<Dual<P> >::halfedge_descriptor h,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return next(opposite(h,primal),primal);
}
template <typename P>
Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
out_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return opposite_edges_around_face(halfedge(v,primal),primal);
}
template <typename P>
Iterator_range<typename boost::graph_traits<Dual<P> >::out_edge_iterator>
in_edges(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return halfedges_around_face(halfedge(v,primal),primal);
}
template <typename P>
typename boost::graph_traits<Dual<P> >::degree_size_type
out_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
const Dual<P>& dual)
{
const typename Dual<P>::Primal& primal = dual.primal();
return boost::distance(halfedges_around_face(halfedge(v,primal),primal));
}
template <typename P>
typename boost::graph_traits<Dual<P> >::degree_size_type
in_degree(typename boost::graph_traits<Dual<P> >::vertex_descriptor v,
const Dual<P>& dual)
{
return out_degree(v,dual);
}
} // namespace CGAL
#endif
|