~ubuntu-branches/debian/stretch/cgal/stretch

« back to all changes in this revision

Viewing changes to include/CGAL/Combinatorial_map_operations.h

  • Committer: Package Import Robot
  • Author(s): Joachim Reichel
  • Date: 2014-04-05 10:56:43 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140405105643-jgnrpu2thtx23zfs
Tags: 4.4-1
* New upstream release.
* Remove patches do-not-link-example-with-qt4-support-library.patch and
  fix_jet_fitting_3.patch (applied upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
48
48
            res && it.cont(); ++it )
49
49
      {
50
 
        if (it->template beta<i+2>()->template beta<i+1>()!=
51
 
            it->template beta_inv<i+1>()->template beta<i+2>() )
 
50
        if ( amap.template beta<i+2,i+1>(it)!=
 
51
             amap.template beta<CGAL_BETAINV(i+1),i+2>(it) )
52
52
          res = false;
53
53
      }
54
54
      return res;
95
95
      size_t res = 0;
96
96
 
97
97
      typename CMap::Dart_handle d1, d2;
98
 
      typename CMap::Dart_handle dg1=NULL, dg2=NULL;
 
98
      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
99
99
 
100
100
      int mark = amap.get_new_mark();
101
101
      int mark_modified_darts = amap.get_new_mark();
109
109
            it.cont(); ++it )
110
110
      {
111
111
        to_erase.push_back(it);
112
 
        if ( !it->template is_free<i+1>() && dg1==NULL )
113
 
        { dg1=it; dg2=it->template beta<i+1>(); }
 
112
        if ( !amap.template is_free<i+1>(it) && dg1==amap.null_handle )
 
113
        { dg1=it; dg2=amap.template beta<i+1>(it); }
114
114
        amap.mark(it, mark);
115
115
        ++res;
116
116
      }
117
117
 
118
118
      // We group the two (i+1)-cells incident if they exist.
119
 
      if ( dg1!=NULL )
 
119
      if ( dg1!=amap.null_handle )
120
120
        CGAL::internal::Group_attribute_functor_run<CMap, i+1>::
121
121
            run(&amap, dg1, dg2);
122
122
 
137
137
          to_erase.begin();
138
138
      for ( ; it!=to_erase.end(); ++it )
