public @optmath Slice!(FieldIterator!Field, N) slicedField(Field, size_t N)(
    Field field, 
    size_t[N] lengths...) 
if(N)

Creates an n-dimensional slice-shell over a field.

Parameters

field

A field. The length of the array should be equal to or less then the product of lengths.

lengths

A list of lengths for each dimension.

Returns

n-dimensional slice


public @optmath slicedField(Field)(Field field) 
if(hasLength!Field)

Creates an n-dimensional slice-shell over a field.

Parameters

field

A field. The length of the array should be equal to or less then the product of lengths.

lengths

A list of lengths for each dimension.

Returns

n-dimensional slice

Example

Creates an 1-dimensional slice over a field, array, or random access range.

import mir.ndslice.topology : iota;
auto slice = 10.iota.slicedField;
assert(slice.length == 10);