From c3735f3e5dd6106faa92b04c03f288224051039f Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 9 Jul 2008 10:48:19 +0000 Subject: [PATCH] Added a small hack for the case of non-simmertric collapses where the average number of heap elements is almost the double of the symmetric case and therefore you should avoid too frequent heap garbage collections. --- vcg/complex/local_optimization.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vcg/complex/local_optimization.h b/vcg/complex/local_optimization.h index 135bafc4..e13e170e 100644 --- a/vcg/complex/local_optimization.h +++ b/vcg/complex/local_optimization.h @@ -323,7 +323,7 @@ void ClearHeap() } ++hi; } - //printf("\nReduced heap from %7i to %7i (fn %7i) ",sz,h.size(),m.fn); + //qDebug("\nReduced heap from %7i to %7i (fn %7i) ",sz,h.size(),m.fn); make_heap(h.begin(),h.end()); } @@ -333,6 +333,12 @@ void ClearHeap() template void Init() { m.InitVertexIMark(); + + // This is a small hack. In case of non-simmertric collapses the average number of + // heap elements is almost the double of the symmetric case so the minium would be 6*face number > the default 5*facenumber; + // 9*fn is a good guess that avoid too frequent heap garbage collections. + if(!LocalModificationType::IsSymmetric()) HeapSimplexRatio=9; + LocalModificationType::Init(m,h); std::make_heap(h.begin(),h.end()); if(!h.empty()) currMetric=h.front().pri;