139
139
      {
140
 
        d1=(*it)->template beta<iinv>();
141
 
        while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
 
140
        d1=amap.template beta<iinv>(*it);
 
141
        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
142
142
        {
143
 
          d1=d1->template beta<i+1>()->template beta<iinv>();
144
 
          if ( d1==(*it)->template beta<iinv>() ) d1=CMap::null_dart_handle;
 
143
          d1=amap.template beta<i+1, iinv>(d1);
 
144
          if ( d1==amap. template beta<iinv>(*it) ) d1=amap.null_dart_handle;
145
145
        }
146
146
 
147
147
        if ( !amap.is_marked(d1, mark_modified_darts) )
148
148
        {
149
 
          d2=(*it)->template beta<i+1>()->template beta<i>();
150
 
          while ( d2!=CMap::null_dart_handle && amap.is_marked(d2, mark) )
 
149
          d2=amap.template beta<i+1,i>(*it);
 
150
          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
151
151
          {
152
 
            d2=d2->template beta<i+1>()->template beta<i>();
153
 
            if ( d2==(*it)->template beta<i+1>()->template beta<i>() )
154
 
              d2=CMap::null_dart_handle;
 
152
            d2=amap.template beta<i+1,i>(d2);
 
153
            if ( d2==amap.template beta<i+1,i>(*it) )
 
154
              d2=amap.null_dart_handle;
155
155
          }
156
156
 
157
157
          if ( !amap.is_marked(d2, mark_modified_darts) )
158
158
          {
159
 
            if ( d1!=CMap::null_dart_handle )
 
159
            if ( d1!=amap.null_dart_handle )
160
160
            {
161
 
              if ( d2!=CMap::null_dart_handle && d1!=d2 )
 
161
              if ( d2!=amap.null_dart_handle && d1!=d2 )
162
162
              {
163
163
                //d1->basic_link_beta(d2, i);
164
164
                amap.template basic_link_beta<i>(d1, d2);
176
176
              }
177
177
              else
178
178
              {
179
 
                if ( !d1->template is_free<i>() )
 
179
                if ( !amap.template is_free<i>(d1) )
180
180
                {
181
 
                  d1->template unlink_beta<i>();
 
181
                  amap.template unlink_beta<i>(d1);
182
182
                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
183
183
                  amap.mark(d1, mark_modified_darts);
184
184
                  first_modified_darts.push_back(d1);
185
185
                }
186
186
              }
187
187
            }
188
 
            else if ( d2!=CMap::null_dart_handle )
 
188
            else if ( d2!=amap.null_dart_handle )
189
189
            {
190
 
              if ( !d2->template is_free<iinv>() )
 
190
              if ( !amap.template is_free<iinv>(d2) )
191
191
              {
192
 
                d2->template unlink_beta<iinv>();
 
192
                amap.template unlink_beta<iinv>(d2);
193
193
                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
194
194
                amap.mark(d2, mark_modified_darts);
195
195
                modified_darts.push_back(d2);
197
197
            }
198
198
          }
199
199
        }
200
 
        if ( (*it)->template is_free<i+1>() &&
201
 
             !(*it)->template is_free<i>() )
 
200
        if ( amap.template is_free<i+1>(*it) &&
 
201
             !amap.template is_free<i>(*it) )
202
202
        {
203
 
          d1 = (*it)->template beta<i>();
204
 
          if ( !d1->template is_free<iinv>() )
 
203
          d1 = amap.template beta<i>(*it);
 
204
          if ( !amap.template is_free<iinv>(d1) )
205
205
          {
206
 
            d1->template unlink_beta<iinv>();
 
206
            amap.template unlink_beta<iinv>(d1);
207
207
            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
208
208
            amap.mark(d1, mark_modified_darts);
209
209
            modified_darts.push_back(d1);
270
270
  {
271
271
    static size_t run(CMap& amap, typename CMap::Dart_handle adart)
272
272
    {
273
 
      CGAL_assertion( adart!=NULL );
274
 
 
275
273
      int mark = amap.get_new_mark();
276
274
      std::deque<typename CMap::Dart_handle> to_erase;
277
275
      size_t res = 0;
292
290
        it = to_erase.begin();
293
291
      for ( it = to_erase.begin(); it != to_erase.end(); ++it )
294
292
      {
295
 
        if ( !(*it)->template is_free<CMap::dimension>() &&
296
 
             !amap.is_marked((*it)->template beta<CMap::dimension>(), mark) )
 
293
        if ( !amap.template is_free<CMap::dimension>(*it) &&
 
294
             !amap.is_marked(amap.template beta<CMap::dimension>(*it), mark) )
297
295
        {
298
 
          modified_darts.push_back((*it)->template beta<CMap::dimension>());
 
296
          modified_darts.push_back(amap.template beta<CMap::dimension>(*it));
299
297
          amap.template unlink_beta_for_involution<CMap::dimension>(*it);
300
298
        }
301
299
      }
336
334
      size_t res = 0;
337
335
 
338
336
      typename CMap::Dart_handle d1, d2;
339
 
      typename CMap::Dart_handle dg1=NULL, dg2=NULL;
 
337
      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
340
338
 
341
339
      int mark = amap.get_new_mark();
342
340
//      int mark_modified_darts = amap.get_new_mark();
347
345
            it.cont(); ++it )
348
346
      {
349
347
        to_erase.push_back(it);
350
 
        if ( !it->template is_free<0>() && dg1==NULL )
351
 
        { dg1=it; dg2=it->template beta<0>(); }
 
348
        if ( !amap.template is_free<0>(it) && dg1==amap.null_handle )
 
349
        { dg1=it; dg2=amap.template beta<0>(it); }
352
350
        amap.mark(it, mark);
353
351
        ++res;
354
352
      }
355
353
 
356
354
      // We group the two edges incident if they exist.
357
 
      if ( dg1!=NULL )
 
355
      if ( dg1!=amap.null_handle )
358
356
        CGAL::internal::Group_attribute_functor_run<CMap, 1>::
359
357
            run(&amap, dg1, dg2);
360
358
 
369
367
          to_erase.begin();
370
368
      for ( ; it != to_erase.end(); ++it)
371
369
      {
372
 
        if ( !(*it)->template is_free<0>() )
 
370
        if ( !amap.template is_free<0>(*it) )
373
371
        {
374
 
          if ( !(*it)->template is_free<1>() &&
375
 
               (*it)->template beta<0>()!=(*it) )
 
372
          if ( !amap.template is_free<1>(*it) &&
 
373
               amap.template beta<0>(*it)!=(*it) )
376
374
          {
377
 
            amap.basic_link_beta_1((*it)->template beta<0>(),
378
 
                                   (*it)->template beta<1>());
379
 
            modified_darts.push_back((*it)->template beta<0>());
380
 
            modified_darts2.push_back((*it)->template beta<1>());
 
375
            amap.basic_link_beta_1(amap.template beta<0>(*it),
 
376
                                   amap.template beta<1>(*it));
 
377
            modified_darts.push_back(amap.template beta<0>(*it));
 
378
            modified_darts2.push_back(amap.template beta<1>(*it));
381
379
            // TODO push only one out of two dart ?
382
380
          }
383
381
          else
384
382
          {
385
 
            (*it)->template beta<0>()->template unlink_beta<1>();
386
 
            modified_darts.push_back((*it)->template beta<0>());
 
383
            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
 
384
            modified_darts.push_back(amap.template beta<0>(*it));
387
385
          }
388
386
 
389
387
          for ( unsigned int j=2; j<=CMap::dimension; ++j )
390
388
          {
391
 
            if ( !(*it)->is_free(j) )
 
389
            if ( !amap.is_free(*it,j) )
392
390
            {
393
 
              amap.basic_link_beta((*it)->template beta<0>(),
394
 
                                   (*it)->beta(j), j);
 
391
              amap.basic_link_beta(amap.template beta<0>(*it),
 
392
                                   amap.beta(*it,j), j);
395
393
            //((*it)->beta(0))->basic_link_beta((*it)->beta(j),j);
396
394
            }
397
395
          }
398
396
        }
399
397
        else
400
398
        {
401
 
          if ( !(*it)->template is_free<1>() )
 
399
          if ( !amap.template is_free<1>(*it) )
402
400
          {
403
 
            (*it)->template beta<1>()->template unlink_beta<0>();
404
 
            modified_darts2.push_back((*it)->template beta<1>());
 
401
            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
 
402
            modified_darts2.push_back(amap.template beta<1>(*it));
405
403
          }
406
404
 
407
405
          for ( unsigned int j=2; j<=CMap::dimension; ++j )
408
406
          {
409
 
            if ( !(*it)->is_free(j) )
 
407
            if ( !amap.is_free(*it,j) )
410
408
            { amap.unlink_beta(*it, j); }
411
409
          }
412
410
        }
461
459
      for ( CGAL::CMap_dart_const_iterator_of_cell<CMap,i> it(amap, adart);
462
460
            res && it.cont(); ++it )
463
461
      {
464
 
        if ( it->template beta<i-2>()->template beta<i-1>()!=
465
 
             it->template beta<i-1>()->template beta_inv<i-2>() )
 
462
        if ( amap.template beta<i-2,i-1>(it)!=
 
463
             amap.template beta<i-1,CGAL_BETAINV(i-2)>(it) )
466
464
          res = false;
467
465
      }
468
466
      return res;
509
507
      size_t res = 0;
510
508
 
511
509
      typename CMap::Dart_handle d1, d2;
512
 
      typename CMap::Dart_handle dg1=NULL, dg2=NULL;
 
510
      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
513
511
 
514
512
      int mark = amap.get_new_mark();
515
513
      int mark_modified_darts = amap.get_new_mark();
522
520
            it.cont(); ++it )
523
521
      {
524
522
        to_erase.push_back(it);
525
 
        if ( !it->template is_free<i-1>() && dg1==NULL )
526
 
        { dg1=it; dg2=it->template beta<i-1>(); }
 
523
        if ( !amap.template is_free<i-1>(it) && dg1==amap.null_handle )
 
524
        { dg1=it; dg2=amap.template beta<i-1>(it); }
527
525
        amap.mark(it, mark);
528
526
        ++res;
529
527
      }
530
528
 
531
529
      // We group the two (i+1)-cells incident if they exist.
532
 
      if ( dg1!=NULL )
 
530
      if ( dg1!=amap.null_handle )
533
531
         CGAL::internal::Group_attribute_functor_run<CMap,i-1>::
534
532
             run(&amap, dg1, dg2);
535
533
 
542
540
          to_erase.begin();
543
541
      for ( ; it!=to_erase.end(); ++it )
544
542
      {
545
 
        d1 = (*it)->template beta<i>();
546
 
        while ( d1!=CMap::null_dart_handle && amap.is_marked(d1, mark) )
 
543
        d1 = amap.template beta<i>(*it);
 
544
        while ( d1!=amap.null_dart_handle && amap.is_marked(d1, mark) )
547
545
        {
548
 
          d1 = d1->template beta<imuinv>()->template beta<i>();
549
 
          if (d1 == (*it)->template beta<i>()) d1 = CMap::null_dart_handle;
 
546
          d1 = amap.template beta<imuinv,i>(d1);
 
547
          if (d1 == amap.template beta<i>(*it)) d1 = amap.null_dart_handle;
550
548
        }
551
549
 
552
550
        if ( !amap.is_marked(d1, mark_modified_darts) )
553
551
        {
554
 
          d2 = (*it)->template beta<i-1>()->template beta<i>();
555
 
          while ( d2!=CMap::null_dart_handle && amap.is_marked(d2, mark) )
 
552
          d2 = amap.template beta<i-1,i>(*it);
 
553
          while ( d2!=amap.null_dart_handle && amap.is_marked(d2, mark) )
556
554
          {
557
 
            d2 = d2->template beta<i-1>()->template beta<i>();
558
 
            if ( d2==(*it)->template beta<i-1>()->template beta<i>() )
559
 
              d2=CMap::null_dart_handle;
 
555
            d2 = amap.template beta<i-1,i>(d2);
 
556
            if ( d2==amap.template beta<i-1,i>(*it) )
 
557
              d2=amap.null_dart_handle;
560
558
          }
561
559
 
562
560
          if ( !amap.is_marked(d2, mark_modified_darts) )
563
561
          {
564
 
            if (d1 != CMap::null_dart_handle)
 
562
            if (d1 != amap.null_dart_handle)
565
563
            {
566
 
              if (d2 != CMap::null_dart_handle && d1!=d2 )
 
564
              if (d2 != amap.null_dart_handle && d1!=d2 )
567
565
              {
568
566
                amap.template basic_link_beta_for_involution<i>(d1, d2);
569
567
                amap.mark(d1, mark_modified_darts);
574
572
              }
575
573
              else
576
574
              {
577
 
                if ( !d1->template is_free<i>() )
 
575
                if ( !amap.template is_free<i>(d1) )
578
576
                {
579
 
                  d1->template unlink_beta<i>();
 
577
                  amap.template unlink_beta<i>(d1);
580
578
                  CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
581
579
                  amap.mark(d1, mark_modified_darts);
582
580
                  modified_darts.push_back(d1);
583
581
                }
584
582
              }
585
583
            }
586
 
            else if (d2 != CMap::null_dart_handle)
 
584
            else if (d2 != amap.null_dart_handle)
587
585
            {
588
 
              if ( !d2->is_free(i) )
 
586
              if ( !amap.is_free(d2,i) )
589
587
              {
590
 
                d2->template unlink_beta<i>();
 
588
                amap.template unlink_beta<i>(d2);
591
589
                CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
592
590
                amap.mark(d2, mark_modified_darts);
593
591
                modified_darts.push_back(d2);
595
593
            }
596
594
          }
597
595
        }
598
 
        if ((*it)->is_free(i-1) && !(*it)->is_free(i))
 
596
        if (amap.is_free(*it,i-1) && !amap.is_free(*it,i))
599
597
        {
600
 
          d1 = (*it)->beta(i);
601
 
          if ( !d1->is_free(i) )
 
598
          d1 = amap.beta(*it,i);
 
599
          if ( !amap.is_free(d1,i) )
602
600
          {
603
 
            d1->template unlink_beta<i>();
 
601
            amap.template unlink_beta<i>(d1);
604
602
            CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
605
603
            amap.mark(d1, mark_modified_darts);
606
604
            modified_darts.push_back(d1);
658
656
      size_t res = 0;
659
657
 
660
658
      typename CMap::Dart_handle d1, d2;
661
 
      typename CMap::Dart_handle dg1=NULL, dg2=NULL;
 
659
      typename CMap::Dart_handle dg1=amap.null_handle, dg2=amap.null_handle;
662
660
 
663
661
      int mark = amap.get_new_mark();
664
662
//      int mark_modified_darts = amap.get_new_mark();
669
667
            it.cont(); ++it )
670
668
      {
671
669
        to_erase.push_back(it);
672
 
        if ( dg1==NULL && !it->template is_free<0>() &&
673
 
             !it->template is_free<1>() )
674
 
        { dg1=it->template beta<0>(); dg2=it->template beta<1>(); }
 
670
        if ( dg1==amap.null_handle && !amap.template is_free<0>(it) &&
 
671
             !amap.template is_free<1>(it) )
 
672
        { dg1=amap.template beta<0>(it); dg2=amap.template beta<1>(it); }
675
673
        amap.mark(it, mark);
676
674
        ++res;
677
675
      }
678
676
 
679
677
      // We group the two vertices incident if they exist.
680
 
      if ( dg1!=NULL )
 
678
      if ( dg1!=amap.null_handle )
681
679
        CGAL::internal::Group_attribute_functor_run<CMap, 0, 1>::
682
680
            run(&amap, dg1, dg2);
683
681
 
692
690
        to_erase.begin();
693
691
      for ( ; it!=to_erase.end(); ++it )
694
692
      {
695
 
        if ( !(*it)->template is_free<0>() )
 
693
        if ( !amap.template is_free<0>(*it) )
696
694
        {
697
 
          if ( !(*it)->template is_free<1>() )
 
695
          if ( !amap.template is_free<1>(*it) )
698
696
          {
699
 
            if ( (*it)->template beta<1>()!=*it )
 
697
            if ( amap.template beta<1>(*it)!=*it )
700
698
            {
701
699
               /*modified_darts2.push_back((*it)->template beta<0>());
702
700
              if ( (*it)->beta(0)!=(*it)->beta(1) )*/
703
 
              modified_darts.push_back((*it)->template beta<1>());
704
 
              amap.basic_link_beta_1((*it)->template beta<0>(),
705
 
                                     (*it)->template beta<1>());
 
701
              modified_darts.push_back(amap.template beta<1>(*it));
 
702
              amap.basic_link_beta_1(amap.template beta<0>(*it),
 
703
                                     amap.template beta<1>(*it));
706
704
            }
707
705
          }
708
706
          else
709
707
          {
710
 
            modified_darts2.push_back((*it)->template beta<0>());
711
 
            (*it)->template beta<0>()->template unlink_beta<1>();
 
708
            modified_darts2.push_back(amap.template beta<0>(*it));
 
709
            amap.template dart_unlink_beta<1>(amap.template beta<0>(*it));
712
710
          }
713
711
        }
714
712
        else
715
713
        {
716
 
          if ( !(*it)->template is_free<1>() )
 
714
          if ( !amap.template is_free<1>(*it) )
717
715
          {
718
 
            modified_darts.push_back((*it)->template beta<1>());
719
 
            (*it)->template beta<1>()->template unlink_beta<0>();
 
716
            modified_darts.push_back(amap.template beta<1>(*it));
 
717
            amap.template dart_unlink_beta<0>(amap.template beta<1>(*it));
720
718
          }
721
719
        }
722
720
      }