Enum ocl::SpatialDims [−][src]
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(usize, usize)
Three(usize, usize, usize)
Methods
impl SpatialDims
[src]
impl SpatialDims
pub fn new(
d0: Option<usize>,
d1: Option<usize>,
d2: Option<usize>
) -> OclResult<SpatialDims>
[src]
pub fn new(
d0: Option<usize>,
d1: Option<usize>,
d2: Option<usize>
) -> OclResult<SpatialDims>
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]
pub fn dim_count(&self) -> u32
Returns the number of dimensions defined by this SpatialDims
.
pub fn to_lens(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>
[src]
pub fn to_lens(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>
Returns a 3D size or an error if unspecified.
pub fn to_offset(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>
[src]
pub fn to_offset(&self) -> Result<[usize; 3], UnspecifiedDimensionsError>
Returns a 3D offset or an error if unspecified.
pub fn to_len(&self) -> usize
[src]
pub fn to_len(&self) -> usize
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]
pub fn try_to_padded_len(&self, incr: usize) -> OclResult<usize>
Takes the length and rounds it up to the nearest incr
or an error.
pub fn is_unspecified(&self) -> bool
[src]
pub fn is_unspecified(&self) -> bool
Returns true
if this SpatialDims
is an Unspecified
variant.
Trait Implementations
impl Clone for SpatialDims
[src]
impl Clone for SpatialDims
fn clone(&self) -> SpatialDims
[src]
fn clone(&self) -> SpatialDims
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for SpatialDims
[src]
impl Debug for SpatialDims
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Copy for SpatialDims
[src]
impl Copy for SpatialDims
impl PartialEq for SpatialDims
[src]
impl PartialEq for SpatialDims
fn eq(&self, other: &SpatialDims) -> bool
[src]
fn eq(&self, other: &SpatialDims) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &SpatialDims) -> bool
[src]
fn ne(&self, other: &SpatialDims) -> bool
This method tests for !=
.
impl Eq for SpatialDims
[src]
impl Eq for SpatialDims
impl MemLen for SpatialDims
[src]
impl MemLen for SpatialDims
fn to_len_padded(&self, incr: usize) -> usize
[src]
fn to_len_padded(&self, incr: usize) -> usize
Returns the length of a volume of memory padded to the next multiple of incr
. Read more
fn to_len(&self) -> usize
[src]
fn to_len(&self) -> usize
Returns the exact number of elements of a volume of memory (equivalent to Vec::len()
). Read more
fn to_lens(&self) -> [usize; 3]
[src]
fn to_lens(&self) -> [usize; 3]
Returns the exact lengths of each dimension of a volume of memory.
impl WorkDims for SpatialDims
[src]
impl WorkDims for SpatialDims
fn dim_count(&self) -> u32
[src]
fn dim_count(&self) -> u32
Returns the number of dimensions defined.
fn to_work_size(&self) -> Option<[usize; 3]>
[src]
fn to_work_size(&self) -> Option<[usize; 3]>
Returns an array representing the amount of work to be done by a kernel. Read more
fn to_work_offset(&self) -> Option<[usize; 3]>
[src]
fn to_work_offset(&self) -> Option<[usize; 3]>
Returns an array representing the offset of a work item or memory location. Read more
impl Index<usize> for SpatialDims
[src]
impl Index<usize> for SpatialDims
type Output = usize
The returned type after indexing.
fn index(&self, index: usize) -> &usize
[src]
fn index(&self, index: usize) -> &usize
Performs the indexing (container[index]
) operation.
impl<'a> From<&'a SpatialDims> for SpatialDims
[src]
impl<'a> From<&'a SpatialDims> for SpatialDims
fn from(sd: &'a SpatialDims) -> SpatialDims
[src]
fn from(sd: &'a SpatialDims) -> SpatialDims
Performs the conversion.
impl From<usize> for SpatialDims
[src]
impl From<usize> for SpatialDims
fn from(val: usize) -> SpatialDims
[src]
fn from(val: usize) -> SpatialDims
Performs the conversion.
impl From<isize> for SpatialDims
[src]
impl From<isize> for SpatialDims
fn from(val: isize) -> SpatialDims
[src]
fn from(val: isize) -> SpatialDims
Performs the conversion.
impl From<u32> for SpatialDims
[src]
impl From<u32> for SpatialDims
fn from(val: u32) -> SpatialDims
[src]
fn from(val: u32) -> SpatialDims
Performs the conversion.
impl From<i32> for SpatialDims
[src]
impl From<i32> for SpatialDims
fn from(val: i32) -> SpatialDims
[src]
fn from(val: i32) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<(T,)> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<(T,)> for SpatialDims
fn from(val: (T,)) -> SpatialDims
[src]
fn from(val: (T,)) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T,)> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T,)> for SpatialDims
fn from(val: &(T,)) -> SpatialDims
[src]
fn from(val: &(T,)) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 1]> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 1]> for SpatialDims
fn from(val: [T; 1]) -> SpatialDims
[src]
fn from(val: [T; 1]) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 1]> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 1]> for SpatialDims
fn from(val: &[T; 1]) -> SpatialDims
[src]
fn from(val: &[T; 1]) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T)> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T)> for SpatialDims
fn from(pair: (T, T)) -> SpatialDims
[src]
fn from(pair: (T, T)) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T)> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T)> for SpatialDims
fn from(pair: &(T, T)) -> SpatialDims
[src]
fn from(pair: &(T, T)) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 2]> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 2]> for SpatialDims
fn from(pair: [T; 2]) -> SpatialDims
[src]
fn from(pair: [T; 2]) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 2]> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 2]> for SpatialDims
fn from(pair: &[T; 2]) -> SpatialDims
[src]
fn from(pair: &[T; 2]) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T, T)> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<(T, T, T)> for SpatialDims
fn from(set: (T, T, T)) -> SpatialDims
[src]
fn from(set: (T, T, T)) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T, T)> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a (T, T, T)> for SpatialDims
fn from(set: &(T, T, T)) -> SpatialDims
[src]
fn from(set: &(T, T, T)) -> SpatialDims
Performs the conversion.
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 3]> for SpatialDims
[src]
impl<T: Num + ToPrimitive + Debug + Copy> From<[T; 3]> for SpatialDims
fn from(set: [T; 3]) -> SpatialDims
[src]
fn from(set: [T; 3]) -> SpatialDims
Performs the conversion.
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 3]> for SpatialDims
[src]
impl<'a, T: Num + ToPrimitive + Debug + Copy> From<&'a [T; 3]> for SpatialDims
fn from(set: &[T; 3]) -> SpatialDims
[src]
fn from(set: &[T; 3]) -> SpatialDims
Performs the conversion.
Auto Trait Implementations
impl Send for SpatialDims
impl Send for SpatialDims
impl Sync for SpatialDims
impl Sync for SpatialDims