Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Useless include.
[simgrid.git] / src / surf / surf_interface.cpp
index f9c9679..01318ca 100644 (file)
@@ -365,12 +365,14 @@ Model::Model()
   doneActionSet_ = new ActionList();
 
   modifiedSet_ = nullptr;
-  actionHeap_ = nullptr;
+  actionHeap_      = xbt_heap_new(8, nullptr);
+  xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
   updateMechanism_ = UM_UNDEFINED;
   selectiveUpdate_ = 0;
 }
 
 Model::~Model(){
+  xbt_heap_free(actionHeap_);
   delete readyActionSet_;
   delete runningActionSet_;
   delete failedActionSet_;
@@ -442,8 +444,8 @@ double Model::nextOccuringEventLazy(double now)
   }
 
   //hereafter must have already the min value for this resource model
-  if (xbt_heap_size(actionHeap_) > 0) {
-    double min = xbt_heap_maxkey(actionHeap_) - now;
+  if (not actionHeapIsEmpty()) {
+    double min = actionHeapTopDate() - now;
     XBT_DEBUG("minimum with the HEAP %f", min);
     return min;
   } else {