ppmd.coulomb.octal module¶
-
class
ppmd.coulomb.octal.
EntryData
(tree, ncomp, dtype=<class 'ctypes.c_double'>)¶ Bases:
object
-
add_onto
(octal_data_tree)¶ add data onto a OctalDataTree of mode=’halo’ :param octal_data_tree:
-
extract_from
(octal_data_tree)¶ Extract data from a OctalDataTree of mode=’plain’ :param octal_data_tree:
-
zero
()¶
-
-
class
ppmd.coulomb.octal.
OctalDataTree
(tree, ncomp, mode=None, dtype=<class 'ctypes.c_double'>)¶ Bases:
object
-
halo_exchange_level
(level)¶
-
num_cells
(start=0, end=None)¶
-
zero
()¶ Zero all stored data.
-
-
class
ppmd.coulomb.octal.
OctalGridLevel
(level, parent_comm, entry_map=None)¶ Bases:
object
-
free
()¶
-
global_to_local
¶ Map from global cube index to local cube index
-
global_to_local_halo
¶ Map from global cube index to local cube index with halos
-
global_to_local_parent
¶ Map from global cube index to local parent index
-
grid_cube_size
¶ Size of grid plus halos
-
halo_exchange
(arr)¶ Halo exchange the passed numpy array of shape self.grid_cube_size. :param arr: numpy array to exchange.
-
local_grid_cube_size
¶ Size of grid
-
local_grid_offset
¶ Offset in global coodinates to the local sub-domain
-
owners
¶ Map from global cube index to owning MPI rank
-
parent_local_size
¶ Size of parent grid with matching ownership
-
-
ppmd.coulomb.octal.
compute_interaction_lists
(local_size)¶ Compute the local interaction offset lists for a local domain. Child cubes are indexed lexicographically from 0. :param local_size: tuple of local cube domain dimensions (fast to slow) :return: 8x189 INT64 offsets numpy array.
-
ppmd.coulomb.octal.
compute_interaction_offsets
(cube_index)¶ Compute the interaction offsets for a given child cube. Child cubes are indexed with a tuple. :param cube_index: Tuple of child cube to compute offsets for. :return: numpy array type INT64 size 189x3 of offsets.
-
ppmd.coulomb.octal.
compute_interaction_plookup
()¶ Compute the 8x189 lookup table to map from offset index to recomputed spherical harmonics. Phi part.
-
ppmd.coulomb.octal.
compute_interaction_radius
()¶ Compute the coefficients such that when multiplied by the cube with they give the radius to the box centre.
-
ppmd.coulomb.octal.
compute_interaction_tlookup
()¶ Compute the 8x189 lookup table to map from offset index to recomputed spherical harmonics. Theta part.
-
ppmd.coulomb.octal.
compute_local_size_offset
(owners, dims, top)¶
-
class
ppmd.coulomb.octal.
cube_owner_map
(cart_comm, cube_side_count, group_children=False)¶ Bases:
object
Compute the global map from cube index (lexicographic) to owning MPI rank and map to MPI ranks with sub-domains of non-empty intersection with each cube.
Assumes that in each dimension ranks are assigned equal shares of the domain.
- Parameters
cart_comm – MPI cartesian communicator.
cube_side_count – Integer subdivision level of domain.
group_children – Consider cube subdivision to be the final mesh l of
an octal tree and group cubes such that all children of cubes in mesh l-1 are on the same MPI rank.
-
cart_comm
¶ Cartesian communicator used
-
static
compute_grid_ownership
(dims, top, cube_side_count, group_children=False)¶ For each dimension compute the owner and contributing ranks. Does not perform out product to compute the full map. :param dims: tuple of mpi dims. :param top: tuple of top. :param cube_side_count: int, number of cubes in each dimension :param group_children: See class doc string. :return: tuple: ranks of each cube owner, contributing ranks.
-
static
compute_map_product_contribs
(cart_comm, cube_to_mpi, dim_contribs)¶ Compute the full map from cube index to mpi rank owner, cube index to mpi ranks of contributors. :param cart_comm: MPI cart_comm to use for logical coord to rank conversion. Owner map per dimension, elements are ints. :param cube_to_mpi: ndims x cube_side_count tuple representing cube to owner map per dimension, elements are ints. :param dim_contribs: tuple ndims x cube_side_count tuple containing lists of contributors. :return:
-
static
compute_map_product_owners
(cart_comm, dim_owners)¶ Compute the full map from cube index to mpi rank owner. :param cart_comm: MPI cart_comm to use for logical coord to rank conversion. :param dim_owners: ndims x cube_side_count tuple representing cube to owner map per dimension, elements are ints. lists of contributors. :return: array, length number of cubes, cube global index to mpi rank owner.
-
contrib_mpi
¶ Array containing ranks contributing to a cube
-
contrib_starts
¶ Cube i has contributing coefficients from ranks x_s_i to x_s_{i-1} where s is contrib_starts and x is contrib_mpi
-
cube_count
¶ Total number of cubes
-
cube_side_count
¶ Side count of octal tree on domain
-
cube_to_mpi
¶ Array from cube global index to owning mpi rank
-
cube_to_send
¶ Array if this mpi rank contributes to cube i then x_i is owning rank of cube i else x_i = -1
-
ppmd.coulomb.octal.
cube_tuple_to_lin_xyz
(ii, n)¶ convert xyz tuple ii to linear index in cube of side length n. :param ii: (x,y,z) tuple. :param n: side length
-
ppmd.coulomb.octal.
cube_tuple_to_lin_zyx
(ii, n)¶ convert xyz tuple ii to linear index in cube of side length n. :param ii: (z,y,x) tuple. :param n: side length
-
ppmd.coulomb.octal.
send_parent_to_halo
(src_level, parent_data_tree, halo_data_tree)¶ Copy the data from parent mode OctalDataTree to halo mode OctalDataTree.
This function enables the movement of data up the octal tree. Data is sent from src_level to src_level - 1.
- Parameters
src_level – parent level to send into the halo level
parent_data_tree – OctalDataTree of mode parent.
halo_data_tree – OctalDataTree of mode halo
- Returns
halo_data_tree will be modified.
-
ppmd.coulomb.octal.
send_plain_to_parent
(src_level, plain_data_tree, parent_data_tree)¶ Copy the data from plain mode OctalDataTree to parent mode OctalDataTree.
This function enables the movement of data down the octal tree. Data is sent from src_level to src_level + 1.
- Parameters
src_level – plain level to send into the parent level
plain_data_tree – OctalDataTree of mode plain.
parent_data_tree – OctalDataTree of mode parent
- Returns
parent_data_tree will be modified.
-
ppmd.coulomb.octal.
shell_iterator
(width)¶ Iterator to loop over the outer shell of a cube. :param width: Number of cells between a centred cube and the outer most cube.
- width = 0 -> a single cube.
= 1 -> all cubes in a 3x3x3 block except the very middle cube.