openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
Public Member Functions | List of all members
limpet::IonIf< T >::LimpetArray< S > Class Template Reference

Utility class for handling arrays of data used by IMPs. More...

#include <ION_IF.h>

Inheritance diagram for limpet::IonIf< T >::LimpetArray< S >:
Collaboration diagram for limpet::IonIf< T >::LimpetArray< S >:

Public Member Functions

 LimpetArray ()
 Default constructor with no allocated data. More...
 
 LimpetArray (Target target, std::size_t size)
 Constructs a LimpetArray. More...
 
 ~LimpetArray ()
 Destroy a limpet array. More...
 
void allocate (Target target, std::size_t size)
 Allocate the array on the given target. More...
 
template<typename Type = S>
std::enable_if<!std::is_void< Type >::value, std::size_t >::type get_element_size () const
 Get the size of a single element (size of type S) More...
 
template<typename Type = S>
std::enable_if< std::is_void< Type >::value, std::size_t >::type get_element_size () const
 
S * data () const
 Gets a pointer to the underlying data. More...
 
std::size_t size () const
 Gets the sizee of the array. More...
 
bool is_allocated () const
 Returns whether data has been allocated for this LimpetArray. More...
 
LimpetArrayoperator= (LimpetArray &&other)
 Move assignement operator. More...
 

Detailed Description

template<typename T>
template<typename S>
class limpet::IonIf< T >::LimpetArray< S >

Utility class for handling arrays of data used by IMPs.

Note
For now this class can only be moved to avoid copying the owned data. This could probably be changed later by using this class only with shared pointers (_data cannot be a shared pointer as it could be a GPU pointer)
If this class is used with void as a template parameter, most functions will not do anything

Definition at line 521 of file ION_IF.h.

Constructor & Destructor Documentation

◆ LimpetArray() [1/2]

template<typename T>
template<typename S>
limpet::IonIf< T >::LimpetArray< S >::LimpetArray ( )
inline

Default constructor with no allocated data.

Definition at line 534 of file ION_IF.h.

◆ LimpetArray() [2/2]

template<typename T>
template<typename S>
limpet::IonIf< T >::LimpetArray< S >::LimpetArray ( Target  target,
std::size_t  size 
)
inline

Constructs a LimpetArray.

Parameters
targettarget on which to allocate the array
sizesize of the array

Definition at line 543 of file ION_IF.h.

◆ ~LimpetArray()

template<typename T>
template<typename S>
limpet::IonIf< T >::LimpetArray< S >::~LimpetArray ( )
inline

Destroy a limpet array.

Definition at line 551 of file ION_IF.h.

Member Function Documentation

◆ allocate()

template<typename T>
template<typename S>
void limpet::IonIf< T >::LimpetArray< S >::allocate ( Target  target,
std::size_t  size 
)
inline

Allocate the array on the given target.

Parameters
targettarget to allocate on
sizesize of the array

Definition at line 565 of file ION_IF.h.

◆ data()

template<typename T>
template<typename S>
S* limpet::IonIf< T >::LimpetArray< S >::data ( ) const
inline

Gets a pointer to the underlying data.

Returns
a pointer of type S* pointing to the allocated data (if any)

Definition at line 599 of file ION_IF.h.

Here is the caller graph for this function:

◆ get_element_size() [1/2]

template<typename T>
template<typename S>
template<typename Type = S>
std::enable_if<!std::is_void<Type>::value, std::size_t>::type limpet::IonIf< T >::LimpetArray< S >::get_element_size ( ) const
inline

Get the size of a single element (size of type S)

Return values
sizeof(S)if S is non-void
0is S is void

Definition at line 582 of file ION_IF.h.

◆ get_element_size() [2/2]

template<typename T>
template<typename S>
template<typename Type = S>
std::enable_if<std::is_void<Type>::value, std::size_t>::type limpet::IonIf< T >::LimpetArray< S >::get_element_size ( ) const
inline

Definition at line 587 of file ION_IF.h.

◆ is_allocated()

template<typename T>
template<typename S>
bool limpet::IonIf< T >::LimpetArray< S >::is_allocated ( ) const
inline

Returns whether data has been allocated for this LimpetArray.

Return values
trueif data is allocated
falseif data isn't allocated

Definition at line 623 of file ION_IF.h.

Here is the caller graph for this function:

◆ operator=()

template<typename T>
template<typename S>
LimpetArray& limpet::IonIf< T >::LimpetArray< S >::operator= ( LimpetArray< S > &&  other)
inline

Move assignement operator.

This is a move assignement, ensuring only one reference to the data exists (can probably be improved)

Definition at line 633 of file ION_IF.h.

◆ size()

template<typename T>
template<typename S>
std::size_t limpet::IonIf< T >::LimpetArray< S >::size ( ) const
inline

Gets the sizee of the array.

Returns
the size of the array

Definition at line 612 of file ION_IF.h.


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