9.1
general documentation
array< T, N, L > Class Template Reference

#include <cs_array.h>

+ Collaboration diagram for array< T, N, L >:

Public Member Functions

CS_F_HOST_DEVICE array ()
 Default constructor method leading to "empty container". More...
 
CS_F_HOST array (cs_lnum_t size, cs_alloc_mode_t alloc_mode=cs_alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method using only size. More...
 
CS_F_HOST array (const cs_lnum_t(&dims)[N], cs_alloc_mode_t alloc_mode=cs_alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method using dimensions. More...
 
CS_F_HOST array (cs_lnum_t size1, cs_lnum_t size2, cs_alloc_mode_t alloc_mode=cs_alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method for 2D array based on sizes. More...
 
CS_F_HOST array (cs_lnum_t size1, cs_lnum_t size2, cs_lnum_t size3, cs_alloc_mode_t alloc_mode=cs_alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method for 3D array based on sizes. More...
 
CS_F_HOST array (cs_lnum_t size1, cs_lnum_t size2, cs_lnum_t size3, cs_lnum_t size4, cs_alloc_mode_t alloc_mode=cs_alloc_mode, const char *file_name=__FILE__, const int line_number=__LINE__)
 Constructor method for 4D array based on sizes. More...
 
template<typename... Args>
CS_F_HOST_DEVICE array (T *data, Args... indices)
 Constructor method for non owner version. More...
 
CS_F_HOST_DEVICE array (T *data, const cs_lnum_t(&dims)[N])
 Constructor method for non owner version in multidimensional. More...
 
CS_F_HOST_DEVICE array (const array &other, bool deep_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 array (array &&other)
 Move constructor. More...
 
CS_F_HOST_DEVICE ~array ()
 Destructor method. More...
 
CS_F_HOST arrayoperator= (array other)
 Assignment operator. More...
 
CS_F_HOST_DEVICE void clear ()
 Clear data (empty container). More...
 
CS_F_HOST_DEVICE mdspan< T, N, L > view ()
 Get span view of array, same dimensions as array. More...
 
template<typename... Args>
CS_F_HOST_DEVICE mdspan< T, N-sizeof...(Args), L > sub_view (Args... indices)
 Get span sub-view of array, with lower dimensionality. More...
 
template<int _N_, layout _L_ = L>
CS_F_HOST_DEVICE mdspan< T, _N_, _L_ > get_mdspan (const cs_lnum_t(&dims)[_N_])
 Get span view of array with a given array of dimensions (extent). If total size of span is different than that of the array an error is raised. More...
 
template<layout _L_ = L, typename... Args>
CS_F_HOST_DEVICE mdspan< T, sizeof...(Args), _L_ > get_mdspan (Args... indices)
 Get span view of array with a given array of dimensions (extent). If total size of span is different than that of the array an error is raised. More...
 
CS_F_HOST void set_to_val (T val, const cs_lnum_t n_vals=-1)
 Set all values of the data array to a constant value. More...
 
CS_F_HOST void set_to_val (cs_dispatch_context &ctx, T val, const cs_lnum_t n_vals=-1)
 Set all values of the data array to a constant value while providing a dispatch context. It is up to the call to synchronize the context after this call. More...
 
CS_F_HOST void set_to_val_on_subset (T val, const cs_lnum_t n_elts, const cs_lnum_t elt_ids[])
 Set subset of values of the data array to a constant value. More...
 
CS_F_HOST void set_to_val_on_subset (cs_dispatch_context &ctx, T val, const cs_lnum_t n_elts, const cs_lnum_t elt_ids[])
 Set a subset of values of the data array to a constant value while providing a dispatch context. It is up to the call to synchronize the context after this call. More...
 
CS_F_HOST void zero ()
 Set all values of the data array to 0. More...
 
CS_F_HOST void zero (cs_dispatch_context &ctx)
 Set all values of the data array to 0. More...
 
CS_F_HOST_DEVICE void set_empty ()
 Initializer method for empty containers. More...
 
CS_F_HOST void reshape (cs_lnum_t new_size, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array. More...
 
CS_F_HOST void reshape_and_copy (cs_lnum_t new_size, cs_lnum_t size_to_keep, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and copy old data. More...
 
CS_F_HOST void reshape (const cs_lnum_t(&dims)[N], const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and do not keep old data. More...
 
CS_F_HOST void reshape_and_copy (const cs_lnum_t(&dims)[N], cs_lnum_t size_to_keep=-1, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and copy old data. More...
 
CS_F_HOST void reshape (const cs_lnum_t size1, const cs_lnum_t size2, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array 2D (no explicit copy, only realloc) More...
 
CS_F_HOST void reshape_and_copy (const cs_lnum_t size1, const cs_lnum_t size2, cs_lnum_t size_to_keep, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and copy old data (2D) More...
 
CS_F_HOST void reshape (const cs_lnum_t size1, const cs_lnum_t size2, const cs_lnum_t size3, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array 3D (no explicit copy, only realloc) More...
 
CS_F_HOST_DEVICE void reshape_and_copy (const cs_lnum_t size1, const cs_lnum_t size2, const cs_lnum_t size3, cs_lnum_t size_to_keep, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and copy old data (3D) More...
 
CS_F_HOST_DEVICE void set_alloc_mode (cs_alloc_mode_t mode)
 Set memory allocation mode. More...
 
template<typename... Args>
CS_F_HOST_DEVICE T * sub_array (Args... indices)
 Get sub array based on index. More...
 
template<typename... Args>
CS_F_HOST_DEVICE T * sub_array (Args... indices) const
 Const get sub array based on index. More...
 
CS_F_HOST_DEVICE T * data ()
 Getter to data array. More...
 
template<typename U >
CS_F_HOST_DEVICE U * data ()
 Getter for data raw pointer with recast (casts T* to U*) More...
 
CS_F_HOST_DEVICE const T * data () const
 Const getter to data array. More...
 
CS_F_HOST_DEVICE T & operator[] (cs_lnum_t i)
 Overloaded [] operator to access the ith value (val[i]). More...
 
CS_F_HOST_DEVICE T & operator[] (cs_lnum_t i) const
 Overloaded [] operator to access the ith value (val[i]). More...
 
template<typename Id1 >
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1 >::value &&N==1, T & > operator() (Id1 i)
 Overloaded () operator to access the ith value (val[i]). More...
 
template<typename Id1 >
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1 >::value &&N==1, T & > operator() (Id1 i) const
 Overloaded [] operator to access the ith value (val[i]). More...
 
template<typename Id1 , typename Id2 >
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1, Id2 >::value &&N==2, T & > operator() (Id1 i, Id2 j)
 Overloaded () operator to access the (i,j)-th value couple. More...
 
template<typename Id1 , typename Id2 >
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1, Id2 >::value &&N==2, T & > operator() (Id1 i, Id2 j) const
 Overloaded () operator to access the (i,j)-th value couple. More...
 
template<typename... Args>
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() (Args... indices)
 Overloaded () operator using N-values tuple.. More...
 
template<typename... Args>
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() (Args... indices) const
 Overloaded () operator using N-values tuple.. More...
 
CS_F_HOST_DEVICE cs_lnum_t extent (int i)
 Getter function for size per dimension (extent). More...
 
CS_F_HOST_DEVICE cs_lnum_t extent (int i) const
 Getter function for size per dimension (extent). More...
 
CS_F_HOST_DEVICE cs_lnum_t offset (int i)
 Getter function for offset per dimension. More...
 
CS_F_HOST_DEVICE cs_lnum_t offset (int i) const
 Getter function for offset per dimension. More...
 
CS_F_HOST_DEVICE cs_lnum_t size ()
 Getter function for total size. More...
 
CS_F_HOST_DEVICE cs_lnum_t size () const
 Getter function for total size. More...
 
CS_F_HOST_DEVICE bool owner ()
 Getter function for owner status. More...
 
CS_F_HOST_DEVICE bool owner () const
 Getter function for owner status. More...
 
CS_F_HOST_DEVICE cs_alloc_mode_t mode ()
 Getter function for allocation mode. More...
 
CS_F_HOST_DEVICE cs_alloc_mode_t mode () const
 Getter function for allocation mode. More...
 
CS_F_HOST void copy_data (T *data, const cs_lnum_t n_vals=-1)
 Copy data from raw pointer, we suppose that data size is same as that of the array. More...
 
CS_F_HOST void copy_data (const T *data, const cs_lnum_t n_vals=-1)
 Copy data from const raw pointer, we suppose that data size is same as that of the array. More...
 
CS_F_HOST void copy_data (array &other, const cs_lnum_t n_vals=-1)
 Copy data from another array, we suppose that data size is same as that of the array. An assert test the sizes in debug. More...
 
CS_F_HOST void copy_data (mdspan< T, N, L > &span, const cs_lnum_t n_vals=-1)
 Copy data from a span, we suppose that data size is same as that of the array. An assert test the sizes in debug. More...
 
CS_F_HOST void copy_data (cs_dispatch_context &ctx, T *data, const cs_lnum_t n_vals=-1)
 Copy data from raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller. More...
 
CS_F_HOST void copy_data (cs_dispatch_context &ctx, const T *data, const cs_lnum_t n_vals=-1)
 Copy data from const raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller. More...
 
CS_F_HOST void copy_data (cs_dispatch_context &ctx, array &other, const cs_lnum_t n_vals=-1)
 Copy data from raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller. More...
 
CS_F_HOST void copy_data (cs_dispatch_context &ctx, mdspan< T, N, L > &span, const cs_lnum_t n_vals=-1)
 Copy data from a span, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller. More...
 

Friends

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

Constructor & Destructor Documentation

◆ array() [1/10]

CS_F_HOST_DEVICE array ( )
inline

Default constructor method leading to "empty container".

◆ array() [2/10]

CS_F_HOST array ( cs_lnum_t  size,
cs_alloc_mode_t  alloc_mode = cs_alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method using only size.

Parameters
[in]sizesize of array
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [3/10]

CS_F_HOST array ( const cs_lnum_t(&)  dims[N],
cs_alloc_mode_t  alloc_mode = cs_alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method using dimensions.

Parameters
[in]dimsArray of dimensions sizes
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [4/10]

CS_F_HOST array ( cs_lnum_t  size1,
cs_lnum_t  size2,
cs_alloc_mode_t  alloc_mode = cs_alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method for 2D array based on sizes.

Parameters
[in]size1First size of array
[in]size2Second size of array
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [5/10]

CS_F_HOST array ( cs_lnum_t  size1,
cs_lnum_t  size2,
cs_lnum_t  size3,
cs_alloc_mode_t  alloc_mode = cs_alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method for 3D array based on sizes.

Parameters
[in]size1First size of array
[in]size2Second size of array
[in]size3Third size of array
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [6/10]

CS_F_HOST array ( cs_lnum_t  size1,
cs_lnum_t  size2,
cs_lnum_t  size3,
cs_lnum_t  size4,
cs_alloc_mode_t  alloc_mode = cs_alloc_mode,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method for 4D array based on sizes.

Parameters
[in]size1First size of array
[in]size2Second size of array
[in]size3Third size of array
[in]size4Third size of array
[in]alloc_modeMemory allocation mode
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [7/10]

CS_F_HOST_DEVICE array ( T *  data,
Args...  indices 
)
inline

Constructor method for non owner version.

Parameters
[in]dataPointer to data array
[in]indicesSize of array

◆ array() [8/10]

CS_F_HOST_DEVICE array ( T *  data,
const cs_lnum_t(&)  dims[N] 
)
inline

Constructor method for non owner version in multidimensional.

Parameters
[in]dataPointer to data array
[in]dimsArray of dimensions sizes

◆ array() [9/10]

CS_F_HOST_DEVICE array ( const array< T, N, L > &  other,
bool  deep_copy = false,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Constructor method using copy. May be a shallow copy.

Important ! The default mode is shallow copy, since we want for lambda captures to have a lightweight copy. Otherwise, with the deep copy as default, this may lead to segmentation faults and unnecessary allocations.

Parameters
[in]otherReference of data array to copy
[in]deep_copyMake a deep copy (owner) or not.
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ array() [10/10]

CS_F_HOST array ( array< T, N, L > &&  other)
inline

Move constructor.

Parameters
[in]otherOriginal reference to move

◆ ~array()

CS_F_HOST_DEVICE ~array ( )
inline

Destructor method.

Member Function Documentation

◆ clear()

CS_F_HOST_DEVICE void clear ( )
inline

Clear data (empty container).

◆ copy_data() [1/8]

CS_F_HOST void copy_data ( array< T, N, L > &  other,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from another array, we suppose that data size is same as that of the array. An assert test the sizes in debug.

Parameters
[in]otherReference to another array object
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [2/8]

CS_F_HOST void copy_data ( const T *  data,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from const raw pointer, we suppose that data size is same as that of the array.

Parameters
[in]dataPointer to copy
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [3/8]

CS_F_HOST void copy_data ( cs_dispatch_context ctx,
array< T, N, L > &  other,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller.

Parameters
[in]ctxReference to dispatch context
[in]otherReference to another array object
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [4/8]

CS_F_HOST void copy_data ( cs_dispatch_context ctx,
const T *  data,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from const raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller.

Parameters
[in]ctxReference to dispatch context
[in]dataPointer to copy
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [5/8]

CS_F_HOST void copy_data ( cs_dispatch_context ctx,
mdspan< T, N, L > &  span,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from a span, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller.

Parameters
[in]ctxReference to dispatch context
[in]spanReference to a span object
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [6/8]

CS_F_HOST void copy_data ( cs_dispatch_context ctx,
T *  data,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from raw pointer, we suppose that data size is same as that of the array. A dispatch_context is provided, hence no implicit synchronization which should be done by the caller.

Parameters
[in]ctxReference to dispatch context
[in]dataPointer to copy
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [7/8]

CS_F_HOST void copy_data ( mdspan< T, N, L > &  span,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from a span, we suppose that data size is same as that of the array. An assert test the sizes in debug.

Parameters
[in]spanReference to a span object
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ copy_data() [8/8]

CS_F_HOST void copy_data ( T *  data,
const cs_lnum_t  n_vals = -1 
)
inline

Copy data from raw pointer, we suppose that data size is same as that of the array.

Parameters
[in]dataPointer to copy
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ data() [1/3]

CS_F_HOST_DEVICE T * data ( )
inline

Getter to data array.

◆ data() [2/3]

CS_F_HOST_DEVICE U * data ( )
inline

Getter for data raw pointer with recast (casts T* to U*)

Template Parameters
U: data type used to cast T* into U*
Returns
raw pointer (U*)

◆ data() [3/3]

CS_F_HOST_DEVICE const T * data ( ) const
inline

Const getter to data array.

◆ extent() [1/2]

CS_F_HOST_DEVICE cs_lnum_t extent ( int  i)
inline

Getter function for size per dimension (extent).

Returns
value of size for given dimension of data array (cs_lnum_t)
Parameters
[in]idimension id

◆ extent() [2/2]

CS_F_HOST_DEVICE cs_lnum_t extent ( int  i) const
inline

Getter function for size per dimension (extent).

Returns
value of size for given dimension of data array (cs_lnum_t)
Parameters
[in]idimension id

◆ get_mdspan() [1/2]

CS_F_HOST_DEVICE mdspan< T, sizeof...(Args), _L_ > get_mdspan ( Args...  indices)
inline

Get span view of array with a given array of dimensions (extent). If total size of span is different than that of the array an error is raised.

Returns
mdspan view with given dimensions.
Parameters
[in]indicesInput arguments (parameter pack)

◆ get_mdspan() [2/2]

CS_F_HOST_DEVICE mdspan< T, _N_, _L_ > get_mdspan ( const cs_lnum_t(&)  dims[_N_])
inline

Get span view of array with a given array of dimensions (extent). If total size of span is different than that of the array an error is raised.

Returns
mdspan view with given dimensions.
Parameters
[in]dimsArray of dimensions sizes

◆ mode() [1/2]

Getter function for allocation mode.

Returns
memory allocation mode (cs_alloc_mode_t)

◆ mode() [2/2]

CS_F_HOST_DEVICE cs_alloc_mode_t mode ( ) const
inline

Getter function for allocation mode.

Returns
memory allocation mode (cs_alloc_mode_t)

◆ offset() [1/2]

CS_F_HOST_DEVICE cs_lnum_t offset ( int  i)
inline

Getter function for offset per dimension.

Returns
value of offset- given dimension (cs_lnum_t)
Parameters
[in]idimension id

◆ offset() [2/2]

CS_F_HOST_DEVICE cs_lnum_t offset ( int  i) const
inline

Getter function for offset per dimension.

Returns
value of offset- given dimension (cs_lnum_t)
Parameters
[in]idimension id

◆ operator()() [1/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() ( Args...  indices)
inline

Overloaded () operator using N-values tuple..

Returns
reference to the (i_1, ...,i_n)-th value
Parameters
[in]indicesInput arguments (parameter pack)

◆ operator()() [2/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() ( Args...  indices) const
inline

Overloaded () operator using N-values tuple..

Returns
const reference to the (i_1, ...,i_n)-th value
Parameters
[in]indicesInput arguments (parameter pack)

◆ operator()() [3/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1 >::value &&N==1, T & > operator() ( Id1  i)
inline

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

Returns
raw pointer to the i-th value
Parameters
[in]iIndex of value to get

◆ operator()() [4/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1 >::value &&N==1, T & > operator() ( Id1  i) const
inline

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

Returns
raw pointer to the i-th value
Parameters
[in]iIndex of value to get

◆ operator()() [5/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1, Id2 >::value &&N==2, T & > operator() ( Id1  i,
Id2  j 
)
inline

Overloaded () operator to access the (i,j)-th value couple.

Returns
reference to the (i,j)-th value
Parameters
[in]iIndex along first dimension
[in]jIndex along second dimension

◆ operator()() [6/6]

CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Id1, Id2 >::value &&N==2, T & > operator() ( Id1  i,
Id2  j 
) const
inline

Overloaded () operator to access the (i,j)-th value couple.

Returns
const reference to the (i,j)-th value
Parameters
[in]iIndex along first dimension
[in]jIndex along second dimension

◆ operator=()

CS_F_HOST array & operator= ( array< T, N, L >  other)
inline

Assignment operator.

◆ operator[]() [1/2]

CS_F_HOST_DEVICE T & operator[] ( cs_lnum_t  i)
inline

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

Returns
raw pointer to the i-th value
Parameters
[in]iIndex of value to get

◆ operator[]() [2/2]

CS_F_HOST_DEVICE T & operator[] ( cs_lnum_t  i) const
inline

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

Returns
raw pointer to the i-th value
Parameters
[in]iIndex of value to get

◆ owner() [1/2]

CS_F_HOST_DEVICE bool owner ( )
inline

Getter function for owner status.

Returns
True if owner, false otherwise (bool)

◆ owner() [2/2]

CS_F_HOST_DEVICE bool owner ( ) const
inline

Getter function for owner status.

Returns
True if owner, false otherwise (bool)

◆ reshape() [1/4]

CS_F_HOST void reshape ( const cs_lnum_t  size1,
const cs_lnum_t  size2,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array 2D (no explicit copy, only realloc)

Parameters
[in]size1Size along first dimension
[in]size2Size along second dimension
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape() [2/4]

CS_F_HOST void reshape ( const cs_lnum_t  size1,
const cs_lnum_t  size2,
const cs_lnum_t  size3,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array 3D (no explicit copy, only realloc)

Parameters
[in]size1Size along first dimension
[in]size2Size along second dimension
[in]size3Size along third dimension
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape() [3/4]

CS_F_HOST void reshape ( const cs_lnum_t(&)  dims[N],
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array and do not keep old data.

Parameters
[in]dimsArray of dimensions sizes
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape() [4/4]

CS_F_HOST void reshape ( cs_lnum_t  new_size,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array.

Parameters
[in]new_sizeNew size
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape_and_copy() [1/4]

CS_F_HOST_DEVICE void reshape_and_copy ( const cs_lnum_t  size1,
const cs_lnum_t  size2,
const cs_lnum_t  size3,
cs_lnum_t  size_to_keep,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array and copy old data (3D)

Parameters
[in]size1Size along first dimension
[in]size2Size along second dimension
[in]size3Size along third dimension
[in]size_to_keepSize to keep when copying data (-1 for all)
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape_and_copy() [2/4]

CS_F_HOST void reshape_and_copy ( const cs_lnum_t  size1,
const cs_lnum_t  size2,
cs_lnum_t  size_to_keep,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array and copy old data (2D)

Parameters
[in]size1Size along first dimension
[in]size2Size along second dimension
[in]size_to_keepSize to keep when copying data (-1 for all)
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape_and_copy() [3/4]

CS_F_HOST void reshape_and_copy ( const cs_lnum_t(&)  dims[N],
cs_lnum_t  size_to_keep = -1,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array and copy old data.

Parameters
[in]dimsArray of dimensions sizes
[in]size_to_keepSize to keep when copying data
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ reshape_and_copy() [4/4]

CS_F_HOST void reshape_and_copy ( cs_lnum_t  new_size,
cs_lnum_t  size_to_keep,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Resize data array and copy old data.

Parameters
[in]new_sizeNew size
[in]size_to_keepSize of data to keep (-1 for all)
[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_empty()

CS_F_HOST_DEVICE void set_empty ( )
inline

Initializer method for empty containers.

◆ set_to_val() [1/2]

CS_F_HOST void set_to_val ( cs_dispatch_context ctx,
val,
const cs_lnum_t  n_vals = -1 
)
inline

Set all values of the data array to a constant value while providing a dispatch context. It is up to the call to synchronize the context after this call.

Parameters
ctxReference to dispatch context
[in]valValue to set to entire data array.
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ set_to_val() [2/2]

CS_F_HOST void set_to_val ( val,
const cs_lnum_t  n_vals = -1 
)
inline

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

Parameters
[in]valValue to set to entire data array.
[in]n_valsNumber of values to copy. If -1, default, we use array size

◆ set_to_val_on_subset() [1/2]

CS_F_HOST void set_to_val_on_subset ( cs_dispatch_context ctx,
val,
const cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[] 
)
inline

Set a subset of values of the data array to a constant value while providing a dispatch context. It is up to the call to synchronize the context after this call.

Parameters
ctxReference to dispatch context
[in]valValue to set to entire data array.
[in]n_eltsNumber of values to set.
[in]elt_idslist of ids in the subset or null (size:n_elts)

◆ set_to_val_on_subset() [2/2]

CS_F_HOST void set_to_val_on_subset ( val,
const cs_lnum_t  n_elts,
const cs_lnum_t  elt_ids[] 
)
inline

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

Parameters
[in]valValue to set to entire data array.
[in]n_eltsNumber of values to set.
[in]elt_idslist of ids in the subset or null (size:n_elts)

◆ size() [1/2]

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)

◆ size() [2/2]

CS_F_HOST_DEVICE cs_lnum_t size ( ) const
inline

Getter function for total size.

Returns
value for total size of data array (cs_lnum_t)

◆ sub_array() [1/2]

CS_F_HOST_DEVICE T * sub_array ( Args...  indices)
inline

Get sub array based on index.

Returns
raw pointer of sub array
Parameters
[in]indicesInput arguments (parameter pack)

◆ sub_array() [2/2]

CS_F_HOST_DEVICE T * sub_array ( Args...  indices) const
inline

Const get sub array based on index.

Returns
const raw pointer of sub array
Parameters
[in]indicesInput arguments (parameter pack)

◆ sub_view()

CS_F_HOST_DEVICE mdspan< T, N-sizeof...(Args), L > sub_view ( Args...  indices)
inline

Get span sub-view of array, with lower dimensionality.

Returns
mdspan view with Nd = N - Nargs.
Parameters
[in]indicesInput arguments (parameter pack)

◆ view()

CS_F_HOST_DEVICE mdspan< T, N, L > view ( )
inline

Get span view of array, same dimensions as array.

Returns
mdspan view with same number of dimensions as array.

◆ zero() [1/2]

CS_F_HOST void zero ( )
inline

Set all values of the data array to 0.

◆ zero() [2/2]

CS_F_HOST void zero ( cs_dispatch_context ctx)
inline

Set all values of the data array to 0.

Parameters
ctxReference to dispatch context

Friends And Related Function Documentation

◆ swap

CS_F_HOST friend void swap ( array< T, N, L > &  first,
array< T, N, L > &  second 
)
friend

Class swap operator used for assignment or move.

Parameters
[in]firstFirst instance to swap
[in]secondSecond instance to swap

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