yt.geometry.particle_oct_container module

Oct container tuned for Particles

class yt.geometry.particle_oct_container.ParticleBitmap

Bases: object

bitmasks
check()
check_bitmasks()
collisions
construct_octree(index, io_handler, data_files, num_zones, selector_mask, base_mask=None)
count_coarse(ifile)

Get the number of coarse cells set for a file.

count_refined(ifile)

Get the number of cells refined for a file.

count_total(ifile)

Get the total number of cells set for a file.

counts
file_ownership_mask(fid)
filemasks2addfiles(file_masks)
finalize()
find_collisions(verbose=False)
find_collisions_coarse(verbose=False, file_list=None)
find_collisions_refined(verbose=False)
find_contaminated(ifile, mask, mask2=None)
find_uncontaminated(ifile, mask, mask2=None)
get_DLE()
get_DRE()
get_bitmasks()
get_ghost_zones(selector, ngz, dmask=None, coarse_ghosts=False)
identify_data_files(selector, ngz=0)
identify_file_masks(selector)
index_order1
index_order2
iseq_bitmask(solf)
load_bitmasks(fname)
mask2filemasks(cmask, file_idx)
mask2files(cmask)
mask_to_files(mm_s)
masks
masks_to_files(mm_s, mm_g)
max_count
nfiles
particle_counts
primary_indices()
print_info()
reset_bitmasks()
save_bitmasks(fname, max_hsml)
selector2mask(selector)
update_mi2(characteristic_size, max_index_order2=6)

mi2 is the refined morton index order; mi2 is thus the definition of the size of the refined index objects we stick inside any collisions at the coarse level. This takes a characteristic size and attempts to compute the mi2 such that the cell is roughly equivalent to the characteristic size. It will return whether or not it was able to update; if the mi2 has already been used, it does not update. There are cases where the maximum index_order2 that it would compute would be extremely fine, which can do really bad things to memory. So we allow the setting of a maximum value, which it won’t exceed.

class yt.geometry.particle_oct_container.ParticleBitmapOctreeContainer

Bases: SparseOctreeContainer

add(indices, order1, domain_id=-1)
allocate_domains(counts=None)
domain_count(selector)
domain_identify(selector)
domain_ind(selector, domain_id=-1)
domains
fcoords(selector, num_cells=-1, domain_id=-1)
file_index_octs(selector, domain_id, num_cells=-1)
file_index_octs_with_ghost_zones(selector, domain_id, num_cells=1, n_ghost_zones=1)

Similar as file_index_octs, but returns the level, cell index, file index and domain of the neighbouring cells as well.

Parameters:
  • selector (SelectorObject) – The selector object. It is expected to select all cells for a given oct.

  • domain_id (int) – The domain to select. Set to -1 to select all domains.

  • num_cells (int, optional) – The total number of cells (accounting for a 1-cell thick ghost zone layer).

Returns:

  • levels (uint8, shape (num_cells,)) – The level of each cell of the super oct

  • cell_inds (uint8, shape (num_cells, )) – The index of each cell of the super oct within its own oct

  • file_inds (int64, shape (num_cells, )) – The on-file position of the cell. See notes below.

  • domains (int32, shape (num_cells)) – The domain to which the cells belongs. See notes below.

Notes

The algorithm constructs a “super-oct” around each oct (see sketch below, where the original oct cells are marked with an x).

Note that for sparse octrees (such as RAMSES’), the neighbouring cells may belong to another domain (this is stored in domains). If the dataset provides buffer zones between domains (such as RAMSES), this may be stored locally and can be accessed directly.

x

x

x

x

fill_index(selector=<yt.geometry.selection_routines.AlwaysSelector object>)

Get the on-file index of each cell

fill_level(level, levels, cell_inds, file_inds, dest_fields, source_fields, offset=0)
fill_level_with_domain(level, levels, cell_inds, file_inds, domains, dest_fields, source_fields, domain, offset=0)

Similar to fill_level but accepts a domain argument.

This is particularly useful for frontends that have buffer zones at CPU boundaries. These buffer oct cells have a different domain than the local one and are usually not read, but one has to read them e.g. to compute ghost zones.

fill_octcellindex_neighbours(selector, num_octs=-1, domain_id=-1, n_ghost_zones=1)

Compute the oct and cell indices of all the cells within all selected octs, extended by one cell in all directions (for ghost zones computations).

Parameters:
  • selector (SelectorObject) – Selector for the octs to compute neighbour of

  • num_octs (int, optional) – The number of octs to read in

  • domain_id (int, optional) – The domain to perform the selection over

Returns:

  • oct_inds (int64 ndarray (nocts*8, )) – The on-domain index of the octs containing each cell

  • cell_inds (uint8 ndarray (nocts*8, )) – The index of the cell in its parent oct

