OpenFPM_pdata  3.0.0
Project that contain the implementation of distributed structures
openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor > Class Template Reference

Detailed Description

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
class openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >

Definition at line 784 of file map_vector_sparse.hpp.

Public Member Functions

auto getIndexBuffer () -> decltype(vct_index)&
 Get the indices buffer. More...
 
auto getDataBuffer () -> decltype(vct_data)&
 Get the data buffer. More...
 
auto getIndexBuffer () const -> const decltype(vct_index)&
 Get the indices buffer. More...
 
auto getDataBuffer () const -> const decltype(vct_data)&
 Get the data buffer. More...
 
openfpm::sparse_index< Ti > get_sparse (Ti id) const
 Get the sparse index. More...
 
template<unsigned int p>
auto get (Ti id) const -> decltype(vct_data.template get< p >(id))
 Get an element of the vector. More...
 
auto get (Ti id) const -> decltype(vct_data.get(id))
 Get an element of the vector. More...
 
void resize (size_t n)
 resize to n elements More...
 
void swapIndexVector (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &iv)
 
template<unsigned int p>
auto getBackground () const -> decltype(vct_data.template get< p >(vct_data.size() -1))
 Set the background to bck (which value get must return when the value is not find) More...
 
auto getBackground () const -> decltype(vct_data.get(vct_data.size() -1))
 Set the background to bck (which value get must return when the value is not find) More...
 
template<unsigned int p>
void setBackground (const typename boost::mpl::at< typename T::type, boost::mpl::int_< p >>::type &bck_)
 
template<unsigned int p>
auto insert (Ti ele) -> decltype(vct_data.template get< p >(0))
 It insert an element in the sparse vector. More...
 
template<unsigned int p>
auto insertFlush (Ti ele) -> decltype(vct_data.template get< p >(0))
 It insert an element in the sparse vector. More...
 
auto insertFlush (Ti ele) -> decltype(vct_data.get(0))
 It insert an element in the sparse vector. More...
 
auto insert (Ti ele) -> decltype(vct_data.get(0))
 It insert an element in the sparse vector. More...
 
template<typename ... v_reduce>
void flush_v (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_cont_0, mgpu::ofp_context_t &context, flush_type opt=FLUSH_ON_HOST, int i=0)
 merge the added element to the main data array but save the insert buffer in v More...
 
template<typename ... v_reduce>
void flush_vd (vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_reord, mgpu::ofp_context_t &context, flush_type opt=FLUSH_ON_HOST)
 merge the added element to the main data array but save the insert buffer in v More...
 
template<typename ... v_reduce>
void flush (mgpu::ofp_context_t &context, flush_type opt=FLUSH_ON_HOST)
 merge the added element to the main data array More...
 
void flush_remove (mgpu::ofp_context_t &context, flush_type opt=FLUSH_ON_HOST)
 merge the added element to the main data array More...
 
size_t size ()
 Return how many element you have in this map. More...
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & private_get_vct_index ()
 Return the sorted vector of the indexes. More...
 
template<unsigned int ... prp>
void deviceToHost ()
 Transfer from device to host. More...
 
template<unsigned int ... prp>
void hostToDevice ()
 Transfer from host to device. More...
 
vector_sparse_gpu_ker< T, Ti, layout_base > toKernel ()
 toKernel function transform this structure into one that can be used on GPU More...
 
void setGPUInsertBuffer (int nblock, int nslot)
 set the gpu insert buffer for every block More...
 
void preFlush ()
 In case we manually set the added index buffer and the add data buffer we have to call this function before flush. More...
 
auto getGPUInsertBuffer () -> decltype(vct_add_data)&
 Get the GPU insert buffer. More...
 
void setGPURemoveBuffer (int nblock, int nslot)
 set the gpu remove buffer for every block More...
 
void clear ()
 Clear all from all the elements. More...
 
void swap (vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl > &sp)
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > & private_get_vct_add_data ()
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & private_get_vct_add_index ()
 
const vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & private_get_vct_add_index () const
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & private_get_vct_nadd_index ()
 
const vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & private_get_vct_nadd_index () const
 
auto getSegmentToOutMap () -> decltype(blf.get_outputMap())
 
auto getSegmentToOutMap () const -> decltype(blf.get_outputMap())
 
vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti > >::type, layout_base, grow_p > & getSegmentToMergeIndexMap ()
 
vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti > >::type, layout_base, grow_p > & getSegmentToMergeIndexMap () const
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & getMappingVector ()
 Return the mapping vector. More...
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > & getMergeIndexMapVector ()
 Return the merge mapping vector. More...
 

Private Member Functions

template<bool prefetch>
Ti _branchfree_search_nobck (Ti x, Ti &id) const
 get the element i More...
 
