[yt-svn] commit/yt-3.0: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Nov 8 10:35:01 PST 2013
2 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/4767e46461c0/
Changeset: 4767e46461c0
Branch: yt-3.0
User: ngoldbaum
Date: 2013-11-07 00:53:03
Summary: Fixes for active particle i/o.
Affected #: 2 files
diff -r 67fab8ea9ea6841dae5b9000537f2ed4575fff3d -r 4767e46461c0bb35e0190155a23aaba95d6d7ce8 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -122,7 +122,10 @@
@property
def NumberOfActiveParticles(self):
if not hasattr(self.hierarchy, "grid_active_particle_count"): return 0
- return self.hierarchy.grid_active_particle_count[self.id - self._id_offset]
+ id = self.id - self._id_offset
+ nap = dict((ptype, self.hierarchy.grid_active_particle_count[ptype][id]) \
+ for ptype in self.hierarchy.grid_active_particle_count)
+ return nap
class EnzoGridInMemory(EnzoGrid):
__slots__ = ['proc_num']
@@ -322,11 +325,9 @@
super(EnzoHierarchy, self)._initialize_grid_arrays()
if "AppendActiveParticleType" in self.parameters.keys() and \
len(self.parameters["AppendActiveParticleType"]):
- pdtype = [(ptype, 'i4') for ptype in
- self.parameters["AppendActiveParticleType"]]
- else:
- pdtype = None
- self.grid_active_particle_count = np.zeros(self.num_grids, dtype=pdtype)
+ gac = dict((ptype, np.zeros(self.num_grids, dtype='i4')) \
+ for ptype in self.parameters["AppendActiveParticleType"])
+ self.grid_active_particle_count = gac
def _fill_arrays(self, ei, si, LE, RE, npart, nap):
self.grid_dimensions.flat[:] = ei
diff -r 67fab8ea9ea6841dae5b9000537f2ed4575fff3d -r 4767e46461c0bb35e0190155a23aaba95d6d7ce8 yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -63,7 +63,9 @@
if f is None:
#print "Opening (count) %s" % g.filename
f = h5py.File(g.filename, "r")
- if g.NumberOfParticles == 0: continue
+ nap = sum(g.NumberOfActiveParticles.values())
+ if g.NumberOfParticles == 0 and nap == 0:
+ continue
ds = f.get("/Grid%08i" % g.id)
for ptype, field_list in sorted(ptf.items()):
if ptype != "io":
@@ -87,7 +89,9 @@
if f is None:
#print "Opening (read) %s" % g.filename
f = h5py.File(g.filename, "r")
- if g.NumberOfParticles == 0: continue
+ nap = sum(g.NumberOfActiveParticles.values())
+ if g.NumberOfParticles == 0 and nap == 0:
+ continue
ds = f.get("/Grid%08i" % g.id)
for ptype, field_list in sorted(ptf.items()):
if ptype != "io":
https://bitbucket.org/yt_analysis/yt-3.0/commits/f5643d2a09f8/
Changeset: f5643d2a09f8
Branch: yt-3.0
User: ngoldbaum
Date: 2013-11-08 01:54:40
Summary: Ensure that active particle entries in particle_list do not get clobbered.
Affected #: 1 file
diff -r 4767e46461c0bb35e0190155a23aaba95d6d7ce8 -r f5643d2a09f83ba186599100c3fbcbdbb6329677 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -839,14 +839,14 @@
self.current_redshift = self.omega_lambda = self.omega_matter = \
self.hubble_constant = self.cosmological_simulation = 0.0
self.particle_types = ["io"]
- for ptype in self.parameters.get("AppendActiveParticleType", []):
- self.particle_types.append(ptype)
if self.parameters["NumberOfParticles"] > 0 and \
"AppendActiveParticleType" in self.parameters.keys():
# If this is the case, then we know we should have a DarkMatter
# particle type, and we don't need the "io" type.
self.particle_types = ["DarkMatter"]
self.parameters["AppendActiveParticleType"].append("DarkMatter")
+ for ptype in self.parameters.get("AppendActiveParticleType", []):
+ self.particle_types.append(ptype)
self.particle_types = tuple(self.particle_types)
if self.dimensionality == 1:
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list