Commits

Matthew Turk committed cac5601

Applying change for fixing particle info ordering in the hierarchy

Comments (0)

Files changed (2)

src/enzo/Grid_ReadGrid.C

             ENZO_FAIL("error reading NumberOfParticles.");
     }
  
-    if (NumberOfParticles > 0) {
+    if (fscanf(fptr, "NumberOfActiveParticles = %"ISYM"\n", &NumberOfActiveParticles) != 1) {
+      ENZO_FAIL("error reading NumberOfActiveParticles.");
+    }
+    
+    if ((NumberOfParticles > 0) || (NumberOfActiveParticles > 0)) {
  
       /* Read particle file name. */
     
 
     /* 5) Read active particle info */
     
-    if (fscanf(fptr, "NumberOfActiveParticles = %"ISYM"\n", &NumberOfActiveParticles) != 1) {
-      ENZO_FAIL("error reading NumberOfActiveParticles.");
-    }
-    
-    if (NumberOfActiveParticles > 0) {
-      
-      /* Read particle file name. */
-      
-      if (fscanf(fptr, "ParticleFileName = %s\n", procfilename) != 1) {
-	ENZO_FAIL("Error reading ParticleFileName.");
-      }
-    }
-    
     // If HierarchyFile has different Ghostzones (which should be a parameter not a macro ...)
     // (useful in a restart with different hydro/mhd solvers) 
     int ghosts =DEFAULT_GHOST_ZONES;

src/enzo/Grid_WriteGrid.C

 
     fprintf(fptr, "NumberOfParticles   = %"ISYM"\n", NumberOfParticles);
 
-    fprintf(fptr, "NumberOfActiveParticles =%"ISYM"\n", NumberOfActiveParticles);
+    fprintf(fptr, "NumberOfActiveParticles = %"ISYM"\n", NumberOfActiveParticles);
 
-    if (NumberOfParticles > 0)
+    if ((NumberOfParticles > 0) || (NumberOfActiveParticles > 0))
       fprintf(fptr, "ParticleFileName = %s\n", procfilename); // must be same as above
  
     if (SelfGravity)