template<bool prefetch>
void _branchfree_search (Ti x, Ti &id) const
 get the element i More...
 
size_t make_continuos (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_nadd_index, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_cont_index, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_cont_index_map, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_cont, mgpu::ofp_context_t &context)
 
void reorder_indexes (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_cont_index, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_cont_index_map, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_reord, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_cont, mgpu::ofp_context_t &context)
 sort the continuos array of inserted key More...
 
template<typename ... v_reduce>
void merge_indexes (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_sort, vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti >>::type, layout_base, grow_p > &vct_add_index_unique, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_merge_index, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_merge_index_map, mgpu::ofp_context_t &context)
 Merge indexes. More...
 
template<typename ... v_reduce>
void merge_datas (vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_reord, vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti >>::type, layout_base, grow_p > &segments_new, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_data_reord_map, mgpu::ofp_context_t &context)
 
template<typename ... v_reduce>
void flush_on_gpu_insert (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_cont_0, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_cont_1, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_reord, mgpu::ofp_context_t &context)
 
void flush_on_gpu_remove (mgpu::ofp_context_t &context)
 
void resetBck ()
 
template<typename ... v_reduce>
void flush_on_gpu (vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_cont_0, vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &vct_add_index_cont_1, vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &vct_add_data_reord, mgpu::ofp_context_t &context)
 
template<typename ... v_reduce>
void flush_on_cpu ()
 

Private Attributes

vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_index
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p, impl > vct_data
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_m_index
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_add_index
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_rem_index
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_nadd_index
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_nrem_index
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > vct_add_data
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > vct_add_data_reord
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_add_index_cont_0
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_add_index_cont_1
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > vct_add_data_cont
 
vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti > >::type, layout_base, grow_p > vct_add_index_unique
 
vector< aggregate< int, int >, Memory, typename layout_base< aggregate< int, int > >::type, layout_base, grow_p > segments_int
 
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p, impl > vct_add_data_unique
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_index_tmp4
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_index_tmp
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_index_tmp2
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_index_tmp3
 
vector< aggregate< Ti, Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti, Ti > >::type, layout_base, grow_p > vct_index_dtmp
 
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti > >::type, layout_base, grow_p > vct_segment_index_map
 
block_functor blf
 
bck
 
CudaMemory mem
 
openfpm::vector< reorder< Ti > > reorder_add_index_cpu
 
size_t max_ele
 
int n_gpu_add_block_slot = 0
 
int n_gpu_rem_block_slot = 0
 

Member Function Documentation

◆ _branchfree_search()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<bool prefetch>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::_branchfree_search ( Ti  x,
Ti &  id 
) const
inlineprivate

get the element i

search the element x

Parameters
ielement i

Definition at line 864 of file map_vector_sparse.hpp.

◆ _branchfree_search_nobck()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<bool prefetch>
Ti openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::_branchfree_search_nobck ( Ti  x,
Ti &  id 
) const
inlineprivate

get the element i

search the element x

Parameters
ielement i

Definition at line 834 of file map_vector_sparse.hpp.

◆ clear()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::clear ( )
inline

Clear all from all the elements.

Definition at line 1950 of file map_vector_sparse.hpp.

◆ deviceToHost()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int ... prp>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::deviceToHost ( )
inline

Transfer from device to host.

Template Parameters
setof parameters to transfer to host

Definition at line 1839 of file map_vector_sparse.hpp.

◆ flush()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<typename ... v_reduce>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::flush ( mgpu::ofp_context_t &  context,
flush_type  opt = FLUSH_ON_HOST 
)
inline

merge the added element to the main data array

Parameters
optoptions

Definition at line 1782 of file map_vector_sparse.hpp.

◆ flush_remove()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::flush_remove ( mgpu::ofp_context_t &  context,
flush_type  opt = FLUSH_ON_HOST 
)
inline

merge the added element to the main data array

Parameters
optoptions

Definition at line 1800 of file map_vector_sparse.hpp.

◆ flush_v()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<typename ... v_reduce>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::flush_v ( vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_add_index_cont_0,
mgpu::ofp_context_t &  context,
flush_type  opt = FLUSH_ON_HOST,
int  i = 0 
)
inline

merge the added element to the main data array but save the insert buffer in v

Parameters
vinsert buffer
optoptions

Definition at line 1737 of file map_vector_sparse.hpp.

◆ flush_vd()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<typename ... v_reduce>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::flush_vd ( vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &  vct_add_data_reord,
mgpu::ofp_context_t &  context,
flush_type  opt = FLUSH_ON_HOST 
)
inline

merge the added element to the main data array but save the insert buffer in v

