class Phase::RegionIterator(I)

Overview

RegionIterator iterates over all IndexRegions with a given chunk_shape whose coordinates lie within a given src_shape. For example:

iter = RegionIterator.new(src_shape: [2, 5], chunk_shape: [1, 2]) # the parameter names are only included for clarity
iter.next # => [0..0, 0..1]
iter.next # => [0..0, 2..3]
iter.next # => [1..1, 0..1]
iter.next # => [1..1, 2..3]

The example above is very simple in that it leaves most of the options as their defaults. Notice that the regions produced have no overlap - this is because the default vertex stride is equal to the chunk shape.

RegionIterator also provides ways to control the iteration order, its behaviour at the boundary (note that in the above example, column 4 is totally excluded because two columns did not evenly divide five), and dimension dropping (see IndexRegion for details).

Included Modules

Defined in:

iterators/region_iterator.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(src_shape : Shape(I), chunk_shape : Shape(I), strides : Coord | Nil = nil, degeneracy = nil, fringe_behaviour : FringeBehaviour = FringeBehaviour::DISCARD, &block : IndexRegion(I) -> Iterator(Indexable(I))) #

TODO iter inputs, etc


[View source]
def self.new(src_shape : Indexable(I), chunk_shape : Shape(I), strides : Coord | Nil = nil, degeneracy = nil, fringe_behaviour : FringeBehaviour = FringeBehaviour::DISCARD) #

[View source]

Instance Method Detail

def clone #

Returns a copy of self with all instance variables cloned.


[View source]
def next #
Description copied from module Iterator(Phase::IndexRegion(I))

Returns the next element in this iterator, or Iterator::Stop::INSTANCE if there are no more elements.


[View source]
def reset(*args, **options) #

[View source]
def reset(*args, **options, &) #

[View source]
def unsafe_next #

[View source]