#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 array & | operator= (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... | |
|
inline |
Default constructor method leading to "empty container".
|
inline |
Constructor method using only size.
| [in] | size | size of array |
| [in] | alloc_mode | Memory allocation mode |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Constructor method using dimensions.
| [in] | dims | Array of dimensions sizes |
| [in] | alloc_mode | Memory allocation mode |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Constructor method for 2D array based on sizes.
| [in] | size1 | First size of array |
| [in] | size2 | Second size of array |
| [in] | alloc_mode | Memory allocation mode |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Constructor method for 3D array based on sizes.
| [in] | size1 | First size of array |
| [in] | size2 | Second size of array |
| [in] | size3 | Third size of array |
| [in] | alloc_mode | Memory allocation mode |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Constructor method for 4D array based on sizes.
| [in] | size1 | First size of array |
| [in] | size2 | Second size of array |
| [in] | size3 | Third size of array |
| [in] | size4 | Third size of array |
| [in] | alloc_mode | Memory allocation mode |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Constructor method for non owner version.
| [in] | data | Pointer to data array |
| [in] | indices | Size of array |
|
inline |
Constructor method for non owner version in multidimensional.
| [in] | data | Pointer to data array |
| [in] | dims | Array of dimensions sizes |
|
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.
| [in] | other | Reference of data array to copy |
| [in] | deep_copy | Make a deep copy (owner) or not. |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
Move constructor.
| [in] | other | Original reference to move |
|
inline |
Destructor method.
|
inline |
Clear data (empty container).
Copy data from another array, we suppose that data size is same as that of the array. An assert test the sizes in debug.
| [in] | other | Reference to another array object |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
Copy data from const raw pointer, we suppose that data size is same as that of the array.
| [in] | data | Pointer to copy |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
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.
| [in] | ctx | Reference to dispatch context |
| [in] | other | Reference to another array object |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
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.
| [in] | ctx | Reference to dispatch context |
| [in] | data | Pointer to copy |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
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.
| [in] | ctx | Reference to dispatch context |
| [in] | span | Reference to a span object |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
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.
| [in] | ctx | Reference to dispatch context |
| [in] | data | Pointer to copy |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
Copy data from a span, we suppose that data size is same as that of the array. An assert test the sizes in debug.
| [in] | span | Reference to a span object |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
Copy data from raw pointer, we suppose that data size is same as that of the array.
| [in] | data | Pointer to copy |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
inline |
Getter to data array.
|
inline |
Getter for data raw pointer with recast (casts T* to U*)
| U | : data type used to cast T* into U* |
|
inline |
Const getter to data array.
|
inline |
Getter function for size per dimension (extent).
| [in] | i | dimension id |
|
inline |
Getter function for size per dimension (extent).
| [in] | i | dimension id |
|
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.
| [in] | indices | Input arguments (parameter pack) |
|
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.
| [in] | dims | Array of dimensions sizes |
|
inline |
Getter function for allocation mode.
|
inline |
Getter function for allocation mode.
|
inline |
Getter function for offset per dimension.
| [in] | i | dimension id |
|
inline |
Getter function for offset per dimension.
| [in] | i | dimension id |
|
inline |
Overloaded () operator using N-values tuple..
| [in] | indices | Input arguments (parameter pack) |
|
inline |
Overloaded () operator using N-values tuple..
| [in] | indices | Input arguments (parameter pack) |
|
inline |
Overloaded () operator to access the ith value (val[i]).
| [in] | i | Index of value to get |
|
inline |
Overloaded [] operator to access the ith value (val[i]).
| [in] | i | Index of value to get |
|
inline |
Overloaded () operator to access the (i,j)-th value couple.
| [in] | i | Index along first dimension |
| [in] | j | Index along second dimension |
|
inline |
Overloaded () operator to access the (i,j)-th value couple.
| [in] | i | Index along first dimension |
| [in] | j | Index along second dimension |
|
inline |
Overloaded [] operator to access the ith value (val[i]).
| [in] | i | Index of value to get |
|
inline |
Overloaded [] operator to access the ith value (val[i]).
| [in] | i | Index of value to get |
|
inline |
Getter function for owner status.
|
inline |
Getter function for owner status.
|
inline |
Resize data array 2D (no explicit copy, only realloc)
| [in] | size1 | Size along first dimension |
| [in] | size2 | Size along second dimension |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array 3D (no explicit copy, only realloc)
| [in] | size1 | Size along first dimension |
| [in] | size2 | Size along second dimension |
| [in] | size3 | Size along third dimension |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array and do not keep old data.
| [in] | dims | Array of dimensions sizes |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array.
| [in] | new_size | New size |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array and copy old data (3D)
| [in] | size1 | Size along first dimension |
| [in] | size2 | Size along second dimension |
| [in] | size3 | Size along third dimension |
| [in] | size_to_keep | Size to keep when copying data (-1 for all) |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array and copy old data (2D)
| [in] | size1 | Size along first dimension |
| [in] | size2 | Size along second dimension |
| [in] | size_to_keep | Size to keep when copying data (-1 for all) |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array and copy old data.
| [in] | dims | Array of dimensions sizes |
| [in] | size_to_keep | Size to keep when copying data |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Resize data array and copy old data.
| [in] | new_size | New size |
| [in] | size_to_keep | Size of data to keep (-1 for all) |
| [in] | file_name | Caller file (for log) |
| [in] | line_number | Caller line (for log) |
|
inline |
Set memory allocation mode.
| [in] | mode | Memory allocation mode. |
|
inline |
Initializer method for empty containers.
|
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.
| ctx | Reference to dispatch context | |
| [in] | val | Value to set to entire data array. |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
Set all values of the data array to a constant value.
| [in] | val | Value to set to entire data array. |
| [in] | n_vals | Number of values to copy. If -1, default, we use array size |
|
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.
| ctx | Reference to dispatch context | |
| [in] | val | Value to set to entire data array. |
| [in] | n_elts | Number of values to set. |
| [in] | elt_ids | list of ids in the subset or null (size:n_elts) |
|
inline |
Set subset of values of the data array to a constant value.
| [in] | val | Value to set to entire data array. |
| [in] | n_elts | Number of values to set. |
| [in] | elt_ids | list of ids in the subset or null (size:n_elts) |
|
inline |
Getter function for total size.
|
inline |
Getter function for total size.
|
inline |
Get sub array based on index.
| [in] | indices | Input arguments (parameter pack) |
|
inline |
Const get sub array based on index.
| [in] | indices | Input arguments (parameter pack) |
|
inline |
Get span sub-view of array, with lower dimensionality.
| [in] | indices | Input arguments (parameter pack) |
|
inline |
Get span view of array, same dimensions as array.
|
inline |
Set all values of the data array to 0.
|
inline |
Set all values of the data array to 0.
| ctx | Reference to dispatch context |
Class swap operator used for assignment or move.
| [in] | first | First instance to swap |
| [in] | second | Second instance to swap |