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

Define a templated array class (owner of data) More...

#include <cs_array.h>

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

Public Member Functions

CS_F_HOST void * operator new (std::size_t count, const char *file_name=__FILE__, const int line_number=__LINE__)
 Custom new operator. More...
 
CS_F_HOST void * operator new[] (std::size_t count, const char *file_name=__FILE__, const int line_number=__LINE__)
 Custom new[] operator. More...
 
CS_F_HOST void operator delete (void *ptr)
 Custom delete operator. More...
 
CS_F_HOST void operator delete[] (void *ptr)
 Custom delete[] operator. More...
 
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)
 Constructor method using copy results in a shallow copy. If a deep copy is needed, use "get_deep_copy" method! More...
 
CS_F_HOST_DEVICE array (array &&other)
 Move constructor. More...
 
CS_F_HOST_DEVICE ~array ()
 Destructor method. More...
 
CS_F_HOST_DEVICE arrayoperator= (array other)
 Assignment operator. More...
 
CS_F_HOST_DEVICE void clear ()
 Clear data (empty container). More...
 
CS_F_HOST array< T, N, L > get_deep_copy (const char *file_name=__FILE__, const int line_number=__LINE__) const
 
CS_F_HOST_DEVICE mdspan< T, N, L > view ()
 Get span view of array, same dimensions as array. 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_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 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 void reshape_and_copy (const cs_lnum_t size1, const cs_lnum_t size2, const cs_lnum_t size3, const cs_lnum_t size4, cs_lnum_t size_to_keep, const char *file_name=__FILE__, const int line_number=__LINE__)
 Resize data array and copy old data (4D) More...
 
CS_F_HOST_DEVICE void set_alloc_mode (cs_alloc_mode_t mode)
 Set memory allocation mode. More...
 
CS_F_HOST_DEVICE bool owner () const
 Getter function for owner status. More...
 
CS_F_HOST_DEVICE cs_alloc_mode_t mode () const
 Getter function for allocation mode. More...
 
