Commits

Matthew Turk committed ee28cda

This should fix a pernicious active particle communication bug.

Comments (0)

Files changed (1)

src/enzo/particles/active_particles/ActiveParticleFindAll.C

 	  if (LocalNumberOfActiveParticles != 0) 
 	    {
 	      ParticlesOnThisProc = LocalActiveParticlesOfThisType;
-	      delete [] LocalActiveParticlesOfThisType;
 	      LocalActiveParticlesOfThisType = NULL;
 	    }
 
 	    offset += NumberOfActiveParticlesInGrids[GridNum];
 	  } 
 
-	  LocalActiveParticlesOfThisType = new ActiveParticleType*[offset]();
+	  LocalActiveParticlesOfThisType = new ActiveParticleType*[offset + LocalNumberOfActiveParticles]();
 	  
 	  /* If we've already found active particles, copy the cached
 	     list to the new one and delete the old list */
 	  }
 
 	  /* Finally, append the new active particles to the list */
-	  for(i = LocalNumberOfActiveParticles; i < offset; i++)
+	  for(i = LocalNumberOfActiveParticles; i < offset + LocalNumberOfActiveParticles; i++) {
 	    LocalActiveParticlesOfThisType[i] = LocalActiveParticlesOnThisLevel[i - LocalNumberOfActiveParticles];
 
 	  LocalNumberOfActiveParticles += LocalNumberOfActiveParticlesOnThisLevel;