Parameters
vinsert buffer
optoptions

Definition at line 1761 of file map_vector_sparse.hpp.

◆ get() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int p>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::get ( Ti  id) const -> decltype(vct_data.template get<p>(id))
inline

Get an element of the vector.

Get an element of the vector

Template Parameters
pProperty to get
Parameters
idElement to get
Returns
the element value requested

Definition at line 1564 of file map_vector_sparse.hpp.

◆ get() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::get ( Ti  id) const -> decltype(vct_data.get(id))
inline

Get an element of the vector.

Get an element of the vector

Template Parameters
pProperty to get
Parameters
idElement to get
Returns
the element value requested

Definition at line 1581 of file map_vector_sparse.hpp.

◆ get_sparse()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
openfpm::sparse_index<Ti> openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::get_sparse ( Ti  id) const
inline

Get the sparse index.

Get the sparse index of the element id

Note
use get_index and get to retrieve the value index associated to the sparse index
Parameters
idElement to get
Returns
the element value requested

Definition at line 1543 of file map_vector_sparse.hpp.

◆ getBackground() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int p>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getBackground ( ) const -> decltype(vct_data.template get<p>(vct_data.size()-1))
inline

Set the background to bck (which value get must return when the value is not find)

Parameters
bck

Definition at line 1617 of file map_vector_sparse.hpp.

◆ getBackground() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getBackground ( ) const -> decltype(vct_data.get(vct_data.size()-1))
inline

Set the background to bck (which value get must return when the value is not find)

Parameters
bck

Definition at line 1627 of file map_vector_sparse.hpp.

◆ getDataBuffer() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getDataBuffer ( ) -> decltype(vct_data)&
inline

Get the data buffer.

Returns
the reference to the data buffer

Definition at line 1509 of file map_vector_sparse.hpp.

◆ getDataBuffer() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getDataBuffer ( ) const -> const decltype(vct_data)&
inline

Get the data buffer.

Returns
the reference to the data buffer

Definition at line 1527 of file map_vector_sparse.hpp.

◆ getGPUInsertBuffer()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getGPUInsertBuffer ( ) -> decltype(vct_add_data)&
inline

Get the GPU insert buffer.

Returns
the reference to the GPU insert buffer

Definition at line 1913 of file map_vector_sparse.hpp.

◆ getIndexBuffer() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getIndexBuffer ( ) -> decltype(vct_index)&
inline

Get the indices buffer.

Returns
the reference to the indices buffer

Definition at line 1500 of file map_vector_sparse.hpp.

◆ getIndexBuffer() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getIndexBuffer ( ) const -> const decltype(vct_index)&
inline

Get the indices buffer.

Returns
the reference to the indices buffer

Definition at line 1518 of file map_vector_sparse.hpp.

◆ getMappingVector()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
vector<aggregate<Ti>,Memory,typename layout_base<aggregate<Ti> >::type,layout_base,grow_p>& openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getMappingVector ( )
inline

Return the mapping vector.

When we add new elements this vector contain the merged old elements and new elements position

For example the old vector contain

Old: 5 10 35 50 66 79 (6 elements) New: 7 44 7 9 44 (5 elements) (in order are 7 7 9 44 44)

The merged indexes are (when reordered)

5 7 7 9 10 35 44 44 50 66 79

The returned map contain 5 elements indicating the position of the reordered elements:

0 2 3 1 4 (7)(7)(9)(44)(44)

Definition at line 2048 of file map_vector_sparse.hpp.

◆ getMergeIndexMapVector()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
vector<aggregate<Ti>,Memory,typename layout_base<aggregate<Ti> >::type,layout_base,grow_p>& openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::getMergeIndexMapVector ( )
inline

Return the merge mapping vector.

When we add new elements this vector contain the merged old elements and new elements position

For example the old vector contain

Old: 5 10 35 50 66 79 (6 elements) New: 7 44 7 9 44 (5 elements) (in order are 7 7 9 44 44)

The merged indexes are (when reordered)

5 7 7 9 10 35 44 44 50 66 79

The returned map contain 5 elements indicating the position of the reordered elements:

0 6 7 8 1 2 9 10 3 4 5 (5)(7)(7)(9)(10)(35)(44)(44)(50)(66)(79)

Definition at line 2071 of file map_vector_sparse.hpp.

◆ hostToDevice()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int ... prp>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::hostToDevice ( )
inline

Transfer from host to device.

Template Parameters
setof parameters to transfer to device

Definition at line 1851 of file map_vector_sparse.hpp.

◆ insert() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int p>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::insert ( Ti  ele) -> decltype(vct_data.template get<p>(0))
inline

It insert an element in the sparse vector.