CS_F_HOST void copy_data (const 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 (cs_dispatch_context &ctx, const 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...
 
- Public Member Functions inherited from mdspan< T, 1, layout::right >
CS_F_HOST_DEVICE mdspan ()
 Default constructor method leading to "empty container". More...
 
CS_F_HOST_DEVICE mdspan (T *data, Args... indices)
 Constructor method using only global size (works for N=1). More...
 
CS_F_HOST_DEVICE mdspan (T *data, const cs_lnum_t(&dims)[N])
 Constructor method using dimensions. More...
 
CS_F_HOST_DEVICE mdspan (const mdspan &other)
 Constructor method using copy. May be a shallow copy. More...
 
CS_F_HOST_DEVICE mdspan (mdspan &&other)
 Move constructor. More...
 
CS_F_HOST_DEVICE ~mdspan ()
 Desstructor method using dimensions. More...
 
CS_F_HOST mdspanoperator= (const mdspan &other)
 Assignment operator. More...
 
CS_F_HOST_DEVICE mdspanoperator= (mdspan &&other)
 
CS_F_HOST_DEVICE operator T* () const
 Cast operator to "T*" from this class. 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...
 
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...
 
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...
 
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...
 
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...
 
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() (Args... indices)
 Overloaded () operator to access the (i,j,k)-th value tuple. More...
 
CS_F_HOST_DEVICE std::enable_if_t< cs::always_true< Args... >::value &&(N!=2) &&(N!=1), T & > operator() (Args... indices) const
 Overloaded () operator to access the (i,j,k)-th value tuple. More...
 
CS_F_HOST_DEVICE void set_data_ptr (T *data_ptr) const
 Set data pointer. More...
 
CS_F_HOST_DEVICE void update_data (T *data_ptr, Args... dims)
 Update data pointer and dimensions of span. More...
 
CS_F_HOST_DEVICE bool empty () const
 Check if object is empty or not. More...
 
CS_F_HOST_DEVICE cs_lnum_t size () const
 Getter for total size. More...
 
CS_F_HOST_DEVICE cs_lnum_t extent (int i) const
 Getter for extent along a given dimension. More...
 
CS_F_HOST_DEVICE cs_lnum_t offset (int i) const
 Getter for extent along a given dimension. More...
 
CS_F_HOST_DEVICE T * data () const
 Getter for data raw pointer. More...
 
CS_F_HOST_DEVICE U * data () const
 Getter for data raw pointer with recast (casts T* to U*) More...
 
CS_F_HOST_DEVICE mdspan< T, 1, L > view_1d ()
 Get span 1D view of the array, same total size. More...
 
CS_F_HOST_DEVICE mdspan< T, N-sizeof...(Args), L > sub_view (Args... indices)
 Getter for a subspan based on first dimension. More...
 
CS_F_HOST_DEVICE T * sub_array (Args... indices)
 Get sub array based on index. More...
 
CS_F_HOST_DEVICE T * sub_array (Args... indices) const
 Get sub array based on index. 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 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 (mdspan &other, const cs_lnum_t n_vals=-1)
 Copy data from another mdspan, 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, mdspan &other, const cs_lnum_t n_vals=-1)
 Copy data from another mdspan, we suppose that data size is same as that of the array. An assert test the sizes in debug. More...
 

Friends

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

Additional Inherited Members

- Protected Member Functions inherited from mdspan< T, 1, layout::right >
CS_F_HOST_DEVICE cs_lnum_t data_offset_ (Args... indices) const
 Helper function to compute value offset. More...
 
CS_F_HOST_DEVICE cs_lnum_t contiguous_data_offset_ (Args... indices) const
 Helper function to compute value offset. More...
 
CS_F_HOST_DEVICE void set_size_ (const cs_lnum_t(&dims)[N])
 Set size of array based on dimensions. More...
 
CS_F_HOST_DEVICE void set_size_ (Args... dims)
 Set size of N indices (variadic template) More...
 
CS_F_HOST_DEVICE bool check_bounds_ (Args... dims) const
 Check if provided arguments are within array bounds. More...
 
- Static Protected Member Functions inherited from mdspan< T, 1, layout::right >
static CS_F_HOST_DEVICE void check_operator_args_ (Args...)
 Helper function to static check operator input arguments. More...
 
static CS_F_HOST_DEVICE void check_sub_function_args_ (Args...)
 Helper function to static check sub-function input arguments. More...
 
- Protected Attributes inherited from mdspan< T, 1, layout::right >
cs_lnum_t _extent [N]
 
cs_lnum_t _offset [N]
 
cs_lnum_t _size
 
T * _data
 

Detailed Description

template<class T, int N = 1, layout L = layout::right>
class cs::array< T, N, L >

Define a templated array class (owner of data)

Template Parameters
T: data type
N: number of dimensions (int)
L: memory layout (cs::layout)

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)
inline

Constructor method using copy results in a shallow copy. If a deep copy is needed, use "get_deep_copy" method!

Parameters
[in]otherReference of data array to copy

◆ array() [10/10]

CS_F_HOST_DEVICE 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/2]

CS_F_HOST void copy_data ( const 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/2]

CS_F_HOST void copy_data ( cs_dispatch_context ctx,
const 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

◆ get_deep_copy()

CS_F_HOST array< T, N, L > get_deep_copy ( const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
) const
inline
Parameters
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ 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()

CS_F_HOST_DEVICE cs_alloc_mode_t mode ( ) const
inline

Getter function for allocation mode.

Returns
memory allocation mode (cs_alloc_mode_t)

◆ operator delete()

CS_F_HOST void operator delete ( void *  ptr)
inline

Custom delete operator.

◆ operator delete[]()

CS_F_HOST void operator delete[] ( void *  ptr)
inline

Custom delete[] operator.

◆ operator new()

CS_F_HOST void * operator new ( std::size_t  count,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Custom new operator.

Parameters
[in]countSize to allocate
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ operator new[]()

CS_F_HOST void * operator new[] ( std::size_t  count,
const char *  file_name = __FILE__,
const int  line_number = __LINE__ 
)
inline

Custom new[] operator.

Parameters
[in]countSize to allocate
[in]file_nameCaller file (for log)
[in]line_numberCaller line (for log)

◆ operator=()

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

Assignment operator.

◆ owner()

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/5]

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

Resize data array and copy old data (4D)

Parameters
[in]size1Size along first dimension
[in]size2Size along second dimension
[in]size3Size along third dimension
[in]size4Size along fourth 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/5]

CS_F_HOST 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() [3/5]

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() [4/5]

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() [5/5]

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.

◆ 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.

Friends And Related Function Documentation

◆ swap

CS_F_HOST_DEVICE 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: