From b0c7c9d78a31825098075af378766508c7fac4d4 Mon Sep 17 00:00:00 2001 From: tgdwyer Date: Mon, 6 Feb 2006 05:22:54 +0000 Subject: [PATCH] DBL_MIN replaced by -DBL_MAX which is what I meant all along. Fixes bug. --- src/removeoverlap/block.cpp | 8 ++++++ src/removeoverlap/constraint.cpp | 2 +- src/removeoverlap/constraint.h | 4 +-- src/removeoverlap/pairingheap/PairingHeap.cpp | 28 +++++++++++++++++-- src/removeoverlap/pairingheap/PairingHeap.h | 2 ++ 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/removeoverlap/block.cpp b/src/removeoverlap/block.cpp index ebf56ea9e..7a2ab53af 100644 --- a/src/removeoverlap/block.cpp +++ b/src/removeoverlap/block.cpp @@ -104,6 +104,9 @@ void Block::mergeIn(Block *b) { findMinInConstraint(); b->findMinInConstraint(); in->merge(b->in); +#ifdef RECTANGLE_OVERLAP_LOGGING + f<<" merged heap: "<<*in<deleteMin(); +#ifdef RECTANGLE_OVERLAP_LOGGING + ofstream f(LOGFILE,ios::app); + f<<"deleteMinInConstraint... "<deleteMin(); diff --git a/src/removeoverlap/constraint.cpp b/src/removeoverlap/constraint.cpp index e48775f8c..bb889c4d9 100644 --- a/src/removeoverlap/constraint.cpp +++ b/src/removeoverlap/constraint.cpp @@ -24,6 +24,6 @@ Constraint::Constraint(Variable *left, Variable *right, double gap) } std::ostream& operator <<(std::ostream &os, const Constraint &c) { - os<<*c.left<<"+"<::clone( PairNode * t ) const return p; } } - +template +ostream& operator <<(ostream &os, const PairingHeap &b) +{ + os<<"Heap:"; + if (b.root != NULL) { + PairNode *r = b.root; + list*> q; + q.push_back(r); + while (!q.empty()) { + r = q.front(); + q.pop_front(); + if (r->leftChild != NULL) { + os << *r->element << ">"; + PairNode *c = r->leftChild; + while (c != NULL) { + q.push_back(c); + os << "," << *c->element; + c = c->nextSibling; + } + os << "|"; + } + } + } + return os; +} #endif diff --git a/src/removeoverlap/pairingheap/PairingHeap.h b/src/removeoverlap/pairingheap/PairingHeap.h index 5f57f2f1b..038a395f4 100644 --- a/src/removeoverlap/pairingheap/PairingHeap.h +++ b/src/removeoverlap/pairingheap/PairingHeap.h @@ -43,6 +43,7 @@ class PairingHeap; template class PairNode { + friend std::ostream& operator <<(std::ostream &os,const PairingHeap &b); T element; PairNode *leftChild; PairNode *nextSibling; @@ -63,6 +64,7 @@ public: template class PairingHeap { + friend std::ostream& operator <<(std::ostream &os,const PairingHeap &b); public: PairingHeap( bool (*lessThan)(T const &lhs, T const &rhs) ); PairingHeap( const PairingHeap & rhs ); -- 2.30.2