Alsvinn  0.5.3
The fast FVM simulator with UQ support
Public Member Functions | Public Attributes | List of all members
alsfvm::memory::View< T > Class Template Reference

#include <alsfvm/memory/View.hpp>

Public Member Functions

__device__ __host__ View (T *pointer, size_t nx, size_t ny, size_t nz, size_t extentXInBytes, size_t extentYInBytes)
 View constructs the View. More...
 
__device__ __host__ T & at (size_t x, size_t y, size_t z)
 at returns a reference to the element at the given location More...
 
__device__ __host__ const T & at (size_t x, size_t y, size_t z) const
 at returns a reference to the element at the given location (const version) More...
 
__device__ __host__ T & at (size_t index)
 at returns the reference to the element index by the single value index More...
 
__device__ __host__ const T & at (size_t index) const
 at returns the reference to the element index by the single value index More...
 
__device__ __host__ size_t size () const
 
__device__ __host__ size_t index (size_t x, size_t y, size_t z) const
 index computes the linear index of the given cell More...
 
__device__ __host__ size_t getNumberOfXCells () const
 
__device__ __host__ size_t getNumberOfYCells () const
 
__device__ __host__ size_t getNumberOfZCells () const
 

Public Attributes

const size_t nx
 
const size_t ny
 
const size_t nz
 

Detailed Description

template<class T>
class alsfvm::memory::View< T >

View is raw view to the memory area. It will only contain the most basic functionality. This is ideal for use in an inner loop.

The View class is not meant for memory management, it will not delete its pointer on scope exit.

Constructor & Destructor Documentation

◆ View()

template<class T>
__device__ __host__ alsfvm::memory::View< T >::View ( T *  pointer,
size_t  nx,
size_t  ny,
size_t  nz,
size_t  extentXInBytes,
size_t  extentYInBytes 
)
inline

View constructs the View.

Parameters
pointerraw pointer to the data.
nxthe number of elements in x direction (in number of T's) (used for bounds checking)
nythe number of elements in y direction (in number of T's) (used for bounds checking)
nzthe number of elements in z direction (in number of T's) (used for bounds checking)
extentXInBytesthe extent in X direction (used for indexing)
extentYInBytesthe extent in Y direction (used for indexing)

Member Function Documentation

◆ at() [1/4]

template<class T>
__device__ __host__ T& alsfvm::memory::View< T >::at ( size_t  x,
size_t  y,
size_t  z 
)
inline

at returns a reference to the element at the given location

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
Returns
the reference to the element at the given location.

◆ at() [2/4]

template<class T>
__device__ __host__ const T& alsfvm::memory::View< T >::at ( size_t  x,
size_t  y,
size_t  z 
) const
inline

at returns a reference to the element at the given location (const version)

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
Returns
the reference to the element at the given location.

◆ at() [3/4]

template<class T>
__device__ __host__ T& alsfvm::memory::View< T >::at ( size_t  index)
inline

at returns the reference to the element index by the single value index

Parameters
index
Returns

◆ at() [4/4]

template<class T>
__device__ __host__ const T& alsfvm::memory::View< T >::at ( size_t  index) const
inline

at returns the reference to the element index by the single value index

Parameters
index
Returns

◆ getNumberOfXCells()

template<class T>
__device__ __host__ size_t alsfvm::memory::View< T >::getNumberOfXCells ( ) const
inline

◆ getNumberOfYCells()

template<class T>
__device__ __host__ size_t alsfvm::memory::View< T >::getNumberOfYCells ( ) const
inline

◆ getNumberOfZCells()

template<class T>
__device__ __host__ size_t alsfvm::memory::View< T >::getNumberOfZCells ( ) const
inline

◆ index()

template<class T>
__device__ __host__ size_t alsfvm::memory::View< T >::index ( size_t  x,
size_t  y,
size_t  z 
) const
inline

index computes the linear index of the given cell

Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate
Returns
the linear index

◆ size()

template<class T>
__device__ __host__ size_t alsfvm::memory::View< T >::size ( ) const
inline

Member Data Documentation

◆ nx

template<class T>
const size_t alsfvm::memory::View< T >::nx

◆ ny

template<class T>
const size_t alsfvm::memory::View< T >::ny

◆ nz

template<class T>
const size_t alsfvm::memory::View< T >::nz

The documentation for this class was generated from the following file: