From d2e409487eee1c5860fa6d70de054ae092ae13ff Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Thu, 4 Jul 2013 16:55:53 +0200 Subject: [PATCH] Bug fix in close operation. --- .../include/CGAL/Combinatorial_map.h | 28 +++++------- .../Combinatorial_map_3_test.h | 44 +++++++++---------- .../demo/Linear_cell_complex/MainWindow.cpp | 2 +- 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 4e41bbc1184..10de7d4eed3 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -872,7 +872,8 @@ namespace CGAL { * @pre 2<=i<=n (TODO case i==1) * @TODO move into Combinatorial_map_operations ? */ - unsigned int close(unsigned int i) + template + unsigned int close() { CGAL_assertion( 2<=i && i<=dimension ); unsigned int res = 0; @@ -881,44 +882,37 @@ namespace CGAL { for ( typename Dart_range::iterator it(darts().begin()); it!=darts().end(); ++it) { - if ( it->is_free(i) ) + if ( it->template is_free() ) { d = create_dart(); ++res; - // Here we cannot use link_beta as i is not a constant - // TODO something to solve this problem ? - basic_link_beta_for_involution(it, d, i); - // we copy all the non void attribute - Helper::template Foreach_enabled_attributes_except - , dimension+1>:: run(this,it,d); - // we need to remove i-attrib, how to do that ? + link_beta_for_involution(it, d); // Special cases for 0 and 1 if ( !it->template is_free<1>() && - !it->template beta<1>()->is_free(i) ) + !it->template beta<1>()->template is_free() ) link_beta<1>(it->beta(1)->beta(i),d); if ( !it->template is_free<0>() && - !it->template beta<0>()->is_free(i) ) - link_beta<0>(it->template beta<0>()->beta(i),d); + !it->template beta<0>()->template is_free() ) + link_beta<0>(it->template beta<0>()->template beta(),d); // General case for 2...dimension for ( unsigned int j=2; j<=dimension; ++j) { if ( j+1!=i && j!=i && j!=i+1 && - !it->is_free(j) && !it->beta(j)->is_free(i) ) + !it->is_free(j) && !it->beta(j)->template is_free() ) { basic_link_beta_for_involution(it->beta(j)->beta(i), d, j); } } d2 = it; - while (d2 != null_dart_handle && !d2->is_free(i-1)) - { d2 = d2->beta(i-1)->beta(i); } + while (d2 != null_dart_handle && !d2->template is_free()) + { d2 = d2->beta(i-1)->template beta(); } if (d2 != null_dart_handle) { if (i==2) basic_link_beta<1>(d2, d); - else basic_link_beta_for_involution(d2, d, i-1); + else basic_link_beta_for_involution(d2, d); } } } diff --git a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h index 023cc1faa25..081cf283dfe 100644 --- a/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h +++ b/Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h @@ -167,8 +167,8 @@ void createAllBasicCases1() } -template -void createAllBasicCases2(int close1, int close2) +template +void createAllBasicCases2() { Map map; Functor functor; @@ -179,8 +179,8 @@ void createAllBasicCases2(int close1, int close2) dh = map.create_dart(); dh2 = map.create_dart(); map.template sew<2>(dh,dh2); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); @@ -189,8 +189,8 @@ void createAllBasicCases2(int close1, int close2) dh2 = map.create_dart(); map.template sew<1>(dh,dh); map.template sew<2>(dh,dh2); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); @@ -200,8 +200,8 @@ void createAllBasicCases2(int close1, int close2) dh3 = map.create_dart(); map.template sew<1>(dh, dh2); map.template sew<2>(dh2,dh3); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); @@ -211,8 +211,8 @@ void createAllBasicCases2(int close1, int close2) dh3 = map.create_dart(); map.template sew<1>(dh, dh2); map.template sew<2>(dh2,dh3); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh2); map.clear(); @@ -223,8 +223,8 @@ void createAllBasicCases2(int close1, int close2) map.template sew<1>(dh, dh2); map.template sew<1>(dh2, dh); map.template sew<2>(dh2,dh3); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); @@ -237,8 +237,8 @@ void createAllBasicCases2(int close1, int close2) map.template sew<2>(dh2,dh3); dh3 = map.create_dart(); map.template sew<2>(dh,dh3); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh2); map.clear(); @@ -252,8 +252,8 @@ void createAllBasicCases2(int close1, int close2) map.template sew<2>(dh2,dh4); dh4 = map.create_dart(); map.template sew<2>(dh3,dh4); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); @@ -267,8 +267,8 @@ void createAllBasicCases2(int close1, int close2) map.template sew<2>(dh2,dh4); dh4 = map.create_dart(); map.template sew<2>(dh3,dh4); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh2); map.clear(); @@ -281,8 +281,8 @@ void createAllBasicCases2(int close1, int close2) map.template sew<1>(dh3, dh); dh4 = map.create_dart(); map.template sew<2>(dh,dh4); - if (close1!=-1) map.close(close1); - if (close2!=-1) map.close(close2); + if (close1!=-1) map.template close(); + if (close2!=-1) map.template close(); functor(map,dh); map.clear(); } @@ -795,10 +795,10 @@ bool test3D() createAllBasicCases1 >(); std::cout<<"************************* Test createAllBasicCases2 *************************"< >(-1,-1); + createAllBasicCases2,-1,-1>(); std::cout<<"************************* Test createAllBasicCases2<3> *************************"< >(-1,3); + createAllBasicCases2,-1,3>(); std::cout<<"************************* Test different cases *************************"<close(3) > 0 ) + if ( scene.lcc->close<3>() > 0 ) { init_all_new_volumes(); statusBar ()->showMessage (QString ("All volume(s) closed"),