MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
NumCell< T, Dev > Class Template Reference
Inheritance diagram for NumCell< T, Dev >:
Collaboration diagram for NumCell< T, Dev >:

Public Member Functions

TMat & M ()
const TMat & M () const
void p2pm (cudaStream_t stream=0)
 NumCell (long nxi=0, long nyi=1)
 NumCell (long nxi, long nyi, long mx, long my, T *pin=NULL)
template<typename L>
 NumCell (long nxi, long nyi, L *mx, L *my, T *pin=NULL)
 NumCell (const NumCell &in)
NumCell & operator= (const NumCell &in)
void init (long nxi=0, long nyi=1)
NumCell New () const
void replace (T *pnew, cudaStream_t stream)
NumCell Vector () const
void Copy (const NumCell &in, cudaStream_t stream=0)
T & operator() (int ix, int iy)
const T & operator() (int ix, int iy) const
T * operator() ()
const T * operator() () const
T & operator() (int i)
const T & operator() (int i) const
long N () const
long Nx () const
long Ny () const
int NRef () const
void Zero (cudaStream_t stream=0)
void Write (cudaStream_t stream, file_t *fp) const
void Write (cudaStream_t stream, const char *format,...) const
Public Member Functions inherited from CellArray< NumArray< T, Cpu > >
void deinit ()
T & operator() (int ix, int iy)
const T & operator() (int ix, int iy) const
T * operator() ()
const T * operator() () const
T & operator() (int i)
const T & operator() (int i) const
int NRef () const
T * Col (int icol)
const T * Col (int icol) const
long Nx () const
long Ny () const
long N () const
 operator bool () const
void init (long nxi=0, long nyi=1)
CellArray Vector () const
CellArray trans (stream_t &stream)
 CellArray (long nxi, long nyi=1, T *pi=NULL, int own=1)
void Zero (cudaStream_t stream=0)
void Write (cudaStream_t stream, file_t *fp) const
Public Member Functions inherited from Array< T, CpuObj >
 ~Array ()
T & operator() (int ix, int iy)
const T & operator() (int ix, int iy) const
T & R (int ix, int iy=0)
T * Col (int icol)
const T * Col (int icol) const
long Nx () const
long Ny () const
long N () const
 operator bool () const
void init (long nxi=0, long nyi=1)
 Array ()
 Array (long nxi, long nyi=1, T *pi=NULL, int own=1)
 Array (long nxi, long nyi, const Array &pi, long offset=0)
 Array (const Array &in)
Array & operator= (const Array &in)
Array Vector () const
void deinit ()
 operator T* ()
T * operator() ()
const T * operator() () const
T & operator() (int i)
const T & operator() (int i) const
int NRef () const

Data Fields

Array< T *, Gpu > pm
Data Fields inherited from CellArray< NumArray< T, Cpu > >
string keywords
Data Fields inherited from Array< T, CpuObj >
string keywords

Protected Attributes

T * p
long nx
long ny
Protected Attributes inherited from CellArray< NumArray< T, Cpu > >
long nx
long ny
T * p
Protected Attributes inherited from Array< T, CpuObj >
long nx
long ny
T * p

Additional Inherited Members

Public Types inherited from Array< T, CpuObj >
typedef T type

Detailed Description

template<typename T, template< typename > class Dev = Cpu>
class NumCell< T, Dev >

NumCell is a special Array of array of numerical data that can store multiple Arrays of numerical data in continuous region.

Constructor & Destructor Documentation

◆ NumCell() [1/4]

template<typename T, template< typename > class Dev = Cpu>
NumCell< T, Dev >::NumCell ( long nxi = 0,
long nyi = 1 )

Create a cell array with empty blocks.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.

◆ NumCell() [2/4]

template<typename T, template< typename > class Dev = Cpu>
NumCell< T, Dev >::NumCell ( long nxi,
long nyi,
long mx,
long my,
T * pin = NULL )

Create a cell array with blocks of the same size in continuous memory.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.
[in]mxNumber of rows of each block.
[in]myNumber of columns of each block.
[in]pinExisting memory to use (not owned). Allocated if NULL.

◆ NumCell() [3/4]

template<typename T, template< typename > class Dev = Cpu>
template<typename L>
NumCell< T, Dev >::NumCell ( long nxi,
long nyi,
L * mx,
L * my,
T * pin = NULL )

Create a cell array with blocks of different sizes in continuous memory.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.
[in]mxNumber of rows of each block. Blocks with 0 are left empty.
[in]myNumber of columns of each block. 1 if NULL.
[in]pinExisting memory to use (not owned). Allocated if NULL.

◆ NumCell() [4/4]

template<typename T, template< typename > class Dev = Cpu>
NumCell< T, Dev >::NumCell ( const NumCell< T, Dev > & in)

Create a reference to an existing cell array.