Template Parameters
pproperty id
Parameters
eleelement id

Definition at line 1653 of file map_vector_sparse.hpp.

◆ insert() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::insert ( Ti  ele) -> decltype(vct_data.get(0))
inline

It insert an element in the sparse vector.

Parameters
eleelement id

Definition at line 1721 of file map_vector_sparse.hpp.

◆ insertFlush() [1/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<unsigned int p>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::insertFlush ( Ti  ele) -> decltype(vct_data.template get<p>(0))
inline

It insert an element in the sparse vector.

Template Parameters
pproperty id
Parameters
eleelement id

Definition at line 1669 of file map_vector_sparse.hpp.

◆ insertFlush() [2/2]

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
auto openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::insertFlush ( Ti  ele) -> decltype(vct_data.get(0))
inline

It insert an element in the sparse vector.

Parameters
eleelement id

Definition at line 1694 of file map_vector_sparse.hpp.

◆ merge_indexes()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
template<typename ... v_reduce>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::merge_indexes ( vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_add_index_sort,
vector< aggregate< Ti, Ti >, Memory, typename layout_base< aggregate< Ti, Ti >>::type, layout_base, grow_p > &  vct_add_index_unique,
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_merge_index,
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_merge_index_map,
mgpu::ofp_context_t &  context 
)
inlineprivate

Merge indexes.

Parameters

Definition at line 1010 of file map_vector_sparse.hpp.

◆ preFlush()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::preFlush ( )
inline

In case we manually set the added index buffer and the add data buffer we have to call this function before flush.

Definition at line 1895 of file map_vector_sparse.hpp.

◆ private_get_vct_index()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
vector<aggregate<Ti>,Memory,typename layout_base<aggregate<Ti> >::type,layout_base,grow_p>& openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::private_get_vct_index ( )
inline

Return the sorted vector of the indexes.

Returns
return the sorted vector of the indexes

Definition at line 1828 of file map_vector_sparse.hpp.

◆ reorder_indexes()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::reorder_indexes ( vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_add_cont_index,
vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  vct_add_cont_index_map,
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &  vct_add_data_reord,
vector< T, Memory, typename layout_base< T >::type, layout_base, grow_p > &  vct_add_data_cont,
mgpu::ofp_context_t &  context 
)
inlineprivate

sort the continuos array of inserted key

Parameters
contextmodern gpu context
vct_add_cont_indexarray of indexes (unsorted), as output will be sorted
vct_add_cont_index_mapreference to the original indexes
vct_add_data_reordsorted data output
vct_add_data_contadded data in a continuos unsorted array

Definition at line 963 of file map_vector_sparse.hpp.

◆ resize()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::resize ( size_t  n)
inline

resize to n elements

Parameters
nelements

Definition at line 1593 of file map_vector_sparse.hpp.

◆ setGPUInsertBuffer()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::setGPUInsertBuffer ( int  nblock,
int  nslot 
)
inline

set the gpu insert buffer for every block

Parameters
nblocknumber of blocks
nslotnumber of slots free for each block

Definition at line 1881 of file map_vector_sparse.hpp.

◆ setGPURemoveBuffer()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::setGPURemoveBuffer ( int  nblock,
int  nslot 
)
inline

set the gpu remove buffer for every block

Parameters
nblocknumber of blocks
nslotnumber of slots free for each block

Definition at line 1924 of file map_vector_sparse.hpp.

◆ size()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
size_t openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::size ( )
inline

Return how many element you have in this map.

Returns
the number of elements

Definition at line 1818 of file map_vector_sparse.hpp.

◆ swapIndexVector()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
void openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::swapIndexVector ( vector< aggregate< Ti >, Memory, typename layout_base< aggregate< Ti >>::type, layout_base, grow_p > &  iv)
inline
Warning
After using this function to move out the vector of the indexes, this object become useless and must be destroyed
Parameters
iv

Definition at line 1606 of file map_vector_sparse.hpp.

◆ toKernel()

template<typename T, typename Ti = long int, typename Memory = HeapMemory, typename layout = typename memory_traits_lin<T>::type, template< typename > class layout_base = memory_traits_lin, typename grow_p = grow_policy_double, unsigned int impl = vect_isel<T>::value, unsigned int impl2 = VECTOR_SPARSE_STANDARD, typename block_functor = stub_block_functor>
vector_sparse_gpu_ker<T,Ti,layout_base> openfpm::vector_sparse< T, Ti, Memory, layout, layout_base, grow_p, impl, impl2, block_functor >::toKernel ( )
inline

toKernel function transform this structure into one that can be used on GPU

Returns
structure that can be used on GPU

Definition at line 1862 of file map_vector_sparse.hpp.


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