Bug fix; optimize merge volume operations.

This commit is contained in:
Guillaume Damiand 2014-12-23 21:07:53 +01:00
parent 919bf8af74
commit 882c6033df
3 changed files with 25 additions and 45 deletions

View File

@ -169,12 +169,9 @@ namespace CGAL
amap.template basic_link_beta<i>(d1, d2);
amap.mark(d1, mark_modified_darts);
amap.mark(d2, mark_modified_darts);
if (amap.are_attributes_automatically_managed() && update_attributes)
{
first_modified_darts.push_back(d1);
modified_darts.push_back(d2);
// TODO push only one out of two dart ?
}
first_modified_darts.push_back(d1);
modified_darts.push_back(d2);
// TODO push only one out of two dart ?
/*if ( i==1 )
{
@ -190,10 +187,7 @@ namespace CGAL
amap.template unlink_beta<i>(d1);
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
amap.mark(d1, mark_modified_darts);
if (amap.are_attributes_automatically_managed() && update_attributes)
{
first_modified_darts.push_back(d1);
}
first_modified_darts.push_back(d1);
}
}
}
@ -204,10 +198,7 @@ namespace CGAL
amap.template unlink_beta<iinv>(d2);
CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
amap.mark(d2, mark_modified_darts);
if (amap.are_attributes_automatically_managed() && update_attributes)
{
modified_darts.push_back(d2);
}
modified_darts.push_back(d2);
}
}
}
@ -221,10 +212,7 @@ namespace CGAL
amap.template unlink_beta<iinv>(d1);
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
amap.mark(d1, mark_modified_darts);
if (amap.are_attributes_automatically_managed() && update_attributes)
{
modified_darts.push_back(d1);
}
modified_darts.push_back(d1);
}
}
}
@ -257,16 +245,15 @@ namespace CGAL
if ( !amap.is_whole_map_unmarked(mark_modified_darts) )
{
for ( typename std::deque<typename CMap::Dart_handle>::
iterator it=modified_darts.begin();
iterator it=modified_darts.begin();
it!=modified_darts.end(); ++it )
amap.unmark(*it, mark_modified_darts);
if ( i==1 )
{
for ( typename std::deque<typename CMap::Dart_handle>::
iterator it=modified_darts2.begin();
iterator it=modified_darts2.begin();
it!=modified_darts2.end(); ++it )
amap.unmark(*it, mark_modified_darts);
}
}
@ -617,12 +604,9 @@ namespace CGAL
amap.template basic_link_beta_for_involution<i>(d1, d2);
amap.mark(d1, mark_modified_darts);
amap.mark(d2, mark_modified_darts);
if ( amap.are_attributes_automatically_managed() )
{
modified_darts.push_back(d1);
modified_darts.push_back(d2);
// TODO push only one out of two dart ?
}
modified_darts.push_back(d1);
modified_darts.push_back(d2);
// TODO push only one out of two dart ?
}
else
{
@ -631,10 +615,7 @@ namespace CGAL
amap.template unlink_beta<i>(d1);
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
amap.mark(d1, mark_modified_darts);
if ( amap.are_attributes_automatically_managed() )
{
modified_darts.push_back(d1);
}
modified_darts.push_back(d1);
}
}
}
@ -645,10 +626,7 @@ namespace CGAL
amap.template unlink_beta<i>(d2);
CGAL_assertion( !amap.is_marked(d2, mark_modified_darts) );
amap.mark(d2, mark_modified_darts);
if ( amap.are_attributes_automatically_managed() )
{
modified_darts.push_back(d2);
}
modified_darts.push_back(d2);
}
}
}
@ -661,10 +639,7 @@ namespace CGAL
amap.template unlink_beta<i>(d1);
CGAL_assertion( !amap.is_marked(d1, mark_modified_darts) );
amap.mark(d1, mark_modified_darts);
if ( amap.are_attributes_automatically_managed() )
{
modified_darts.push_back(d1);
}
modified_darts.push_back(d1);
}
}
}

View File

@ -100,7 +100,6 @@ void MainWindow::connect_actions ()
QObject::connect(this->volumeList->horizontalHeader(),
SIGNAL(sectionClicked(int)),
this, SLOT(onHeaderClicked(int)));
QObject::connect(dialogmenger.mengerLevel, SIGNAL(valueChanged(int)),
this, SLOT(onMengerChange(int)));
QObject::connect(dialogmenger.updateAttributes, SIGNAL(clicked(bool)),
@ -784,6 +783,8 @@ void MainWindow::on_actionMerge_all_volumes_triggered()
timer.start();
#endif
scene.lcc->set_update_attributes(false);
Dart_handle prev = scene.lcc->null_handle;
for (LCC::Dart_range::iterator it(scene.lcc->darts().begin()),
itend=scene.lcc->darts().end(); it!=itend; )
@ -802,6 +803,8 @@ void MainWindow::on_actionMerge_all_volumes_triggered()
++it;
}
scene.lcc->set_update_attributes(true);
#ifdef CGAL_PROFILE_LCC_DEMO
timer.stop();
std::cout<<"Time to merge all filled volumes: "
@ -831,7 +834,7 @@ bool MainWindow::is_volume_in_list(LCC::Attribute_handle<3>::type ah)
void MainWindow::update_volume_list_add(LCC::Attribute_handle<3>::type ah)
{
CGAL_assertion( !is_volume_in_list(ah) );
// CGAL_assertion( !is_volume_in_list(ah) );
volumeList->disconnect(this);
@ -1165,6 +1168,7 @@ void MainWindow::onMengerCancel()
recreate_whole_volume_list();
mengerVolumes.clear();
update_operations_entries(true);
emit(sceneChanged());
}
@ -1274,9 +1278,8 @@ void MainWindow::onMengerInc()
for(unsigned int i = nbvolinit; i < (unsigned int)mengerVolumes.size(); i++)
{
LCC::Attribute_handle<3>::type ah = (scene.lcc)->create_attribute<3>();
CGAL::Set_i_attribute_functor<LCC, 3>::
run(scene.lcc, mengerVolumes[i], ah);
scene.lcc->info<3>(mengerVolumes[i]).color()=
scene.lcc->set_attribute<3>(mengerVolumes[i], ah);
scene.lcc->info<3>(mengerVolumes[i]).color()=
(CGAL::Color(myrandom.get_int(0,256),
myrandom.get_int(0,256),
myrandom.get_int(0,256)));
@ -1780,6 +1783,7 @@ void MainWindow::onSierpinskiCarpetCancel()
recreate_whole_volume_list();
sierpinskiCarpetSurfaces.clear();
update_operations_entries(true);
emit(sceneChanged());
}
@ -2554,6 +2558,7 @@ void MainWindow::onSierpinskiTriangleCancel()
recreate_whole_volume_list();
sierpinskiTriangleSurfaces.clear();
update_operations_entries(true);
emit(sceneChanged());
}

View File

@ -16,7 +16,7 @@
// $Id$
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
// Kumar Snehasish <kumar.snehasish@gmail.com>
// Contributor(s): Kumar Snehasish <kumar.snehasish@gmail.com>
//
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H