SOFA API  1e111313
Open source framework for multi-physics simuation
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager > Class Template Reference

#include <integer_id.h>

Inheritance diagram for sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >:

Classes

struct  rebind
 

Public Member Functions

 vector_id ()
 Basic constructor. More...
 
 vector_id (Size n, const T &value)
 Constructor. More...
 
 vector_id (int n, const T &value)
 Constructor. More...
 
 vector_id (long n, const T &value)
 Constructor. More...
 
 vector_id (Size n)
 Constructor. More...
 
 vector_id (const std::vector< T > &x)
 Constructor. More...
 
 vector_id (const_iterator first, const_iterator last)
 Constructor. More...
 
reference at (Index n)
 Read/write random access, with explicit Index. More...
 
const_reference at (Index n) const
 Read-only random access, with explicit Index. More...
 
reference operator() (Index n)
 Read/write random access, with explicit Index. More...
 
const_reference operator() (Index n) const
 Read-only random access, with explicit Index. More...
 
reference operator[] (Index n)
 Read/write random access, with explicit Index. More...
 
const_reference operator[] (Index n) const
 Read-only random access. More...
 
Index push_back (const_reference v)
 
- Public Member Functions inherited from sofa::helper::vector< T, MemoryManager >
 vector ()
 
 vector (Size n)
 
 vector (const vector< T, MemoryManager > &v)
 
bool isHostValid () const
 
bool isDeviceValid (unsigned gpu) const
 
void clear ()
 
void operator= (const vector< T, MemoryManager > &v)
 
 ~vector ()
 
Size size () const
 
Size capacity () const
 
bool empty () const
 
void reserve (Size s, Size WARP_SIZE=MemoryManager::BSIZE)
 
void fastResize (Size s, Size WARP_SIZE=MemoryManager::BSIZE)
 resize the vector without calling constructors or destructors, and without synchronizing the device and host copy More...
 
void recreate (Size s, Size WARP_SIZE=MemoryManager::BSIZE)
 resize the vector discarding any old values, without calling constructors or destructors, and without synchronizing the device and host copy More...
 
void invalidateDevice ()
 
void invalidateHost ()
 
void memsetDevice (int v=0)
 
void memsetHost (int v=0)
 
void resize (Size s, Size WARP_SIZE=MemoryManager::BSIZE)
 
void swap (vector< T, MemoryManager > &v)
 
const device_pointer deviceReadAt (int i, int gpu=MemoryManager::getBufferDevice()) const
 
const device_pointer deviceRead (int gpu=MemoryManager::getBufferDevice()) const
 
device_pointer deviceWriteAt (int i, int gpu=MemoryManager::getBufferDevice())
 
device_pointer deviceWrite (int gpu=MemoryManager::getBufferDevice())
 
const ThostRead () const
 
ThostWrite ()
 
const ThostReadAt (int i) const
 
ThostWriteAt (int i)
 
buffer_id_type bufferRead (bool create=false)
 Get the Buffer Object ID for reading. More...
 
buffer_id_type bufferWrite (bool create=false)
 Get the Buffer Object ID for writing. More...
 
void push_back (const T &t)
 
void pop_back ()
 
const Toperator[] (Size i) const
 
Toperator[] (Size i)
 
const Tdata () const
 
Tdata ()
 
const TgetCached (Size i) const
 
const TgetSingle (Size i) const
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
iterator erase (iterator position)
 
iterator insert (iterator position, const T &x)
 
template<>
std::istream & read (std::istream &in)
 
template<>
std::istream & read (std::istream &in)
 
template<>
std::ostream & write (std::ostream &os) const
 
template<>
std::istream & read (std::istream &in)
 

Protected Member Functions

reference operator[] (Size n)
 Read/write random access with regular index type, protected to force use of explicit Index. More...
 
const_reference operator[] (Size n) const
 Read-only random access with regular index type, protected to force use of explicit Index. More...
 
- Protected Member Functions inherited from sofa::helper::vector< T, MemoryManager >
void allocate (int d) const
 
void copyToHost () const
 
void copyToDevice (int d=0) const
 
void copyToHostSingle (Size i) const
 
void checkIndex (Size i) const
 
void registerBuffer () const
 
void mapBuffer () const
 
void unmapBuffer () const
 
void unregisterBuffer () const
 
void createBuffer ()
 

Additional Inherited Members

- Protected Attributes inherited from sofa::helper::vector< T, MemoryManager >
Size vectorSize
 Current size of the vector. More...
 
Size allocSize
 Allocated size on host. More...
 
Size deviceVectorSize [MemoryManager::MAX_DEVICES]
 Initialized size on each device. More...
 
Size deviceAllocSize [MemoryManager::MAX_DEVICES]
 Allocated size on each device. More...
 
device_pointer devicePointer [MemoryManager::MAX_DEVICES]
 Pointer to the data on the GPU side. More...
 
Size clearSize
 when initializing missing device data, up to where entries should be set to zero ? More...
 
ThostPointer
 Pointer to the data on the CPU side. More...
 
int deviceIsValid
 True if the data on the GPU is currently valid (up to the given deviceVectorSize of each device, i.e. additionnal space may need to be allocated and/or initialized) More...
 
bool hostIsValid
 True if the data on the CPU is currently valid. More...
 
bool bufferIsRegistered
 True if the buffer is registered with CUDA. More...
 
buffer_id_type bufferObject
 Optionnal associated buffer ID. More...
 

Constructor details

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( )
inline

Basic constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( Size  n,
const T value 
)
inline

Constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( int  n,
const T value 
)
inline

Constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( long  n,
const T value 
)
inline

Constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( Size  n)
inlineexplicit

Constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( const std::vector< T > &  x)
inline

Constructor.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::vector_id ( const_iterator  first,
const_iterator  last 
)
inline

Constructor.

Function details

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::at ( Index  n)
inline

Read/write random access, with explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
const_reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::at ( Index  n) const
inline

Read-only random access, with explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator() ( Index  n)
inline

Read/write random access, with explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
const_reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator() ( Index  n) const
inline

Read-only random access, with explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator[] ( Index  n)
inline

Read/write random access, with explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
const_reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator[] ( Index  n) const
inline

Read-only random access.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator[] ( Size  n)
inlineprotected

Read/write random access with regular index type, protected to force use of explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
const_reference sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::operator[] ( Size  n) const
inlineprotected

Read-only random access with regular index type, protected to force use of explicit Index.

template<class T , class TIndex , bool CheckIndices = false, class MemoryManager = CPUMemoryManager<T>>
Index sofa::helper::vector_id< T, TIndex, CheckIndices, MemoryManager >::push_back ( const_reference  v)
inline