[yt-users] total number of cells
Matthew Turk
matthewturk at gmail.com
Sat Jun 5 11:25:30 PDT 2010
Hi Stephen,
Total number of cells, including duplicated:
pf.h.print_stats()
which will also output by-level. You can also get this by doing:
pf.h.grid_dimensions.prod(axis=1).sum()
For non-duplicated, the most straightforward way would be:
total = 0
for g in pf.h.grids:
total += g.child_mask.sum()
g.clear_data()
The g.clear_data is necessary to avoid accumulating child masks. If
you don't mind accumulating them:
total = sum( g.child_mask.sum() for g in pf.h.grids )
-Matt
On Sat, Jun 5, 2010 at 11:19 AM, Stephen Skory <stephenskory at yahoo.com> wrote:
> Hi All,
>
> what's the easiest way to get the number of cells in a simulation? Thanks!
> _______________________________________________________
> sskory at physics.ucsd.edu o__ Stephen Skory
> http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student
> ________________________________(_)_\(_)_______________
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
More information about the yt-users
mailing list