class
Phase::RegionIterator(I)
- Phase::RegionIterator(I)
- Reference
- Object
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
- Iterator(Phase::IndexRegion(I))
Defined in:
iterators/region_iterator.crConstructors
-
.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
- .new(src_shape : Indexable(I), chunk_shape : Shape(I), strides : Coord | Nil = nil, degeneracy = nil, fringe_behaviour : FringeBehaviour = FringeBehaviour::DISCARD)
Instance Method Summary
-
#clone
Returns a copy of
selfwith all instance variables cloned. -
#next
Returns the next element in this iterator, or
Iterator::Stop::INSTANCEif there are no more elements. - #reset(*args, **options)
- #reset(*args, **options, &)
- #unsafe_next
Constructor Detail
TODO iter inputs, etc
Instance Method Detail
Returns the next element in this iterator, or Iterator::Stop::INSTANCE if there
are no more elements.