Commits

Britton Smith committed 27df924

Fixing functionality that stops a simulation after a certain number of
outputs to do so after the full EvolveHierarchy loop. Otherwise,
timing information and inline analysis don't get written/performed.

  • Participants
  • Parent commits 4e2bd86

Comments (0)

Files changed (2)

File src/enzo/CheckForOutput.C

   }
 #endif   
 
-  if (MetaData.NumberOfOutputsBeforeExit && MetaData.WroteData) {
-    MetaData.OutputsLeftBeforeExit--;
-    if (MetaData.OutputsLeftBeforeExit <= 0) {
-      if (MyProcessorNumber == ROOT_PROCESSOR) {
-	fprintf(stderr, "Exiting after writing %"ISYM" datadumps.\n",
-		MetaData.NumberOfOutputsBeforeExit);
-      }      
-      my_exit(EXIT_SUCCESS);
-    }
-  }
-
   return SUCCESS;
 }

File src/enzo/EvolveHierarchy.C

   float dt;
  
   int i, dim, Stop = FALSE;
+  int StoppedByOutput = FALSE;
   int Restart = FALSE;
   double tlev0, tlev1, treb0, treb1, tloop0, tloop1, tentry, texit;
   LevelHierarchyEntry *Temp;
 
     FirstLoop = false;
  
+    /* If simulation is set to stop after writing a set number of outputs, check that here. */
+
+    if (MetaData.NumberOfOutputsBeforeExit && MetaData.WroteData) {
+      MetaData.OutputsLeftBeforeExit--;
+      if (MetaData.OutputsLeftBeforeExit <= 0) {
+        if (MyProcessorNumber == ROOT_PROCESSOR) {
+          fprintf(stderr, "Exiting after writing %"ISYM" datadumps.\n",
+                  MetaData.NumberOfOutputsBeforeExit);
+        }      
+        Stop = TRUE;
+        StoppedByOutput = TRUE;
+      }
+    }
+
   } // ===== end of main loop ====
 
 #ifdef USE_LCAPERF
   /* Write a file to indicate that we're finished. */
 
   FILE *Exit_fptr;
-  if (!Restart && MyProcessorNumber == ROOT_PROCESSOR) {
+  if (!Restart && !StoppedByOutput && MyProcessorNumber == ROOT_PROCESSOR) {
     if ((Exit_fptr = fopen("RunFinished", "w")) == NULL)
       ENZO_FAIL("Error opening RunFinished.");
     fprintf(Exit_fptr, "Finished on cycle %"ISYM"\n", MetaData.CycleNumber);