7 #include "CommLBHeap.h"
9 ObjectHeap::ObjectHeap(int sz) {
15 int ObjectHeap::numElements() {
19 int ObjectHeap::insert(ObjectRecord *x) {
26 CkPrintf("Heap overflow. \n");
29 int parent = (current - 1)/2;
32 if (h[current].info->val > h[parent].info->val)
34 swap(current, parent);
36 parent = (current-1)/2;
44 ObjectRecord *ObjectHeap::deleteMax() {
45 if (count == 0) return 0;
46 ObjectRecord *tmp = h[0].info;
61 if (h[c1].info->val > h[c2].info->val)
66 if (h[best].info->val > h[current].info->val)
79 ObjectRecord *ObjectHeap::iterator(hIterator *iter) {
86 ObjectRecord *ObjectHeap::next(hIterator *iter) {
87 if (iter->next >= count)
90 return h[iter->next - 1].info;