MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
CellArray< T > Class Template Reference

Used for array in cpu of any other array. More...

Inheritance diagram for CellArray< T >:
Collaboration diagram for CellArray< T >:

Public Member Functions

CellArray Vector () const
CellArray trans (stream_t &stream)
 CellArray (long nxi, long nyi=1, T *pi=NULL, int own=1)
 CellArray (long nxi, long nyi, const CellArray &pi, long offset=0)
 CellArray ()
void Zero (cudaStream_t stream=0)
void Write (cudaStream_t stream, file_t *fp) const
void Write (cudaStream_t stream, const char *format,...) const
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)
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

string keywords
Data Fields inherited from Array< T, CpuObj >
string keywords

Protected Attributes

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>
class CellArray< T >

Used for array in cpu of any other array.

Constructor & Destructor Documentation

◆ CellArray() [1/3]

template<typename T>
CellArray< T >::CellArray ( long nxi,
long nyi = 1,
T * pi = NULL,
int own = 1 )

Create a cell array.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.
[in]piExisting memory to use. Allocated if NULL.
[in]ownWhether to free pi when the last reference is released.

◆ CellArray() [2/3]

template<typename T>
CellArray< T >::CellArray ( long nxi,
long nyi,
const CellArray< T > & pi,
long offset = 0 )

Create a reference to part of an existing cell array with offset.

Parameters
[in]nxiNumber of rows.
[in]nyiNumber of columns.
[in]piCell array to reference.
[in]offsetOffset in number of elements.

◆ CellArray() [3/3]

template<typename T>
CellArray< T >::CellArray ( )

Create an empty cell array.

Member Function Documentation

◆ Vector()

template<typename T>
CellArray CellArray< T >::Vector ( ) const
Returns
A new cell array (column vector) whose blocks are reshaped as column vectors.

◆ trans()

template<typename T>
CellArray CellArray< T >::trans ( stream_t & stream)

Transpose the cell array.

Parameters
[in]streamStream to run in.
Returns
The transposed cell array.

◆ Zero()

template<typename T>
void CellArray< T >::Zero ( cudaStream_t stream = 0)

Zero each block.

Parameters
[in]streamStream to run in.

◆ Write() [1/2]

template<typename T>
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>
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.

◆ deinit()

template<typename T>
( )

Release the reference and free the memory if this is the last owner.

◆ operator()() [1/6]

template<typename T>
T & Array< T, CpuObj >::operator() ( int ix,
int iy )
Parameters
[in]ixRow index.
[in]iyColumn index.
Returns
Reference to element (ix, iy).

◆ operator()() [2/6]

template<typename T>
const T & Array< T, CpuObj >::operator() ( int ix,
int iy ) const
Parameters
[in]ixRow index.
[in]iyColumn index.
Returns
Reference to element (ix, iy).

◆ operator()() [3/6]

template<typename T>
( )
Returns
The data pointer.

◆ operator()() [4/6]

template<typename T>
( ) const
Returns
The data pointer.

◆ operator()() [5/6]

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

◆ operator()() [6/6]

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

◆ NRef()

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

◆ Col() [1/2]

template<typename T>
T * Array< T, CpuObj >::Col ( int icol)
Parameters
[in]icolColumn index.
Returns
Pointer to the start of column icol.

◆ Col() [2/2]

template<typename T>
const T * Array< T, CpuObj >::Col ( int icol) const
Parameters
[in]icolColumn index.
Returns
Pointer to the start of column icol.

◆ Nx()

template<typename T>
long Array< T, CpuObj >::Nx ( ) const
Returns
Number of rows.

◆ Ny()

template<typename T>
long Array< T, CpuObj >::Ny ( ) const
Returns
Number of columns.

◆ N()

template<typename T>
long Array< T, CpuObj >::N ( ) const
Returns
Total number of elements.

◆ operator bool()

template<typename T>
Array< T, CpuObj >::operator bool ( ) const
explicit
Returns
Whether the array is not empty.

◆ init()

template<typename T>
void Array< T, CpuObj >::init ( long nxi = 0,
long nyi = 1 )

Reallocate the array. Existing data of the same size is kept.

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

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