Ramses cell counting and hierarchy
Hi Oliver and others, I've spent a bit of time working on the Ramses reader. In the test cases I have, it's now going ~2.6x faster than it was this morning. But it still takes a long time. Right now the top routines are, all in the ramses frontend directory: _count_grids recursive_patch_splitting fill_hierarchy_arrays count_zones The last one, I had some questions about. It counts up the number of unique zones on each level, which is actually seeming to take a lot longer than I think it ought need to. I do this by iterating over all the RAMSES_tree objects, then over each level in the tree, then over each cell and incrementing a counter if cell.get_domain() == idomain. The code looks something like this, but keep in mind this is Cython: cdef np.ndarray[np.int64_t, ndim=1] cell_count cell_count = np.zeros(self.rsnap.m_header.levelmax + 1, 'int64') cdef int local_count = 0 for idomain in range(1, self.rsnap.m_header.ncpu + 1): local_tree = new RAMSES_tree(deref(self.rsnap), idomain, self.rsnap.m_header.levelmax, 0) local_tree.read() for ilevel in range(local_tree.m_maxlevel + 1): local_count = 0 local_level = &local_tree.m_AMR_levels[ilevel] grid_it = local_tree.begin(ilevel) grid_end = local_tree.end(ilevel) while grid_it != grid_end: local_count += (grid_it.get_domain() == idomain) grid_it.next() cell_count[ilevel] += local_count del local_tree Ultimately, this takes up a LOT of time. I was wondering if there was a simpler way of figuring out, simply, how many cells are local to a given domain and a given level. All I need back is an array that includes the *total* unique cells on every level, summed across domains. Any ideas? (Also, I've gotten a 2.6 speedup; hoping for more later today. Then after the regridding is fast, I will attack IO.) Thanks, Matt
participants (2)
-
Matthew Turk
-
Stephen Skory