Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
include/CGAL/Halfedge_data_structure_using_vector.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // ======================================================================
24 //
25 // Copyright (c) 1997 The CGAL Consortium
26 
27 // This software and related documentation is part of the Computational
28 // Geometry Algorithms Library (CGAL).
29 // This software and documentation is provided "as-is" and without warranty
30 // of any kind. In no event shall the CGAL Consortium be liable for any
31 // damage of any kind.
32 //
33 // Every use of CGAL requires a license.
34 //
35 // Academic research and teaching license
36 // - For academic research and teaching purposes, permission to use and copy
37 // the software and its documentation is hereby granted free of charge,
38 // provided that it is not a component of a commercial product, and this
39 // notice appears in all copies of the software and related documentation.
40 //
41 // Commercial licenses
42 // - A commercial license is available through Algorithmic Solutions, who also
43 // markets LEDA (http://www.algorithmic-solutions.de).
44 // - Commercial users may apply for an evaluation license by writing to
45 // Algorithmic Solutions (contact@algorithmic-solutions.com).
46 //
47 // The CGAL Consortium consists of Utrecht University (The Netherlands),
48 // ETH Zurich (Switzerland), Free University of Berlin (Germany),
49 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
50 // (Germany), Max-Planck-Institute Saarbrucken (Germany), RISC Linz (Austria),
51 // and Tel-Aviv University (Israel).
52 //
53 // ----------------------------------------------------------------------
54 //
55 // release : CGAL-2.2
56 // release_date : 2000, September 30
57 //
58 // file : include/CGAL/Halfedge_data_structure_using_vector.h
59 // package : Halfedge_DS (2.8)
60 // chapter : $CGAL_Chapter: Halfedge Data Structures $
61 // source : hds.fw
62 // revision : $Revision: 1.3 $
63 // revision_date : $Date: 2008/12/06 08:43:26 $
64 // author(s) : Lutz Kettner
65 //
66 // coordinator : MPI Saarbruecken (Stefan Schirra)
67 //
68 // Halfedge Data Structure Using a Vector Implementation.
69 // email : contact@cgal.org
70 // www : http://www.cgal.org
71 //
72 // ======================================================================
73 
74 #ifndef CGAL_HALFEDGE_DATA_STRUCTURE_USING_VECTOR_H
75 #define CGAL_HALFEDGE_DATA_STRUCTURE_USING_VECTOR_H 1
76 #ifndef CGAL_BASIC_H
77 #include <CGAL/basic.h>
78 #endif // CGAL_BASIC_H
79 #ifndef CGAL_PROTECT_CSTDDEF
80 #include <cstddef>
81 #define CGAL_PROTECT_CSTDDEF
82 #endif
83 #ifndef CGAL_PROTECT_ALGORITHM
84 #include <algorithm>
85 #define CGAL_PROTECT_ALGORITHM
86 #endif
87 #ifndef CGAL_PROTECT_VECTOR
88 #include <vector>
89 #define CGAL_PROTECT_VECTOR
90 #endif
91 #ifndef CGAL_CIRCULATOR_H
92 #include <CGAL/circulator.h>
93 #endif
94 #ifndef CGAL_N_STEP_ADAPTOR_H
95 #include <CGAL/N_step_adaptor.h>
96 #endif
97 
98 #ifndef CGAL_HALFEDGE_DATA_STRUCTURE_DECORATOR_H
100 #endif
101 
102 // Define shorter names to please linker (g++/egcs)
103 #define _HDS_vector_vertex _Hvv
104 #define _HDS_vector_halfedge _Hvh
105 #define _HDS_vector_facet _Hvf
106 
108 
109 
110 template <class V, class H, class F> class _HDS_vector_vertex;
111 template <class V, class H, class F> class _HDS_vector_halfedge;
112 template <class V, class H, class F> class _HDS_vector_facet;
113 
114 template <class V, class H, class F>
115 class _HDS_vector_vertex : public V {
116 public:
117  typedef V Base;
121 
122  // Point needed for Vertex constructor for efficiency reasons.
123  typedef typename V::Point Point;
124 
126  _HDS_vector_vertex( const Point& p) : V(p) {}
127 
128  Halfedge* halfedge() {return (Halfedge*)(V::halfedge());}
129  const Halfedge* halfedge() const {return (const Halfedge*)(V::halfedge());}
130  void set_halfedge( Halfedge* h) { V::set_halfedge(h);}
131 };
132 
133 template <class V, class H, class F>
134 class _HDS_vector_halfedge : public H {
135 public:
136  typedef H Base;
140 
141  typedef typename H::Supports_halfedge_prev Supports_halfedge_prev;
142  typedef typename H::Supports_halfedge_vertex Supports_halfedge_vertex;
143  typedef typename H::Supports_halfedge_facet Supports_halfedge_facet;
144 
146  Halfedge* next() {return (Halfedge*)(H::next());}
147  Halfedge* prev() {return (Halfedge*)(H::prev());}
148  Vertex* vertex() {return (Vertex*)(H::vertex());}
149  Facet* facet() {return (Facet*)(H::facet());}
150 
151  const Halfedge* opposite() const {return (const Halfedge*)(H::opposite());}
152  const Halfedge* next() const {return (const Halfedge*)(H::next());}
153  const Halfedge* prev() const {return (const Halfedge*)(H::prev());}
154  const Vertex* vertex() const {return (const Vertex*)(H::vertex());}
155  const Facet* facet() const {return (const Facet*)(H::facet());}
156 
157  void set_next( Halfedge* h) { H::set_next(h);}
158  void set_prev( Halfedge* h) { H::set_prev(h);}
159  void set_vertex( Vertex* ve) { H::set_vertex(ve);}
160  void set_facet( Facet* facet) { H::set_facet(facet);}
161 
162 private:
163  void set_opposite( void* h) { H::set_opposite(h);}
164 };
165 
166 
167 template <class V, class H, class F>
168 class _HDS_vector_facet : public F {
169 public:
170  typedef F Base;
174 
175  Halfedge* halfedge() {return (Halfedge*)(F::halfedge());}
176  const Halfedge* halfedge() const {return (const Halfedge*)(F::halfedge());}
177  void set_halfedge( Halfedge* h) { F::set_halfedge(h);}
178 };
179 
180 
181 // A Halfedge Data Structure Using Vectors
182 // -------------------------------------------
183 //
184 // DEFINITION
185 //
186 // The class Halfedge_data_structure_using_vector<Vertex,Halfedge,Facet>
187 // is a halfedge data structure parameterized with vertex, halfedge,
188 // and facet types. The base classes defined in the previous subsection
189 // could be used therefore. It is sufficient for the parameter classes to
190 // implement the pointers as `void*'. They do not have to know the types
191 // of their relatives.
192 
193 template < class V, class H, class F>
195 public:
200 
201  // Point needed for Vertex constructor for efficiency reasons.
202  typedef typename Vertex::Point Point;
203  typedef typename Facet::Normal Normal;
204  typedef typename Facet::Plane Plane;
205 
206 protected:
207  // Three vectors for the elements.
208  typedef std::vector<Vertex> Vertex_vector;
209  typedef std::vector<Halfedge> Halfedge_vector;
210  typedef std::vector<Facet> Facet_vector;
211 public:
212  typedef typename Halfedge_vector::size_type Size;
213  // typedef typename Halfedge_vector::size_type size_type;
214  typedef typename Halfedge_vector::difference_type
216 
217  typedef typename Vertex::Supports_vertex_halfedge Supports_vertex_halfedge;
219  typedef typename Halfedge::Supports_halfedge_vertex
221  typedef typename Halfedge::Supports_halfedge_facet
223  typedef typename Facet::Supports_facet_halfedge Supports_facet_halfedge;
224 
225  typedef typename Vertex::Supports_vertex_point Supports_vertex_point;
226  typedef typename Facet::Supports_facet_plane Supports_facet_plane;
227  typedef typename Facet::Supports_facet_normal Supports_facet_normal;
228 
230  typedef std::random_access_iterator_tag iterator_category;
231 
232  typedef typename Vertex_vector::iterator Vertex_iterator;
233  typedef typename Halfedge_vector::iterator Halfedge_iterator;
234  typedef typename Facet_vector::iterator Facet_iterator;
236  2,
237  Halfedge&,
238  Halfedge*,
239  Halfedge,
240  std::ptrdiff_t,
242 
243  typedef typename Vertex_vector::const_iterator Vertex_const_iterator;
244  typedef typename Halfedge_vector::const_iterator Halfedge_const_iterator;
245  typedef typename Facet_vector::const_iterator Facet_const_iterator;
247  2,
248  const Halfedge&,
249  const Halfedge*,
250  Halfedge,
251  std::ptrdiff_t,
253 
254 protected :
261 
262 // CREATION
263 
264 private:
267  Facet_const_iterator f_old);
268  // Update own pointers assuming that they lived previously
269  // in a halfedge data structure with vector starting addresses
270  // as given as parameters v_old, h_old, f_old.
271 
272 public:
276  // the empty polyhedron `P'.
277 
281  // a polyhedron `P' with storage reserved for v vertices, h
282  // halfedges, and f facets. The reservation sizes are a hint for
283  // optimizing storage allocation. They are not used here.
284  vertices.reserve(v);
285  halfedges.reserve(h);
286  facets.reserve(f);
287  }
288 
289  void reserve( Size v, Size h, Size f) {
290  // reserve storage for v vertices, h halfedges, and f facets. The
291  // reservation sizes are a hint for optimizing storage allocation.
292  // If the `capacity' is already greater than the requested size
293  // nothing happens. If the `capacity' changes all iterators and
294  // circulators invalidates. Function is void here.
295  Vertex_iterator v_old = vertices.begin();
296  Halfedge_iterator h_old = halfedges.begin();
297  Facet_iterator f_old = facets.begin();
299  vertices.reserve(v);
300  halfedges.reserve(h);
302  facets.reserve(f);
303  pointer_update( v_old, h_old, f_old);
304  }
305 
307  : vertices( hds.vertices),
308  halfedges( hds.halfedges),
309  facets( hds.facets),
313  {
314  pointer_update( hds.vertices.begin(),
315  hds.halfedges.begin(),
316  hds.facets.begin());
317  }
318 
319  Self& operator=( const Self& hds) {
320  if ( this != &hds) {
321  delete_all();
322  vertices = hds.vertices;
323  halfedges = hds.halfedges;
324  facets = hds.facets;
328  pointer_update( hds.vertices.begin(),
329  hds.halfedges.begin(),
330  hds.facets.begin());
331  }
332  return *this;
333  }
334 
335 
336 // Access Member Functions
337 
338  Size size_of_vertices() const { return vertices.size();}
339  Size size_of_halfedges() const { return halfedges.size();}
340  // number of all halfedges (including border halfedges).
341  Size size_of_facets() const { return facets.size();}
342 
343  Size capacity_of_vertices() const { return vertices.capacity();}
344  Size capacity_of_halfedges() const { return halfedges.capacity();}
345  Size capacity_of_facets() const { return facets.capacity();}
346 
347  std::size_t bytes() const {
348  return sizeof(Self)
349  + vertices.size() * sizeof( Vertex)
350  + halfedges.size() * sizeof( Halfedge)
351  + facets.size() * sizeof( Facet);
352  }
353  std::size_t bytes_reserved() const {
354  return sizeof(Self)
355  + vertices.capacity() * sizeof( Vertex)
356  + halfedges.capacity() * sizeof( Halfedge)
357  + facets.capacity() * sizeof( Facet);
358  }
359 
364  Facet_iterator facets_begin() { return facets.begin();}
365  Facet_iterator facets_end() { return facets.end();}
366 
368  // iterator over all edges. The iterator refers to halfedges, but
369  // enumerates only one of the two corresponding opposite
370  // halfedges.
371 
373  // end of the range over all edges.
374 
375  // The constant iterators and circulators.
376 
381  Facet_const_iterator facets_begin() const{ return facets.begin();}
382  Facet_const_iterator facets_end() const{ return facets.end();}
383 
386  }
389  }
390 
391 // Insertion
392 //
393 // The following operations simply allocate a new element of that type.
394 // Halfedges are always allocated in pairs of opposite halfedges. The
395 // opposite pointers are automatically set.
396 
398  CGAL_assertion( vertices.size() < vertices.capacity());
399  vertices.push_back( Vertex());
400  return & (vertices.back());
401  }
402 
403  Vertex* new_vertex( const Vertex* v) {
404  CGAL_assertion( vertices.size() < vertices.capacity());
405  vertices.push_back( *v);
406  return & (vertices.back());
407  }
408 
409  Vertex* new_vertex( const Point& p) {
410  CGAL_assertion( vertices.size() < vertices.capacity());
411  vertices.push_back( Vertex(p));
412  return & (vertices.back());
413  }
414 
416  CGAL_assertion( halfedges.size() + 1 < halfedges.capacity());
417  // creates a new pair of opposite border halfedges.
418  halfedges.push_back( Halfedge());
419  Halfedge* h = & (halfedges.back());
420  halfedges.push_back( Halfedge());
421  Halfedge* g = & (halfedges.back());
422  CGAL_assertion( h + 1 == g);
423  CGAL_assertion( (char*)g - (char*)h == sizeof( Halfedge));
424  h->H::set_opposite(g);
425  g->H::set_opposite(h);
426  return h;
427  }
428 
429  Halfedge* new_edge( const Halfedge* he) {
430  CGAL_assertion( halfedges.size() + 1 < halfedges.capacity());
431  // creates a new pair of opposite border halfedges.
432  halfedges.push_back( *he);
433  Halfedge* h = & (halfedges.back());
434  halfedges.push_back( *(he->opposite()));
435  Halfedge* g = & (halfedges.back());
436  h->H::set_opposite(g);
437  g->H::set_opposite(h);
438  return h;
439  }
440 
442  CGAL_assertion( facets.size() < facets.capacity());
443  facets.push_back( Facet());
444  return & (facets.back());
445  }
446 
447  Facet* new_facet( const Facet* f) {
448  facets.push_back( *f);
449  return & (facets.back());
450  }
451 
452 // Removal
453 //
454 // The following operations erase an element referenced by a pointer.
455 // Halfedges are always deallocated in pairs of opposite halfedges. Erase
456 // of single elements is optional. The deletion of all is mandatory.
457 
458  void delete_all() {
459  vertices.erase( vertices.begin(), vertices.end());
460  halfedges.erase( halfedges.begin(), halfedges.end());
461  facets.erase( facets.begin(), facets.end());
463  nb_border_edges = 0;
465  }
466 
467  void vertex_pop_back() { vertices.pop_back(); }
468 
469  void edge_pop_back() {
470  halfedges.pop_back();
471  halfedges.pop_back();
472  }
473 
474  void facet_pop_back() { facets.pop_back(); }
475 
476 // Special Operations on Polyhedral Surfaces
477 protected:
479  Halfedge_iterator g = h + 1;
480  h->H::set_opposite( &*g);
481  g->H::set_opposite( &*h);
482  }
485  }
486 
488  const std::vector<Halfedge_iterator>&,Tag_false){}
490  const std::vector<Halfedge_iterator>& inv, Tag_true){
491  h->set_prev( &*(inv[ Halfedge_iterator(h->prev()) - base]));
492  }
497  h->vertex()->set_halfedge(&*h);
498  }
503  h->facet()->set_halfedge(&*h);
504  }
505 
506 public:
507 // Operations with Border Halfedges
508 
510  // number of border halfedges. An edge with no incident facet
511  // counts as two border halfedges. Precondition: `normalize_border()'
512  // has been called and no halfedge insertion or removal and no
513  // change in border status of the halfedges have occured since
514  // then.
515 
517  // number of border edges. If `size_of_border_edges() ==
518  // size_of_border_halfedges()' all border edges are incident to a
519  // facet on one side and to a hole on the other side.
520  // Precondition: `normalize_border()' has been called and no
521  // halfedge insertion or removal and no change in border status of
522  // the halfedges have occured since then.
523 
525  // halfedge iterator starting with the border edges. The range [
526  // `halfedges_begin(), border_halfedges_begin()') denotes all
527  // non-border edges. The range [`border_halfedges_begin(),
528  // halfedges_end()') denotes all border edges. Precondition:
529  // `normalize_border()' has been called and no halfedge insertion
530  // or removal and no change in border status of the halfedges have
531  // occured since then.
533  }
534 
536  // ... trial to make Edge_iterator obsolete.
538  }
539 
541  // CGAL_assertion( border_halfedges);
542  // return Halfedge_const_iterator( border_halfedges);
543  return // static_cast -- MSVC identity loss... DVP
544  Halfedge_const_iterator(static_cast<Halfedge_iterator>
545  (border_halfedges));
546  }
547 
550  }
551 
552  void normalize_border();
553  // sorts halfedges such that the non-border edges precedes the
554  // border edges. For each border edge that is incident to a facet
555  // the halfedge iterator will reference the halfedge incident to
556  // the facet right before the halfedge incident to the hole.
557 };
558 
559 #define CGAL_V_UPDATE(v) (&*(v_new + (Vertex_const_iterator(v) - v_old)))
560 #define CGAL_H_UPDATE(h) (&*(h_new + (Halfedge_const_iterator(h) - h_old)))
561 #define CGAL_H_UPDATE_I(h) (h_new + (Halfedge_const_iterator(h) - h_old))
562 #define CGAL_F_UPDATE(f) (&*(f_new + (Facet_const_iterator(f) - f_old)))
563 
564 template < class V, class H, class F>
565 void
567 pointer_update( Vertex_const_iterator v_old,
568  Halfedge_const_iterator h_old,
569  Facet_const_iterator f_old) {
570  // Update own pointers assuming that they lived previously
571  // in a halfedge data structure with vector starting addresses
572  // as given as parameters v_old, h_old, f_old.
574  Vertex_iterator v_new = vertices.begin();
575  Halfedge_iterator h_new = halfedges.begin();
576  Facet_iterator f_new = facets.begin();
577  for ( Halfedge_iterator h = halfedges.begin(); h != halfedges.end(); ++h) {
578  h->set_next( CGAL_H_UPDATE( h->next()));
579  h->H::set_opposite( CGAL_H_UPDATE( h->opposite()));
580  D.set_prev( &*h, CGAL_H_UPDATE( D.get_prev( &*h)));
581  D.set_vertex( &*h, CGAL_V_UPDATE( D.get_vertex( &*h)));
582  D.set_vertex_halfedge( &*h);
583  D.set_facet( &*h, CGAL_F_UPDATE( D.get_facet( &*h)));
584  if ( ! h->is_border())
585  D.set_facet_halfedge( &*h);
586  }
587  border_halfedges = CGAL_H_UPDATE_I( border_halfedges);
588 }
589 #undef CGAL_V_UPDATE
590 #undef CGAL_H_UPDATE
591 #undef CGAL_H_UPDATE_I
592 #undef CGAL_F_UPDATE
593 
594 template < class V, class H, class F>
595 void
597  nb_border_halfedges = 0;
598  nb_border_edges = 0;
599  border_halfedges = halfedges_end();
600  // Lets run one partition step over the array of halfedges.
601  // First find a pivot -- that means a border edge.
602  Edge_iterator ll = edges_begin();
603  while ( ll != edges_end() && (! (*ll).is_border()) &&
604  (!(*ll).opposite()->is_border() ))
605  ++ll;
606  if ( ll == edges_end())
607  // Done. No border edges found.
608  return;
609 
610  // An array of pointers to update the changed halfedge pointers.
611  typedef std::vector<Halfedge_iterator> HVector;
612  HVector hvector;
613  hvector.reserve( halfedges.size());
614  // Initialize it.
615  for ( Halfedge_iterator i = halfedges_begin(); i!=halfedges_end();++i){
616  hvector.push_back( i);
617  }
618  CGAL_assertion( hvector.size() == halfedges.size());
619  typename HVector::iterator llhv = hvector.begin()+2*(ll-edges_begin());
620  // Start with the partitioning.
621  Edge_iterator rr = edges_end();
622  --rr;
623  typename HVector::iterator rrhv = hvector.end();
624  --rrhv;
625  --rrhv;
626  // Pivot is in *ll
627  // Elements in [rr+1..end) >= pivot (border)
628  // Elements in [begin..ll) < pivot (non border)
629  while (ll < rr) {
630  // Pivot is in *ll, ll <= rr.
631  while ( rr > ll && ((*rr).is_border() ||
632  (*rr).opposite()->is_border())) {
633  if ( ! (*rr).opposite()->is_border()) {
634  std::swap( *rr, *((*rr).opposite()));
635  update_opposite( rr);
636  std::swap( *rrhv, *(rrhv+1));
637  }
638  --rr;
639  --rrhv;
640  --rrhv;
641  }
642  // Elements in [rr+1..end) >= pivot (border)
643  // *rr <= pivot, ll <= rr.
644  std::swap( *((*ll).opposite()), *((*rr).opposite()));
645  std::swap( *ll, *rr);
646  update_opposite( ll);
647  update_opposite( rr);
648  std::swap( *(llhv+1), *(rrhv+1));
649  std::swap( *llhv, *rrhv);
650  // Elements in [begin..ll) < pivot
651  // Pivot is in *rr, ll <= rr.
652  while ( !(*ll).is_border() && !(*ll).opposite()->is_border()) {
653  ++ll;
654  ++llhv;
655  ++llhv;
656  }
657  // Elements in [begin..ll) < pivot
658  // *ll >= pivot
659  // ll <= rr (since *rr is pivot.)
660  CGAL_assertion( ll <= rr);
661  CGAL_assertion( llhv <= rrhv);
662  std::swap( *((*ll).opposite()), *((*rr).opposite()));
663  std::swap( *ll, *rr);
664  update_opposite( ll);
665  update_opposite( rr);
666  std::swap( *(llhv+1), *(rrhv+1));
667  std::swap( *llhv, *rrhv);
668  if ( ! (*rr).opposite()->is_border()) {
669  std::swap( *rr, *((*rr).opposite()));
670  update_opposite( rr);
671  std::swap( *rrhv, *(rrhv+1));
672  }
673  --rr;
674  --rrhv;
675  --rrhv;
676  // Elements in [rr+1..end) >= pivot
677  // Pivot is in *ll
678  }
679  CGAL_assertion( llhv >= rrhv);
680  // rr + 1 >= ll >= rr
681  // Elements in [rr+1..end) >= pivot
682  // Elemente in [begin..ll) < pivot
683  // Pivot is in a[ll]
684  if ( ll == rr) {
685  // Check for the possibly missed swap.
686  if ( (*rr).is_border() && ! ((*rr).opposite()->is_border())) {
687  std::swap( *rr, *((*rr).opposite()));
688  update_opposite( rr);
689  std::swap( *rrhv, *(rrhv+1));
690  }
691  }
692  CGAL_assertion( (*ll).opposite()->is_border());
693  CGAL_assertion( ll == edges_begin() || ! (*(ll-1)).is_border());
694  CGAL_assertion( ll == edges_begin() ||
695  ! (*(ll-1)).opposite()->is_border());
696  border_halfedges = Halfedge_iterator( &*ll);
697  nb_border_edges = (edges_end() - ll);
698  nb_border_halfedges = 0;
699 
700  HVector inv_vector( halfedges.size());
701  // Initialize inverse index.
702  for ( typename HVector::iterator k = hvector.begin();
703  k != hvector.end(); ++k){
704  inv_vector[*k - halfedges_begin()] =
705  halfedges_begin() + (k - hvector.begin());
706  }
707 
708  // Update halfedge pointers.
709  for (Halfedge_iterator h =halfedges_begin(); h != halfedges_end();++h){
710  (*h).set_next( &* (inv_vector[ (*h).next() - &(halfedges.front())]));
711  update_prev( h, halfedges.begin(), inv_vector,
712  Supports_halfedge_prev());
713  update_vertex( h, Supports_halfedge_vertex(),
714  Supports_vertex_halfedge());
715  if ( (*h).is_border())
716  nb_border_halfedges++;
717  else
718  update_facet( h, Supports_halfedge_facet(),
719  Supports_facet_halfedge());
720  }
721 }
722 
724 
725 // Undef shorter names (g++/egcs)
726 //#undef _HDS_vector_vertex
727 //#undef _HDS_vector_halfedge
728 //#undef _HDS_vector_facet
729 #endif // CGAL_HALFEDGE_DATA_STRUCTURE_USING_VECTOR_H //
730 // EOF //
731 
732 
733 
734 
735 
736 
void swap(int &a, int &b)
Definition: buildface.cpp:88
#define CGAL_assertion(EX)
Definition: assertions.h:87
void update_vertex(Halfedge_iterator h, Tag_true, Tag_true)
N_step_adaptor< Halfedge_iterator, 2, Halfedge &, Halfedge *, Halfedge, std::ptrdiff_t, iterator_category > Edge_iterator
void update_facet(Halfedge_iterator, Tag_false, Tag_false)
j indices k indices k
Definition: Indexing.h:6
Definition: face.cpp:178
void update_facet(Halfedge_iterator h, Tag_true, Tag_true)
void set_facet_halfedge(Facet *f, Halfedge *g) const
void update_vertex(Halfedge_iterator, Tag_false, Tag_false)
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
N_step_adaptor< Halfedge_const_iterator, 2, const Halfedge &, const Halfedge *, Halfedge, std::ptrdiff_t, iterator_category > Edge_const_iterator
bool check_tag(Tag_true)
void pointer_update(Vertex_const_iterator v_old, Halfedge_const_iterator h_old, Facet_const_iterator f_old)
blockLoc i
Definition: read.cpp:79
void update_prev(Halfedge_iterator, Halfedge_iterator, const std::vector< Halfedge_iterator > &, Tag_false)
void set_facet(Halfedge *h, Facet *f) const
CGAL_BEGIN_NAMESPACE T opposite(const T &t)
void inv(Matrix3D &Ainv, const Matrix3D &A)
void set_vertex_halfedge(Vertex *v, Halfedge *g) const
#define CGAL_BEGIN_NAMESPACE
Definition: kdtree_d.h:86
void set_vertex(Halfedge *h, Vertex *v) const
void set_prev(Halfedge *h, Halfedge *g) const
#define CGAL_END_NAMESPACE
Definition: kdtree_d.h:87
void update_prev(Halfedge_iterator h, Halfedge_iterator base, const std::vector< Halfedge_iterator > &inv, Tag_true)