Parameters
[in]inCell array to reference.

Member Function Documentation

◆ M() [1/2]

template<typename T, template< typename > class Dev = Cpu>
TMat & NumCell< T, Dev >::M ( )
Returns
Reference to the continuous data array. Empty if blocks are not continuous.

◆ M() [2/2]

template<typename T, template< typename > class Dev = Cpu>
const TMat & NumCell< T, Dev >::M ( ) const
Returns
Reference to the continuous data array. Empty if blocks are not continuous.

◆ p2pm()

template<typename T, template< typename > class Dev = Cpu>
void NumCell< T, Dev >::p2pm ( cudaStream_t stream = 0)

Update the device array pm of block data pointers.

Parameters
[in]streamStream to copy in.

◆ operator=()

template<typename T, template< typename > class Dev = Cpu>
NumCell & NumCell< T, Dev >::operator= ( const NumCell< T, Dev > & in)

Reference in.

Parameters
[in]inCell array to reference.
Returns
Reference to this.

◆ init()

template<typename T, template< typename > class Dev = Cpu>
void NumCell< T, Dev >::init ( long nxi = 0,
long nyi = 1 )

Reallocate the cell array with empty blocks.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.

◆ New()

template<typename T, template< typename > class Dev = Cpu>
NumCell NumCell< T, Dev >::New ( ) const
Returns
A newly allocated cell array with the same layout (in continuous memory if this one is).

◆ replace()

template<typename T, template< typename > class Dev = Cpu>
void NumCell< T, Dev >::replace ( T * pnew,
cudaStream_t stream )

Replace the data with a new set. We don't own pnew.

Parameters
[in]pnewNew data with the same total size, laid out block after block.
[in]streamStream to update pm in.

◆ Vector()

template<typename T, template< typename > class Dev = Cpu>
NumCell NumCell< T, Dev >::Vector ( ) const
Returns
A new cell array (column vector) whose blocks are reshaped as column vectors, sharing the data.

◆ Copy()

template<typename T, template< typename > class Dev = Cpu>
void NumCell< T, Dev >::Copy ( const NumCell< T, Dev > & in,
cudaStream_t stream = 0 )

Copy the data. Zero data if input data is empty. Reallocate if size mismatch. The continuous data M() is copied if both have it with the same size, otherwise the data is copied block by block.

Parameters
[in]inCell array to copy from.
[in]streamStream to run in.

◆ operator()() [1/6]

template<typename T, template< typename > class Dev = Cpu>
( int ix,
int iy )
Parameters
[in]ixRow index.
[in]iyColumn index.
Returns
Reference to element (ix, iy).

◆ operator()() [2/6]

template<typename T, template< typename > class Dev = Cpu>
( int ix,
int iy ) const
Parameters
[in]ixRow index.
[in]iyColumn index.
Returns
Reference to element (ix, iy).

◆ operator()() [3/6]

template<typename T, template< typename > class Dev = Cpu>
( )
Returns
The data pointer.

◆ operator()() [4/6]

template<typename T, template< typename > class Dev = Cpu>
( ) const
Returns
The data pointer.

◆ operator()() [5/6]

template<typename T, template< typename > class Dev = Cpu>
( int i)
Parameters
[in]iIndex.
Returns
Reference to the i-th element.

◆ operator()() [6/6]

template<typename T, template< typename > class Dev = Cpu>
( int i) const
Parameters
[in]iIndex.
Returns
Reference to the i-th element.

◆ N()

template<typename T, template< typename > class Dev = Cpu>
( ) const
Returns
Total number of elements.

◆ Nx()

template<typename T, template< typename > class Dev = Cpu>
( ) const
Returns
Number of rows.

◆ Ny()

template<typename T, template< typename > class Dev = Cpu>
( ) const
Returns
Number of columns.

◆ NRef()

template<typename T, template< typename > class Dev = Cpu>
( ) const
Returns
Number of references, or 0 if the memory is not owned.

◆ Zero()

template<typename T, template< typename > class Dev = Cpu>
void CellArray< T >::Zero ( cudaStream_t stream = 0)

Zero each block.

Parameters
[in]streamStream to run in.

◆ Write() [1/2]

template<typename T, template< typename > class Dev = Cpu>
void CellArray< T >::Write ( cudaStream_t stream,
file_t * fp ) const

Write the cell array to file.

Parameters
[in]streamStream to copy in.
[in,out]fpFile to write to.

◆ Write() [2/2]

template<typename T, template< typename > class Dev = Cpu>
void CellArray< T >::Write ( cudaStream_t stream,
const char * format,
... ) const

Write the cell array to a file named by format.

Parameters
[in]streamStream to copy in.
[in]formatprintf style format of the file name, followed by arguments.

The documentation for this class was generated from the following file:
  • cuda/math/types.h