[][src]Enum fil_ocl::SpatialDims

pub enum SpatialDims {
    Unspecified,
    One(usize),
    Two(usizeusize),
    Three(usizeusizeusize),
}

Specifies a size or offset in up to three dimensions.

Using SpatialDims to specify dimensions for your application may not be appropriate. Custom types implementing the traits MemLen and WorkDims should be created to express more complex relationships between data shape and work size for kernels which do not have a 1:1 correspondence between data set length and global work size.

[FIXME]: Describe the ways a SpatialDims can be created using various From implementations.

[UNSTABLE]: This type and its methods may be renamed or otherwise changed at any time. This is still a work in progress.

Variants

Unspecified
One(usize)
Two(usizeusize)
Three(usizeusizeusize)

Methods

impl SpatialDims[src]

pub fn new(
    d0: Option<usize>,
    d1: Option<usize>,
    d2: Option<usize>
) -> OclResult<SpatialDims>
[src]

Returns a new SpatialDims.

Dimensions must be specified in order from d0 -> d1 -> d2; i.e. d1 cannot be Some(x) if d0 is None.

Explicitly setting all zeros as values is not recommended as it is invalid to OpenCL functions. Use ::Unspecified to represent NULL instead.

pub fn dim_count(&self) -> u32[src]

Returns the number of dimensions defined by this SpatialDims.

pub fn to_lens(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>[src]

Returns a 3D size or an error if unspecified.

pub fn to_offset(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>[src]

Returns a 3D offset or an error if unspecified.

pub fn to_len(&self) -> usize[src]

Returns the product of all contained dimensional values (equivalent to a length, area, or volume) or zero if unspecified.

Check ::is_unspecified if it matters whether or not the zero length has been explicitly set however, explicitly setting all zeros as dimensions is not recommended as it is an invalid value to OpenCL functions. Use ::Unspecified to represent NULL instead.

pub fn try_to_padded_len(&self, incr: usize) -> OclResult<usize>[src]

Takes the length and rounds it up to the nearest incr or an error.

pub fn is_unspecified(&self) -> bool[src]

Returns true if this SpatialDims is an Unspecified variant.

Trait Implementations

impl WorkDims for SpatialDims[src]

impl MemLen for SpatialDims[src]

impl<'a> From<&'a SpatialDims> for SpatialDims[src]

impl From<usize> for SpatialDims[src]

impl From<isize> for SpatialDims[src]

impl From<u32> for SpatialDims[src]

impl From<i32> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<(T,)> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T,)> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 1]> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 1]> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T)> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T)> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 2]> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 2]> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T, T)> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T, T)> for SpatialDims[src]

impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 3]> for SpatialDims[src]

impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 3]> for SpatialDims[src]

impl Clone for SpatialDims[src]

impl Copy for SpatialDims[src]

impl Eq for SpatialDims[src]

impl PartialEq<SpatialDims> for SpatialDims[src]

impl Debug for SpatialDims[src]

impl Index<usize> for SpatialDims[src]

type Output = usize

The returned type after indexing.

impl StructuralPartialEq for SpatialDims[src]

impl StructuralEq for SpatialDims[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]