9.1
general documentation
array_2dspan< T > Class Template Reference

#include <cs_array_2dspan.h>

+ Collaboration diagram for array_2dspan< T >:

Public Member Functions

CS_F_HOST_DEVICE array_2dspan ()
 Default constructor method leading to "empty container". More...
 
CS_F_HOST_DEVICE array_2dspan (cs_lnum_t dim1, cs_lnum_t dim2, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method using only dimension. More...
 
CS_F_HOST_DEVICE array_2dspan (cs_lnum_t dim1, cs_lnum_t dim2, cs_alloc_mode_t alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method with specified allocation method. More...
 
CS_F_HOST_DEVICE array_2dspan (cs_lnum_t dim1, cs_lnum_t dim2, T *data_array, cs_alloc_mode_t alloc_mode=cs_alloc_mode)
 Constructor method for non owner version. More...
 
CS_F_HOST_DEVICE array_2dspan (array_2dspan &other, bool shallow_copy=false, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method using copy. May be a shallow copy. More...
 
CS_F_HOST_DEVICE array_2dspan (array_2dspan &&other)
 Move constructor. More...
 
CS_F_HOST_DEVICE ~array_2dspan ()
 Destructor method. More...
 
CS_F_HOST_DEVICE array_2dspanoperator= (array_2dspan other)
 Assignment operator. More...
 
CS_F_HOST_DEVICE void clear ()
 Clear data (empty container). More...
 
CS_F_HOST_DEVICE void empty ()
 Initializer method for empty containers. More...
 
CS_F_HOST_DEVICE void point_to (array_2dspan &other)
 Change pointers/size of an existing container. More...
 
CS_F_HOST_DEVICE void set_to_val (T val)
 Set all values of the data array to a constant value. More...
 
CS_F_HOST_DEVICE void resize (cs_lnum_t dim1, cs_lnum_t dim2, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array. More...
 
CS_F_HOST_DEVICE void resize (cs_lnum_t dim1, cs_lnum_t dim2, bool copy_data, cs_lnum_t size_to_keep, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array while keeping some of the old data. More...
 
CS_F_HOST_DEVICE array_2dspan view ()
 Get a view (non owner) of the array. More...
 
CS_F_HOST_DEVICE void set_alloc_mode (cs_alloc_mode_t mode)
 Set memory allocation mode. More...
 
CS_F_HOST_DEVICE T * vals ()
 Getter function for full array. More...
 
CS_F_HOST_DEVICE const T * vals () const
 Const getter function for full array. More...
 
CS_F_HOST_DEVICE T * operator[] (int i)
 Overloaded [] operator to access the ith subarray (val[i][...]). More...
 
CS_F_HOST_DEVICE const T * operator[] (int i) const
 Overloaded const [] operator to access the ith subarray (val[i][...]). More...
 
CS_F_HOST_DEVICE cs_lnum_t dim1 ()
 Getter function for first dimension size. More...
 
CS_F_HOST_DEVICE cs_lnum_t dim2 ()
 Getter function for second dimension size. More...
 
CS_F_HOST_DEVICE cs_lnum_t size ()
 Getter function for total size. More...
 

Friends

CS_F_HOST_DEVICE friend void swap (array_2dspan &first, array_2dspan &second)
 Class swap operator used for assignment or move. More...
 

Constructor & Destructor Documentation

◆ array_2dspan() [1/6]

Default constructor method leading to "empty container".

◆ array_2dspan() [2/6]

CS_F_HOST_DEVICE array_2dspan ( cs_lnum_t  dim1,
cs_lnum_t  dim2,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method using only dimension.

Parameters
[in]dim1First dimension size
[in]dim2Second dimension size
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array_2dspan() [3/6]

CS_F_HOST_DEVICE array_2dspan ( cs_lnum_t  dim1,
cs_lnum_t  dim2,
cs_alloc_mode_t  alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method with specified allocation method.

Parameters
[in]dim1First dimension size
[in]dim2Second dimension size
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array_2dspan() [4/6]

CS_F_HOST_DEVICE array_2dspan ( cs_lnum_t  dim1,
cs_lnum_t  dim2,
T *  data_array,
cs_alloc_mode_t  alloc_mode = cs_alloc_mode 
)
inline

Constructor method for non owner version.

Parameters
[in]dim1First dimension size
[in]dim2Second dimension size
[in]data_arrayPointer to data array
[in]alloc_modeMemory allocation mode, default is HOST.

◆ array_2dspan() [5/6]

CS_F_HOST_DEVICE array_2dspan ( array_2dspan< T > &  other,
bool  shallow_copy = false,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method using copy. May be a shallow copy.

Parameters
[in]otherInstance to copy
[in]shallow_copyDo a shallow copy or not
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array_2dspan() [6/6]

CS_F_HOST_DEVICE array_2dspan ( array_2dspan< T > &&  other)
inline

Move constructor.

Parameters
[in]otherOriginal reference to move

◆ ~array_2dspan()

Destructor method.

Member Function Documentation

◆ clear()

CS_F_HOST_DEVICE void clear ( )
inline

Clear data (empty container).

◆ dim1()

CS_F_HOST_DEVICE cs_lnum_t dim1 ( )
inline

Getter function for first dimension size.

Returns
value for first dimension size (cs_lnum_t)

◆ dim2()

CS_F_HOST_DEVICE cs_lnum_t dim2 ( )
inline

Getter function for second dimension size.

Returns
value for second dimension size (cs_lnum_t)

◆ empty()

CS_F_HOST_DEVICE void empty ( )
inline

Initializer method for empty containers.

◆ operator=()

CS_F_HOST_DEVICE array_2dspan & operator= ( array_2dspan< T >  other)
inline

Assignment operator.

◆ operator[]() [1/2]

CS_F_HOST_DEVICE T * operator[] ( int  i)
inline

Overloaded [] operator to access the ith subarray (val[i][...]).

Returns
raw pointer to the i-th sub-array
Parameters
[in]isub-array index to access

◆ operator[]() [2/2]

CS_F_HOST_DEVICE const T * operator[] ( int  i) const
inline

Overloaded const [] operator to access the ith subarray (val[i][...]).

Returns
const raw pointer to the i-th sub-array
Parameters
[in]isub-array index to access

◆ point_to()

CS_F_HOST_DEVICE void point_to ( array_2dspan< T > &  other)
inline

Change pointers/size of an existing container.

Parameters
[in]otherOther instance to which we want to point to (shallow copy)

◆ resize() [1/2]

CS_F_HOST_DEVICE void resize ( cs_lnum_t  dim1,
cs_lnum_t  dim2,
bool  copy_data,
cs_lnum_t  size_to_keep,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array while keeping some of the old data.

Parameters
[in]dim1First dimension size
[in]dim2Second dimension size
[in]copy_dataCopy data from old pointer to new array. Default is false.
[in]size_to_keepSize of data to keep
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ resize() [2/2]

CS_F_HOST_DEVICE void resize ( cs_lnum_t  dim1,
cs_lnum_t  dim2,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array.

Parameters
[in]dim1First dimension size
[in]dim2Second dimension size
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ set_alloc_mode()

CS_F_HOST_DEVICE void set_alloc_mode ( cs_alloc_mode_t  mode)
inline

Set memory allocation mode.

Parameters
[in]modeMemory allocation mode.

◆ set_to_val()

CS_F_HOST_DEVICE void set_to_val ( val)
inline

Set all values of the data array to a constant value.

Parameters
[in]valValue to set to entire data array.

◆ size()

CS_F_HOST_DEVICE cs_lnum_t size ( )
inline

Getter function for total size.

Returns
value for total size of data array (cs_lnum_t)

◆ vals() [1/2]

CS_F_HOST_DEVICE T * vals ( )
inline

Getter function for full array.

Returns
raw pointer to the full data array.

◆ vals() [2/2]

CS_F_HOST_DEVICE const T * vals ( ) const
inline

Const getter function for full array.

Returns
const raw pointer to the full data array.

◆ view()

CS_F_HOST_DEVICE array_2dspan view ( )
inline

Get a view (non owner) of the array.

Returns
temporary instance which is a view (non owner) of the data

Friends And Related Function Documentation

◆ swap

CS_F_HOST_DEVICE friend void swap ( array_2dspan< T > &  first,
array_2dspan< T > &  second 
)
friend

Class swap operator used for assignment or move.

Parameters
[in,out]firstFirst class instance
[in,out]secondSecond class instance

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