mpi_array.indexing.HaloIndexingExtent¶
-
class
mpi_array.indexing.HaloIndexingExtent(slice=None, start=None, stop=None, halo=None, struct=None)[source]¶ Bases:
mpi_array.indexing.IndexingExtentIndexing bounds with ghost (halo) elements, for a single tile of domain decomposition.
Example:
>>> from mpi_array.indexing import HaloIndexingExtent >>> >>> hie = HaloIndexingExtent(start=(10,), stop=(20,), halo=((2,4),)) >>> print("hie.start_n = %s" % (hie.start_n,)) # start without halo hie.start_n = [10] >>> print("hie.start_h = %s" % (hie.start_h,)) # start with halo hie.start_h = [8] >>> print("hie.stop_n = %s" % (hie.stop_n,)) # stop without halo hie.stop_n = [20] >>> print("hie.stop_h = %s" % (hie.stop_h,)) # stop with halo hie.stop_h = [24]
Methods
__init__([slice, start, stop, halo, struct])Construct. calc_intersection(other)Returns the indexing extent which is the intersection of this extent with the otherextent.calc_intersection_split(other)Returns (leftovers, intersection)pair, whereintersectionis theIndexingExtentobject (possiblyNone) indicating the intersection of this (self) extent with theotherextent andleftoversis a list ofIndexingExtentobjects indicating regions ofselfwhich do not intersect with theotherextent.create_struct_dtype_from_ndim(ndim)Creates a numpy.dtypestructure for holding start and stop indices.create_struct_instance(ndim)Creates a struct instance with numpy.dtypeself.struct_dtype_dict[ndim].get_struct_dtype(ndim)get_struct_dtype_from_ndim(ndim)globale_to_locale_extent_h(gext)Return gextconverted to locale index.globale_to_locale_h(gidx)Convert globale array index to locale array index. globale_to_locale_n(gidx)Convert globale array index to locale array index. globale_to_locale_slice_h(gslice)Return gsliceconverted to locale slice.globale_to_locale_slice_n(gslice)Return gsliceconverted to locale slice.locale_to_globale_extent_h(lext)Return lextconverted to globale index.locale_to_globale_h(lidx)Convert locale array index to globale array index. locale_to_globale_n(lidx)Convert locale array index to globale array index. locale_to_globale_slice_h(lslice)Return lsliceconverted to globale slice.locale_to_globale_slice_n(lslice)Return lsliceconverted to globale slice.split(a, index)Split this extent into two extents by cutting along axis aat indexindex.to_slice()Same as to_slice_n().to_slice_h()Returns “ tupleofslice” equivalent of this indexing extent including halo.to_slice_n()Returns “ tupleofslice” equivalent of this indexing extent without halo (“no halo”).to_tuple()Convert this instance to a tuplewhich can be passed to constructor (or used as adictkey).Attributes
HALOHALO_STRHIThe “high index” indices. LOThe “low index” indices. STARTSTART_NSTART_N_STRSTART_STRSTOPSTOP_NSTOP_N_STRSTOP_STRhaloA (len(self.start), 2)shaped array ofintindicating the per-axis number of outer ghost elements.ndimDimension of indexing. shapeSame as shape_n.shape_hThe shape of the tile with “halo” elements. shape_nThe shape of the tile without “halo” elements (“no halo”). size_hInteger indicating the number of elements in this extent including halo. size_nInteger indicating the number of elements in this extent without halo (“no halo”) startSame as start_n.start_hThe start index of the tile with “halo” elements. start_nThe start index of the tile without “halo” elements (“no halo”). stopSame as stop_n.stop_hThe stop index of the tile with “halo” elements. stop_nThe stop index of the tile without “halo” elements (“no halo”). struct_dtype_dict