Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reset the clock to 0 in surf_exit so that it gets zeroed in MSG_clean for people...
[simgrid.git] / src / surf / surf.c
index f80dadd..46b0c8e 100644 (file)
@@ -189,17 +189,10 @@ int find_model_description(s_surf_model_description_t * table,
              name_list);
 }
 
-double generic_maxmin_share_models(xbt_swag_t running_actions,
-                                     size_t offset)
-{
-  return generic_maxmin_share_models2(running_actions, offset,
-                                        maxmin_system, lmm_solve);
-}
-
-double generic_maxmin_share_models2(xbt_swag_t running_actions,
-                                      size_t offset,
-                                      lmm_system_t sys,
-                                      void (*solve) (lmm_system_t))
+double generic_maxmin_share_resources(xbt_swag_t running_actions,
+                                     size_t offset,
+                                     lmm_system_t sys,
+                                     void (*solve) (lmm_system_t))
 {
   surf_action_t action = NULL;
   double min = -1;
@@ -356,8 +349,6 @@ void surf_init(int *argc, char **argv)
     model_list = xbt_dynar_new(sizeof(surf_model_private_t), NULL);
   if (!history)
     history = tmgr_history_new();
-  if (!maxmin_system)
-    maxmin_system = lmm_system_new();
 }
 
 static char *path_name = NULL;
@@ -366,7 +357,7 @@ FILE *surf_fopen(const char *name, const char *mode)
   int i;
   char *path = NULL;
   FILE *file = NULL;
-  int path_name_len = 0;       /* don't count '\0' */
+  unsigned int path_name_len = 0;      /* don't count '\0' */
 
   xbt_assert0(name, "Need a non-NULL file name");
 
@@ -426,6 +417,7 @@ void surf_exit(void)
     free(path_name);
     path_name = NULL;
   }
+  NOW=0; /* Just in case the user plans to restart the simulation afterward */
   xbt_exit();
 }
 
@@ -453,7 +445,7 @@ double surf_solve(void)
                                              &value,
                                              (void **) &model_obj))) {
        model_obj->model->common_private->
-           update_model_state(model_obj, event, value);
+           update_resource_state(model_obj, event, value);
       }
     }
     xbt_dynar_foreach(model_list, i, model) {
@@ -469,7 +461,7 @@ double surf_solve(void)
   xbt_dynar_foreach(model_list, i, model) {
     DEBUG1("Running for Resource [%s]", model->common_public->name);
     model_next_action_end =
-       model->common_private->share_models(NOW);
+       model->common_private->share_resources(NOW);
     DEBUG2("Resource [%s] : next action end = %f",
           model->common_public->name, model_next_action_end);
     if (((min < 0.0) || (model_next_action_end < min))
@@ -492,7 +484,7 @@ double surf_solve(void)
                                            &value,
                                            (void **) &model_obj))) {
       if (model_obj->model->common_private->
-         model_used(model_obj)) {
+         resource_used(model_obj)) {
        min = next_event_date - NOW;
        DEBUG1
            ("This event will modify model state. Next event set to %f",
@@ -501,7 +493,7 @@ double surf_solve(void)
       /* update state of model_obj according to new value. Does not touch lmm.
          It will be modified if needed when updating actions */
       model_obj->model->common_private->
-         update_model_state(model_obj, event, value);
+         update_resource_state(model_obj, event, value);
     }
   }