From 036659b2048e582a42913953f307c225a52156bc Mon Sep 17 00:00:00 2001 From: Olivier Devillers Date: Mon, 7 Nov 2011 15:06:06 +0000 Subject: [PATCH 1/5] bibtex labels --- Generator/doc_tex/Generator/PkgDescription.tex | 2 +- Spatial_sorting/doc_tex/Spatial_sorting/PkgDescription.tex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Generator/doc_tex/Generator/PkgDescription.tex b/Generator/doc_tex/Generator/PkgDescription.tex index 9aff8e1e26c..e2de2c94d31 100644 --- a/Generator/doc_tex/Generator/PkgDescription.tex +++ b/Generator/doc_tex/Generator/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{Geometric Object Generators\label{Pkg:Generators}} -\ccPkgHowToCiteCgal{cgal:hhk-gog-12} +\ccPkgHowToCiteCgal{cgal:dhhk-gog-12} \ccPkgSummary{This package provides a variety of generators for geometric objects. They are useful as synthetic test data sets, e.g.~for testing diff --git a/Spatial_sorting/doc_tex/Spatial_sorting/PkgDescription.tex b/Spatial_sorting/doc_tex/Spatial_sorting/PkgDescription.tex index 12e611e70dc..223ccfcd0ce 100644 --- a/Spatial_sorting/doc_tex/Spatial_sorting/PkgDescription.tex +++ b/Spatial_sorting/doc_tex/Spatial_sorting/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{Spatial Sorting \label{Pkg:SpatialSorting}} -\ccPkgHowToCiteCgal{cgal:d-ss-12} +\ccPkgHowToCiteCgal{cgal:dd-ss-12} \ccPkgSummary{This package provides functions for sorting geometric objects in two, three and higher dimensions, in order to improve efficiency of incremental geometric algorithms.} From dcdaff462253948bdb3dd30ca59a196bf307df53 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 7 Nov 2011 15:53:06 +0000 Subject: [PATCH 2/5] Quote a path, to avoid errors if the path contains a space --- Scripts/developer_scripts/autotest_cgal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index aa1eb94a729..97488b57560 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -948,13 +948,13 @@ if [ -z "${DO_NOT_TEST}" ]; then run_test fi -cd ${CGAL_ROOT} +cd "${CGAL_ROOT}" if [ -e "LATEST" ]; then mv LATEST RELEASE_NR fi -rm -f $LOCK_FILE; +rm -f "$LOCK_FILE"; # EOF From ba66be3e4a233fd1d10510dbcd11ce696e90a804 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 7 Nov 2011 16:31:32 +0000 Subject: [PATCH 3/5] Again: quote $LOCK_FILE, this time in the EXIT trap. --- Scripts/developer_scripts/autotest_cgal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index 97488b57560..1f61951e1e3 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -902,7 +902,7 @@ chmod u+w "$LOCK_FILE" echo $$ > "$LOCK_FILE" # that line makes the script remove the lock file in case of unwanted exit -trap "rm -f $LOCK_FILE" EXIT HUP INT TERM +trap "rm -f \"$LOCK_FILE\"" EXIT HUP INT TERM # Notify test started if [ ! "${MAIL_ADDRESS}" = "must_be_set_in_.autocgalrc" ]; then From ed25a632bfbb8006adc976da3fd6d1ac274dd2fa Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 8 Nov 2011 09:56:54 +0000 Subject: [PATCH 5/5] Merge with branches/candidate-packages/Combinatorial_map. --- .../include/CGAL/Cell_attribute.h | 16 ++- .../include/CGAL/Combinatorial_map.h | 15 ++- .../CGAL/Combinatorial_map_operations.h | 111 ++++++++++++------ Combinatorial_map/include/CGAL/Dart.h | 3 + .../internal/Combinatorial_map_functors.h | 56 +++++---- 5 files changed, 138 insertions(+), 63 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Cell_attribute.h b/Combinatorial_map/include/CGAL/Cell_attribute.h index bd0bcacf971..eea8db15d3e 100644 --- a/Combinatorial_map/include/CGAL/Cell_attribute.h +++ b/Combinatorial_map/include/CGAL/Cell_attribute.h @@ -76,6 +76,13 @@ namespace CGAL { template friend struct Dart; + template < unsigned int d_, class Refs_, + class Items_, class Alloc_ > + friend class Generalized_map_base; + + template + friend struct GMap_dart; + template friend class Compact_container; @@ -161,10 +168,17 @@ namespace CGAL { template < unsigned int d_, class Refs_, class Items_, class Alloc_ > friend class Combinatorial_map_base; - + template friend struct Dart; + template < unsigned int d_, class Refs_, + class Items_, class Alloc_ > + friend class Generalized_map_base; + + template + friend struct GMap_dart; + template friend class Compact_container; diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 4aec05a4d06..35d551c64d8 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -1085,7 +1085,7 @@ namespace CGAL { std::vector count_cells(const std::vector& acells) const { - std::vector res(dimension+1); + std::vector res; int m = get_new_mark(); negate_mark(m); // We mark all the cells. @@ -1097,6 +1097,19 @@ namespace CGAL { return res; } + /** Count the number of cells in each dimension. + * @return a vector containing the number of cells. + */ + std::vector count_all_cells() const + { + std::vector dim(dimension+2); + + for (unsigned int i=0; i > tosplit; + // Mark used to mark darts already treated. + int treated = amap.get_new_mark(); + + // Stack of marked darts + std::stack tounmark; + // Now we run through the facet for (CGAL::CMap_dart_iterator_basic_of_orbit it(amap,first); it.cont();) { cur = it; ++it; + amap.mark(cur, treated); + tounmark.push(cur); if ( cur!=first ) { @@ -97,27 +105,40 @@ namespace CGAL { { if ( !adart->is_free(dim) ) { - if (n1!=NULL) + if ( !amap.is_marked(cur->beta(dim), treated) ) { - nn1=amap.create_dart(); - amap.template link_beta<1>(cur->beta(dim), nn1); - amap.link_beta(n1, nn1, dim); - } - else nn1=NULL; + if (n1!=NULL) + { + nn1=amap.create_dart(); + amap.template link_beta<1>(cur->beta(dim), nn1); + amap.link_beta(n1, nn1, dim); + } + else nn1=NULL; - if (n2!=NULL) - { - nn2=amap.create_dart(); - amap.template link_beta<0>(cur->beta(dim), nn2); - amap.link_beta(n2, nn2, dim); - } - else nn2=NULL; + if (n2!=NULL) + { + nn2=amap.create_dart(); + amap.template link_beta<0>(cur->beta(dim), nn2); + amap.link_beta(n2, nn2, dim); + } + else nn2=NULL; - if (nn1 != NULL && nn2 != NULL) - amap.template basic_link_beta<1>(nn1, nn2); + if (nn1 != NULL && nn2 != NULL) + amap.template basic_link_beta<1>(nn1, nn2); - if (nn1 != NULL && prev != NULL) - amap.link_beta(nn1, prev->beta(dim), 2); + if (nn1 != NULL && prev != NULL) + amap.link_beta(nn1, prev->beta(dim), 2); + + amap.mark(cur->beta(dim), treated); + tounmark.push(cur->beta(dim)); + } + else + { + if ( n1!=NULL ) + amap.link_beta(n1, cur->beta(dim)->beta(1), dim); + if ( n2!=NULL ) + amap.link_beta(n2, cur->beta(dim)->beta(0), dim); + } } } @@ -131,11 +152,21 @@ namespace CGAL { { if ( !adart->is_free(dim) ) { - amap.link_beta(first->beta(0)->beta(dim), nn2, 2); + amap.link_beta(first->beta(0)->beta(dim), n2->beta(dim), 2); } } } + // Now we unmark all marked darts + while ( !tounmark.empty() ) + { + amap.unmark(tounmark.top(), treated); + tounmark.pop(); + } + + CGAL_assertion(amap.is_whole_map_unmarked(treated)); + amap.free_mark(treated); + while ( !tosplit.empty() ) { internal::Couple_dart_and_dim c=tosplit.top(); @@ -415,33 +446,39 @@ namespace CGAL { // 4) For each dart of the cell, we modify link of neighbors. for ( it=to_erase.begin(); it!=to_erase.end(); ++it ) { - if ( !(*it)->is_free(0) && (*it)->beta(0)!=(*it) ) + if ( !(*it)->is_free(0) ) { - amap.template basic_link_beta<1>((*it)->beta(0), (*it)->beta(1)); - + if ( !(*it)->is_free(1) && (*it)->beta(0)!=(*it) ) + amap.template basic_link_beta<1>((*it)->beta(0), (*it)->beta(1)); + else + { + todegroup.push(Dart_pair((*it)->beta(0), *it)); + (*it)->beta(0)->unlink_beta(1); + } + for ( unsigned int j=2; j<=Map::dimension; ++j ) { if ( !(*it)->is_free(j) ) - ((*it)->beta(0))->basic_link_beta((*it)->beta(j),j); + amap.basic_link_beta((*it)->beta(0), (*it)->beta(j), j); + //((*it)->beta(0))->basic_link_beta((*it)->beta(j),j); } } else { - for ( unsigned int j=1; j<=Map::dimension; ++j ) + if ( !(*it)->is_free(1) ) { - if (!(*it)->is_free(j)) - { - d1 = (*it)->beta(j); - if ( !d1->is_free(CGAL_BETAINV(j)) ) - { - todegroup.push(Dart_pair(d1, d1->beta_inv(j))); - d1->unlink_beta(CGAL_BETAINV(j)); - } - } + todegroup.push(Dart_pair((*it)->beta(1), *it)); + (*it)->beta(1)->unlink_beta(0); + } + + for ( unsigned int j=2; j<=Map::dimension; ++j ) + { + if ( !(*it)->is_free(j) ) + amap.unlink_beta(*it, j); } } } - + // 5) We degroup all the pairs while ( !todegroup.empty() ) { @@ -449,16 +486,16 @@ namespace CGAL { todegroup.pop(); amap.degroup_all_attributes(p.first,p.second); } - + // 6) We remove all the darts of the cell. for (it = to_erase.begin(); it != to_erase.end(); ++it) { amap.erase_dart(*it); } - + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); amap.free_mark(mark); - + // CGAL_postcondition( amap.is_valid() ); - + return res; } }; diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index 480dc4c5bae..59499231aa4 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -73,6 +73,9 @@ namespace CGAL { template friend struct internal::link_beta_functor; + template + friend struct internal::unlink_beta_functor; + public: typedef Dart Self; typedef typename Refs::Dart_handle Dart_handle; diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h index cb7121d39d0..ff8d2862ab1 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h @@ -135,7 +135,7 @@ namespace CGAL { static bool run(const Map& amap, typename Map::Dart_const_handle adart1, typename Map::Dart_const_handle adart2) - { return is_sewable_functor::run(amap,adart1,adart2); } + { return is_sewable_functor::run(amap,adart2,adart1); } }; /// Functor used to i-topo_sew two darts, 2<=i<=dimension. @@ -198,7 +198,7 @@ namespace CGAL { struct topo_sew_functor{ static void run(Map& amap,typename Map::Dart_handle adart1, typename Map::Dart_handle adart2) - { topo_sew_functor::run(amap,adart1,adart2); } + { topo_sew_functor::run(amap,adart2,adart1); } }; /// Functor used to i-sew two darts, 2<=i<=dimension. @@ -240,25 +240,28 @@ namespace CGAL { for (CMap_dart_iterator_basic_of_cell it(amap,adart1,mark); it.cont(); ++it) { - amap.mark(*it,mark); - dartv.push_back(*it); + amap.mark(it,mark); + dartv.push_back(it); } CMap_dart_iterator_of_involution I1(amap, adart1); CMap_dart_iterator_of_involution_inv I2(amap, adart2); while ( I1.cont() ) { - group_all_attributes_except(*I1,*I2,1); - ++I1; ++I2; + typename Map::Dart_handle od1=I1->other_extremity(); + typename Map::Dart_handle od2=I2->other_extremity(); + if (od1!=NULL && od2!=NULL) + amap.group_all_attributes_except(od1, od2, 1); + ++I1; ++I2; } I1.rewind(); I2.rewind(); while ( I1.cont() ) { - if ( amap.is_marked(*I1,mark) ) - amap.template basic_link_beta<0>(*I1, *I2); + if ( amap.is_marked(I1,mark) ) + amap.template basic_link_beta<0>(I1, I2); else - amap.template basic_link_beta<1>(*I1, *I2); + amap.template basic_link_beta<1>(I1, I2); ++I1; ++I2; } @@ -303,7 +306,7 @@ namespace CGAL { amap.template basic_link_beta<0>(I1, I2); ++I1; ++I2; } - + for (typename std::vector::iterator it=dartv.begin(); it!=dartv.end(); ++it) { amap.unmark(*it,mark); } @@ -414,19 +417,19 @@ namespace CGAL { for (CMap_dart_iterator_basic_of_cell it(amap,adart,mark); it.cont(); ++it) { - amap.mark(*it,mark); - dartv.push_back(*it); + amap.mark(it,mark); + dartv.push_back(it); } { CMap_dart_iterator_of_involution it(amap, adart); while ( it.cont() ) { - if ( amap.is_marked(*it,mark) ) - { d2 = it->beta(1); amap.template unlink_beta<1>(*it); } + if ( amap.is_marked(it,mark) ) + { d2 = it->beta(1); amap.template unlink_beta<1>(it); } else - { d2 = it->beta(0); amap.template unlink_beta<0>(*it); } - amap.degroup_all_attributes_except(*it,d2,1); + { d2 = it->beta(0); amap.template unlink_beta<0>(it); } + amap.degroup_all_attributes_except(it,d2,1); ++it; } } @@ -435,11 +438,11 @@ namespace CGAL { it=dartv.begin(); it!=dartv.end(); ++it) { amap.unmark(*it,mark); } CGAL_assertion( amap.is_whole_map_unmarked(mark) ); - amap.free_mark(mark); + amap.free_mark(mark); } }; - /// Functor used to 1-unsew one dart. + /// Functor used to 0-unsew one dart. template struct unsew_functor{ static void run(Map& amap,typename Map::Dart_handle adart) @@ -452,19 +455,24 @@ namespace CGAL { for (CMap_dart_iterator_basic_of_cell it(amap,adart,mark); it.cont(); ++it) { - amap.mark(*it,mark); - dartv.push_back(*it); + amap.mark(it,mark); + dartv.push_back(it); } { CMap_dart_iterator_of_involution it(amap, adart); while ( it.cont() ) { - if ( amap.is_marked(*it,mark) ) - { d2 = it->beta(0); amap.template unlink_beta<0>(*it); } + if ( amap.is_marked(it,mark) ) + { d2 = it->beta(0); amap.template unlink_beta<0>(it); } else - { d2 = it->beta(1); amap.template unlink_beta<1>(*it); } - amap.degroup_all_attributes_except(*it,d2,1); + { d2 = it->beta(1); amap.template unlink_beta<1>(it); } + + typename Map::Dart_handle od1=it->other_extremity(); + typename Map::Dart_handle od2=d2->other_extremity(); + if ( od1!=NULL && od2!=NULL ) + amap.degroup_all_attributes_except(od1,od2,1); + ++it; } }