Note

oct_inds/cell_inds

fill_style
finalize()
fwidth(selector, num_cells=-1, domain_id=-1)
get_index_base_octs(domain_ind)
icoords(selector, num_cells=-1, domain_id=-1)
ires(selector, num_cells=-1, domain_id=-1)
classmethod load_octree(header)
locate_positions(positions)

This routine, meant to be called by other internal routines, returns a list of oct IDs and a dictionary of Oct info for all the positions supplied. Positions must be in code_length.

mask(selector, num_cells=-1, domain_id=-1)
max_level
morton_index_octs(selector, domain_id, num_cells=-1)
n_ref
nocts
num_domains
oct_arrays
overlap_cells
save_octree()
selector_fill(selector, source, dest=None, offset=0, dims=1, domain_id=-1)
class yt.geometry.particle_oct_container.ParticleBitmapSelector

Bases: object

fill_masks(mm_s, mm_g=None)
find_files(file_mask_p, file_mask_g)
class yt.geometry.particle_oct_container.ParticleOctreeContainer

Bases: OctreeContainer

add(indices, order=20)
allocate_domains(domain_counts)
allocate_root()
apply_domain(domain_id, mask, masklevel)
clear_fileind()
domain_count(selector)
domain_identify(selector)
domain_ind(selector, domain_id=-1, mask=None, masklevel=99)
domains
fcoords(selector, num_cells=-1, domain_id=-1)
file_index_octs(selector, domain_id, num_cells=-1)
file_index_octs_with_ghost_zones(selector, domain_id, num_cells=1, n_ghost_zones=1)

Similar as file_index_octs, but returns the level, cell index, file index and domain of the neighbouring cells as well.

Parameters:
  • selector (SelectorObject) – The selector object. It is expected to select all cells for a given oct.

  • domain_id (int) – The domain to select. Set to -1 to select all domains.

  • num_cells (int, optional) – The total number of cells (accounting for a 1-cell thick ghost zone layer).

Returns:

  • levels (uint8, shape (num_cells,)) – The level of each cell of the super oct

  • cell_inds (uint8, shape (num_cells, )) – The index of each cell of the super oct within its own oct

  • file_inds (int64, shape (num_cells, )) – The on-file position of the cell. See notes below.

  • domains (int32, shape (num_cells)) – The domain to which the cells belongs. See notes below.

Notes

The algorithm constructs a “super-oct” around each oct (see sketch below, where the original oct cells are marked with an x).

Note that for sparse octrees (such as RAMSES’), the neighbouring cells may belong to another domain (this is stored in domains). If the dataset provides buffer zones between domains (such as RAMSES), this may be stored locally and can be accessed directly.

x

x

x

x

fill_index(selector=<yt.geometry.selection_routines.AlwaysSelector object>)

Get the on-file index of each cell

fill_level(level, levels, cell_inds, file_inds, dest_fields, source_fields, offset=0)
fill_level_with_domain(level, levels, cell_inds, file_inds, domains, dest_fields, source_fields, domain, offset=0)

Similar to fill_level but accepts a domain argument.

This is particularly useful for frontends that have buffer zones at CPU boundaries. These buffer oct cells have a different domain than the local one and are usually not read, but one has to read them e.g. to compute ghost zones.

fill_octcellindex_neighbours(selector, num_octs=-1, domain_id=-1, n_ghost_zones=1)

Compute the oct and cell indices of all the cells within all selected octs, extended by one cell in all directions (for ghost zones computations).

Parameters:
  • selector (SelectorObject) – Selector for the octs to compute neighbour of

  • num_octs (int, optional) – The number of octs to read in

  • domain_id (int, optional) – The domain to perform the selection over

Returns:

  • oct_inds (int64 ndarray (nocts*8, )) – The on-domain index of the octs containing each cell

  • cell_inds (uint8 ndarray (nocts*8, )) – The index of the cell in its parent oct

Note

oct_inds/cell_inds

fill_style
finalize(domain_id=0)
fwidth(selector, num_cells=-1, domain_id=-1)
icoords(selector, num_cells=-1, domain_id=-1)
ires(selector, num_cells=-1, domain_id=-1)
classmethod load_octree(header)
locate_positions(positions)

This routine, meant to be called by other internal routines, returns a list of oct IDs and a dictionary of Oct info for all the positions supplied. Positions must be in code_length.

mask(selector, num_cells=-1, domain_id=-1)
max_level
morton_index_octs(selector, domain_id, num_cells=-1)
n_ref
nocts
num_domains
oct_arrays
recursively_count()
save_octree()
selector_fill(selector, source, dest=None, offset=0, dims=1, domain_id=-1)