pub struct GridPos { /* private fields */ }Expand description
Context for grid position within a stencil kernel.
This is a marker type that gets translated to CUDA index calculations. In Rust, it provides the API; in generated CUDA, it becomes inline code.
Implementations§
Source§impl GridPos
impl GridPos
Sourcepub fn north<T: Copy>(&self, _buf: &[T]) -> T
pub fn north<T: Copy>(&self, _buf: &[T]) -> T
Access the north neighbor (y - 1).
In CUDA: buf[idx - buffer_width]
Sourcepub fn south<T: Copy>(&self, _buf: &[T]) -> T
pub fn south<T: Copy>(&self, _buf: &[T]) -> T
Access the south neighbor (y + 1).
In CUDA: buf[idx + buffer_width]
Sourcepub fn east<T: Copy>(&self, _buf: &[T]) -> T
pub fn east<T: Copy>(&self, _buf: &[T]) -> T
Access the east neighbor (x + 1).
In CUDA: buf[idx + 1]
Sourcepub fn west<T: Copy>(&self, _buf: &[T]) -> T
pub fn west<T: Copy>(&self, _buf: &[T]) -> T
Access the west neighbor (x - 1).
In CUDA: buf[idx - 1]
Sourcepub fn at<T: Copy>(&self, _buf: &[T], _dx: i32, _dy: i32) -> T
pub fn at<T: Copy>(&self, _buf: &[T], _dx: i32, _dy: i32) -> T
Access a neighbor at arbitrary offset.
In CUDA: buf[idx + dy * buffer_width + dx]
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GridPos
impl RefUnwindSafe for GridPos
impl Send for GridPos
impl Sync for GridPos
impl Unpin for GridPos
impl UnwindSafe for GridPos
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more