Commits

Anonymous committed b743aaf

Finalized OutputFromEvolveLevel.C

  • Participants
  • Parent commits 38215bd
  • Branches trunk

Comments (0)

Files changed (8)

src/enzo/EvolveLevel.C

  
 int RadiationFieldUpdate(LevelHierarchyEntry *LevelArray[], int level,
 			 TopGridData *MetaData);
-OutputFromEvolveLevel(moo);
+
+
+OutputFromEvolveLevel(LevelHierarchyEntry *LevelArray[],TopGridData *MetaData,
+		      int level, ExternalBoundary *Exterior);
  
 int ComputeRandomForcingNormalization(LevelHierarchyEntry *LevelArray[],
                                       int level, TopGridData *MetaData,
  
     JBPERF_STOP("evolve-level-25"); // PrepareDensityField()
 
-    OutputFromEvolveLevel(moo)
 
     /* For each grid, delete the GravitatingMassFieldParticles. */
  
  
     JBPERF_STOP("evolve-level-27"); // DeleteGravitatingMassFieldParticles()
 
-    /* Update SubcycleNumber if this is the bottom of the hierarchy --
-       Note that this not unique based on which level is the highest,
-       it just keeps going */
-
-    if (LevelArray[level+1] == NULL) MetaData->SubcycleNumber += 1;  
-
     /* ----------------------------------------- */
     /* Evolve the next level down (recursively). */
  
     jbPerf.attribute ("level",&jb_level,JB_INT);
 #endif
 
-    // Streaming movie output (only run if everything is evolved)
 
-    if (MovieSkipTimestep != INT_UNDEFINED) {
-      if (WriteStreamData(Grids, NumberOfGrids, MetaData, 
-			  LevelCycleCount[level]) == FAIL) {
-	fprintf(stderr, "Error in WriteStreamData.\n");
-	return FAIL;
-      }
-    }
+    OutputFromEvolveLevel(LevelArray,MetaData,level,Exterior);
+    /* Update SubcycleNumber if this is the bottom of the hierarchy --
+       Note that this not unique based on which level is the highest,
+       it just keeps going */
+
+    if (LevelArray[level+1] == NULL) MetaData->SubcycleNumber += 1;  
+
 
     if (dbx) fprintf(stderr, "EL Level %"ISYM" returns from Level %"ISYM"\n", level, level+1);
 

src/enzo/Make.config.objects

 	OptimizedUnigridCommunicationTranspose.o \
 	Options.o \
 	OutputAsParticleData.o \
+	OutputFromEvolveLevel.o\
 	OutputLevelInformation.o \
 	P_ColumnFormat.o \
 	performance.o \

src/enzo/Make.mach.nics-kraken

 
 #MACH_DEFINES   = -DXT3 -DNO_IO_LOG -DSYSCALL -DENZO_ANALYSIS
 #MACH_DEFINES   = -DXT3 -DNO_IO_LOG -DSYSCALL -DHAVE_SPRNG
-MACH_DEFINES   = -DXT3 -DNO_IO_LOG -DSYSCALL -DSFGEN_PERF -DHAVE_SPRNG -DUSE_STOCHASTIC_FORCING
+MACH_DEFINES   = -DXT3 -DNO_IO_LOG -DSYSCALL -DSFGEN_PERF -DHAVE_SPRNG -DUSE_STOCHASTIC_FORCING -DFAST_SIB
 
 #-----------------------------------------------------------------------
 # Compiler flag settings

src/enzo/OutputFromEvolveLevel.C

 // 
 // Purpose   : Control various outputs from the EvolveLevel routine.
 
-//Needs some headers
+ 
+#ifdef USE_MPI
+#include "mpi.h"
+#endif /* USE_MPI */
+ 
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+
+#include "performance.h"
+#include "macros_and_parameters.h"
+#include "typedefs.h"
+#include "global_data.h"
+#include "Fluxes.h"
+#include "GridList.h"
+#include "ExternalBoundary.h"
+#include "Grid.h"
+#include "Hierarchy.h"
+#include "TopGridData.h"
+#include "LevelHierarchy.h"
 
 int WriteMovieData(char *basename, int filenumber,
 		   LevelHierarchyEntry *LevelArray[], TopGridData *MetaData,
 int WriteTracerParticleData(char *basename, int filenumber,
 		   LevelHierarchyEntry *LevelArray[], TopGridData *MetaData,
 		   FLOAT WriteTime);
+#ifdef USE_HDF5_GROUPS
+int Group_WriteAllData(char *basename, int filenumber, HierarchyEntry *TopGrid,
+		       TopGridData &MetaData, ExternalBoundary *Exterior,
+		       FLOAT WriteTime = -1);
+#else
+int WriteAllData(char *basename, int filenumber, HierarchyEntry *TopGrid,
+                 TopGridData &MetaData, ExternalBoundary *Exterior,
+                 FLOAT WriteTime = -1);
+#endif
+void my_exit(int status);
+int GenerateGridArray(LevelHierarchyEntry *LevelArray[], int level,
+		      HierarchyEntry **Grids[]);
 
-int OutputFromEvolveLevel(LevelHierarchyEntry *LevelArray[]){
-  /*Crap I need:
-    LevelArray
-    MetaData
-    level
-    Exterior
-  */
-  int Write = FALSE, ExitEnzo = FALSE;
+EXTERN int LevelCycleCount[MAX_DEPTH_OF_HIERARCHY];
+
+int OutputFromEvolveLevel(LevelHierarchyEntry *LevelArray[],TopGridData *MetaData,
+			  int level, ExternalBoundary *Exterior){
+
+  int Write = FALSE, ExitEnzo = FALSE, NumberOfGrids;
+  HierarchyEntry **Grids;    
 
   //Do all "bottom of hierarchy" checks
   if (LevelArray[level+1] == NULL){
     // a file stopNow will output and then exit enzo.
     
     int outputNow = -1, stopNow = -1, subcycleCount=-1;
-    if( UseFileDirectedOutput == TRUE){
+    if( FileDirectedOutput == TRUE){
       
 #ifdef USE_MPI
       MPI_Barrier(MPI_COMM_WORLD);
 	  } 
       } 
       
-      /* Check for stop by file-touching */
-      
 #ifdef USE_MPI
       MPI_Barrier(MPI_COMM_WORLD);
 #endif
       Write = TRUE;
     }
   }//Finest Level
+
+  // Streaming movie output (only run if everything is evolved)
+  NumberOfGrids = GenerateGridArray(LevelArray, level, &Grids);
+  if (MovieSkipTimestep != INT_UNDEFINED) {
+    if (WriteStreamData(Grids, NumberOfGrids, MetaData, 
+			LevelCycleCount[level]) == FAIL) {
+      fprintf(stderr, "Error in WriteStreamData.\n");
+      return FAIL;
+    }
+  }
+
+  delete []Grids;
   if( ExitEnzo == TRUE ){
     // Write movie data in all grids if necessary
-    HierarchyEntry **Grids;    
     if (MovieSkipTimestep != INT_UNDEFINED)
       for (int mlevel = 0; mlevel < MAX_DEPTH_OF_HIERARCHY; mlevel++) {
 	if (LevelArray[mlevel] == NULL) break;
 	  return FAIL;
 	}
       }
-    
+    delete []Grids;    
     fprintf(stderr, "Stopping due to request on level %"ISYM"\n", level);
     my_exit(EXIT_SUCCESS);
   }

src/enzo/ReadParameterFile.C

     ret += sscanf(line, "StopFirstTimeAtLevel = %"ISYM,
 		  &MetaData.StopFirstTimeAtLevel);
  
+    /* Subcycle directed output */
+    ret += sscanf(line, "SubcycleSkipDataDump = %"ISYM, 
+                  &MetaData.SubcycleSkipDataDump);
+    ret += sscanf(line, "SubcycleLastDataDump = %"ISYM, 
+                  &MetaData.SubcycleLastDataDump);
+    ret += sscanf(line, "SubcycleNumber = %"ISYM, 
+                  &MetaData.SubcycleNumber);
+
+    ret += sscanf(line,"FileDirectedOutput = %"ISYM,
+		  &FileDirectedOutput);
+
     ret += sscanf(line, "RestartDumpNumber = %"ISYM, &MetaData.RestartDumpNumber);
     ret += sscanf(line, "DataDumpNumber    = %"ISYM, &MetaData.DataDumpNumber);
     ret += sscanf(line, "HistoryDumpNumber = %"ISYM, &MetaData.HistoryDumpNumber);

src/enzo/SetDefaultGlobalValues.C

   MetaData.GlobalDir           = NULL;
 
   LoadBalancing = 1; //On, memory equalization method
- 
+
+  FileDirectedOutput = 1;
+
   for (i = 0; i < MAX_TIME_ACTIONS; i++) {
     TimeActionType[i]      = 0;
     TimeActionRedshift[i]  = -1;

src/enzo/WriteParameterFile.C

 	  MetaData.CycleSkipHistoryDump);
   fprintf(fptr, "CycleSkipGlobalDataDump = %"ISYM"\n\n", //AK
           MetaData.CycleSkipGlobalDataDump);
+
+  fprintf(fptr, "SubcycleNumber = %"ISYM"\n", MetaData.SubcycleNumber);
+  fprintf(fptr, "SubcycleSkipDataDump = %"ISYM"\n", MetaData.SubcycleSkipDataDump);
+  fprintf(fptr, "SubcycleLastDataDump = %"ISYM"\n", MetaData.SubcycleLastDataDump);
  
   fprintf(fptr, "OutputFirstTimeAtLevel = %"ISYM"\n",
 	  MetaData.OutputFirstTimeAtLevel);

src/enzo/global_data.h

                           1 = Equalize processor memory count */
 EXTERN int LoadBalancing;
 
+/* FileDirectedOutput checks for file existence: 
+   stopNow (writes, stops),   outputNow, subgridcycleCount */
+EXTERN int FileDirectedOutput;
+
+
 /* debugging, extraction flags */
 
 EXTERN int debug;