OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > Class Template Reference

Implementation of 1-D std::vector like structure. More...

Detailed Description

template<typename T, typename Memory, template< typename > class layout_base, typename grow_p>
class openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >

Implementation of 1-D std::vector like structure.

The layout is memory_traits_lin

Add and access elements

for (size_t i = 0 ; i < n_ele ; i++)
{
v_ofp_test.add();
size_t last = v_ofp_test.size()-1;
// Modify the point
v_ofp_test.get<P::x>(last) = 100.0 + i;
v_ofp_test.get<P::y>(last) = 102.0 + i;
v_ofp_test.get<P::z>(last) = 107.0 + i;
v_ofp_test.get<P::s>(last) = 109.0 + i;
v_ofp_test.get<P::v>(last)[0] = 1.0 + i;
v_ofp_test.get<P::v>(last)[1] = 2.0 + i;
v_ofp_test.get<P::v>(last)[2] = 7.0 + i;
v_ofp_test.get<P::t>(last)[0][0] = 10.0 + i;
v_ofp_test.get<P::t>(last)[0][1] = 13.0 + i;
v_ofp_test.get<P::t>(last)[0][2] = 8.0 + i;
v_ofp_test.get<P::t>(last)[1][0] = 19.0 + i;
v_ofp_test.get<P::t>(last)[1][1] = 23.0 + i;
v_ofp_test.get<P::t>(last)[1][2] = 5.0 + i;
v_ofp_test.get<P::t>(last)[2][0] = 4.0 + i;
v_ofp_test.get<P::t>(last)[2][1] = 3.0 + i;
v_ofp_test.get<P::t>(last)[2][2] = 11.0 + i;
}
Template Parameters
Ttype of object the vector store
Memoryallocator to use
layoutlayout to use
grow_pgrow policy for vector in case of reallocation

OPENFPM_NATIVE implementation

Definition at line 241 of file map_vector.hpp.

#include <map_vector.hpp>

Data Structures

struct  layout_base__
 
struct  pack_cond
 Structures that do a nested packing, depending on the existence of 'pack()' function inside the object. More...
 
struct  pack_cond< true, T1, Memory1, prp... >
 Structures that do a nested packing, depending on the existence of 'pack()' function inside the object. More...
 
struct  pack_simple_cond
 These structures serialize a simple (no "pack()" inside) object. More...
 
struct  pack_simple_cond< true, prp ... >
 These structures serialize a simple (no "pack()" inside) object. More...
 
struct  packMem_cond
 Structures that calculate how many bytes are required to serialize an object. More...
 
struct  packMem_cond< true, T1 >
 Structures that calculate memory for an object, depending on the existence of 'packMem()'. More...
 
struct  unpack_simple_cond
 These structures do an de-serialize a simple object (no pack() inside) More...
 
struct  unpack_simple_cond< true, prp ... >
 

Public Types

typedef int yes_i_am_vector
 it define that it is a vector
 
typedef int yes_i_am_vector_native
 it define that it is a vector
 
typedef layout_base< T >::type layout_type
 Type of the encapsulation memory parameter.
 
typedef layout_base< T > layout_base_
 Type of the encapsulation memory parameter.
 
typedef vector_key_iterator iterator_key
 iterator for the vector
 
typedef grid_base< 1, T, Memory, typename layout_base< T >::type >::container container
 Object container for T, it is the return type of get_o it return a object type trough.
 
typedef T value_type
 Type of the value the vector is storing.
 
typedef Memory Memory_type
 Type of memory this vector use.
 
typedef grow_p grow_policy
 growing policy of this vector
 
typedef size_t access_key
 Access key for the vector.
 

Public Member Functions

template<int ... prp>
void packRequest (size_t &req) const
 It calculate the number of byte required to serialize the object. More...
 
template<int ... prp>
void pack (ExtPreAlloc< HeapMemory > &mem, Pack_stat &sts) const
 pack a vector selecting the properties to pack More...
 
template<int ... prp, typename MemType >
void unpack (ExtPreAlloc< MemType > &mem, Unpack_stat &ps)
 unpack a vector More...
 
size_t size () const
 Return the size of the vector. More...
 
size_t size_local () const
 Return the size of the vector. More...
 
size_t capacity ()
 return the maximum capacity of the vector before reallocation More...
 
void reserve (size_t sp)
 Reserve slots in the vector to avoid reallocation. More...
 
void clear ()
 Clear the vector. More...
 
void shrink_to_fit ()
 Clear the vector. More...
 
void resize (size_t slot, size_t opt=DATA_ON_DEVICE|DATA_ON_HOST, unsigned int blockSize=1)
 Resize the vector. More...
 
void resize_no_device (size_t slot)
 Resize the vector () More...
 
void add ()
 It insert a new emtpy object on the vector, eventually it reallocate the grid. More...
 
void add_no_device ()
 It insert a new emtpy object on the vector, eventually it reallocate the grid. More...
 
void add (const T &v)
 It insert a new object on the vector, eventually it reallocate the grid. More...
 
void add (const typename grid_base< 1, T, Memory, typename layout_base< T >::type >::container &v)
 It insert a new object on the vector, eventually it reallocate the vector. More...
 
template<typename M , typename gp >
void add (const vector< T, M, layout_base, gp, OPENFPM_NATIVE > &v)
 It add the element of another vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , unsigned int ... args>
void merge_prp (const vector< S, M, layout_base, gp, OPENFPM_NATIVE > &v, const openfpm::vector< size_t > &opart)
 It merge the elements of a source vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , unsigned int ... args>
void merge_prp_device (const vector< S, M, layout_base, gp, OPENFPM_NATIVE > &v, unsigned int start)
 It merge the elements of a source vector to this vector (on device) More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void merge_prp_v (const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &v, const vector_opart_type &opart)
 It merge the elements of a source vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void merge_prp_v (const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &v, unsigned int offset, const vector_opart_type &opart)
 It merge the elements of a source vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void merge_prp_v_device (const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &v, const vector_opart_type &opart, unsigned int start, unsigned int stop)
 It merge the elements of a source vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void merge_prp_v_device (const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &v, unsigned int start, const vector_opart_type &opart)
 It merge the elements of a source vector to this vector. More...
 
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, unsigned int ... args>
void merge_prp_v (const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &v, size_t start)
 It merge the elements of a source vector to this vector. More...
 
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base2, unsigned int ... args>
void add_prp (const vector< S, M, layout_base2, gp, impl > &v)
 It add the element of a source vector to this vector. More...
 
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base2, unsigned int ... args>
void add_prp_device (const vector< S, M, layout_base2, gp, impl > &v)
 It add the element of a source vector to this vector. More...
 
void insert (size_t key)
 Insert an entry in the vector. More...
 
void remove (size_t key)
 Remove one entry from the vector. More...
 
void remove (openfpm::vector< size_t > &keys, size_t start=0)
 Remove several entries from the vector. More...
 
void remove (openfpm::vector< aggregate< int >> &keys, size_t start=0)
 Remove several entries from the vector. More...
 
template<unsigned int p>
auto get (size_t id) const -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
bool isSubset () const
 Indicate that this class is not a subset. More...
 
auto get (size_t id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
const grid_base< 1, T, Memory, typename layout_base< T >::type >::container get_o (size_t id) const
 Get an element of the vector. More...
 
template<unsigned int id>
void fill (unsigned char c)
 Fill the buffer with a byte. More...
 
template<unsigned int id>
void * getDeviceBufferCopy ()
 It return the properties arrays. More...
 
template<unsigned int id>
void * getDeviceBuffer ()
 It return the properties arrays. More...
 
const grid_base< 1, T, Memory, layout_type >::container last () const
 Get the last element of the vector. More...
 
template<unsigned int p, typename KeyType >
auto getProp (const KeyType &id) -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
template<unsigned int p, typename keyType >
auto getProp (const keyType &id) const -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
template<unsigned int p>
auto get (size_t id) -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector. More...
 
auto get (size_t id) const -> const decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector. More...
 
grid_base< 1, T, Memory, typename layout_base< T >::type >::container last ()
 Get the last element of the vector. More...
 
 ~vector () THROW
 Destructor.
 
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > duplicate () const
 It duplicate the vector. More...
 
 vector (vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&v)
 Constructor from another temporal vector. More...
 
 vector (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) THROW
 Constructor from another constant vector. More...
 
 vector () THROW
 Constructor, vector of size 0.
 
 vector (size_t sz) THROW
 Constructor, vector of size sz.
 
void set (size_t id, const typename grid_base< 1, T, Memory, typename layout_base< T >::type >::container &obj)
 Set the object id to obj. More...
 
template<typename encap_S , unsigned int ... args>
void set_o (size_t i, const encap_S &obj)
 It set an element of the vector from a object that is a subset of the vector properties. More...
 
void set (size_t id, const T &obj)
 Set the object id to obj. More...
 
void set (size_t id, vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v, size_t src)
 Set the element of the vector v from another element of another vector. More...
 
template<typename key_type >
key_type getOriginKey (key_type vec_key)
 
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&mv)
 Assignment operator. More...
 
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &mv)
 Assignment operator. More...
 
template<typename Mem , typename gp >
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (vector< T, Mem, layout_base, gp, OPENFPM_NATIVE > &&mv)
 Assignment operator. More...
 
template<typename Mem , typename gp >
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (const vector< T, Mem, layout_base, gp, OPENFPM_NATIVE > &mv)
 Assignment operator. More...
 
template<typename Mem , template< typename > class layout_base2>
vector< T, Memory, layout_base2, grow_p, OPENFPM_NATIVE > & operator= (vector< T, Mem, layout_base2, grow_p, OPENFPM_NATIVE > &&mv)
 Assignment operator. More...
 
template<typename Mem , template< typename > class layout_base2, typename check = typename std::enable_if<!std::is_same<typename layout_base2<T>::type,typename layout_base<T>::type>::value >::type>
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (const vector< T, Mem, layout_base2, grow_p, OPENFPM_NATIVE > &mv)
 Assignment operator. More...
 
bool operator!= (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) const
 Check that two vectors are equal. More...
 
bool operator== (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) const
 Check that two vectors are not equal. More...
 
void swap_nomode (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v)
 Swap the memory with another vector. More...
 
void swap (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v)
 Swap the memory with another vector. More...
 
void swap (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&v)
 Swap the memory with another vector. More...
 
vector_key_iterator getIteratorFrom (size_t start) const
 Get iterator over the particles from a particular index. More...
 
vector_key_iterator getIteratorTo (size_t stop) const
 Get iterator over the particles from 0 until a particular index. More...
 
vector_key_iterator getDomainIterator () const
 Get the vector elements iterator. More...
 
vector_key_iterator getIterator () const
 Get the vector elements iterator. More...
 
template<unsigned int p>
vector_key_iterator_ele< p, self_typegetIteratorElements () const
 Get the vector elements iterator. More...
 
size_t packObjectSize ()
 Return the size of the message needed to pack this object. More...
 
size_t packObject (void *mem)
 Pack the object into the given pointer. More...
 
template<unsigned int p>
auto getMemory () -> decltype(base.template getMemory< p >())
 Return the memory object. More...
 
template<unsigned int p = 0>
void setMemory (Memory &mem)
 Set the memory of the base structure using an object. More...
 
void setMemoryArray (Memory *mem)
 Set the memory of the base structure using an object. More...
 
template<unsigned int p = 0>
void * getPointer ()
 Return the pointer that store the data. More...
 
template<unsigned int p = 0>
const void * getPointer () const
 Return the pointer that store the data. More...
 
const size_t & getInternal_v_size () const
 Internal function. More...
 
const grid_base< 1, T, Memory, layout_type > & getInternal_base () const
 Internal function. More...
 
template<unsigned int ... prp>
void hostToDevice ()
 Copy the memory from host to device. More...
 
template<unsigned int ... prp>
void deviceToHost ()
 Synchronize the memory buffer in the device with the memory in the host. More...
 
template<unsigned int ... prp>
void deviceToHost (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host. More...
 
template<unsigned int ... prp>
void hostToDevice (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host. More...
 
template<unsigned int ... prp>
void hostToDeviceNUMA (size_t start, size_t stop)
 Synchronize the memory buffer in the device with the memory in the host respecting NUMA domains. More...
 
template<unsigned int ... prp>
void hostToDeviceNUMA ()
 Synchronize the memory buffer in the device with the memory in the host respecing NUMA domains. More...
 
vector_gpu_ker< typename apply_transform< layout_base, T >::type, layout_base > toKernel ()
 Convert the grid into a data-structure compatible for computing into GPU. More...
 
const vector_gpu_ker< typename apply_transform< layout_base, T >::type, layout_base > toKernel () const
 Convert the grid into a data-structure compatible for computing into GPU. More...
 
template<unsigned int ... prps>
const std::string toString (std::string prefix=std::string())
 
void * internal_get_size_pointer ()
 
void print_size ()
 

Static Public Member Functions

static bool pack ()
 
static bool packRequest ()
 
static bool packMem ()
 
template<int ... prp>
static size_t calculateMem (size_t n, size_t e)
 Calculate the memory size required to allocate n elements. More...
 
template<int ... prp>
static size_t packMem (size_t n, size_t e)
 Calculate the memory size required to pack n elements. More...
 
static size_t calculateNMem (size_t n)
 How many allocation are required to create n-elements. More...
 
static bool noPointers ()
 This class has pointer inside. More...
 

Private Types

typedef vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > self_type
 

Private Member Functions

void non_zero_one (size_t sz[1], size_t arg)
 If the argument is zero return 1 otherwise return the argument. More...
 

Private Attributes

size_t v_size
 
grid_base< 1, T, Memory, typename layout_base< T >::type > base
 1-D static grid
 

Constructor & Destructor Documentation

◆ vector() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::vector ( vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&  v)
inline

Constructor from another temporal vector.

Parameters
vthe vector

Definition at line 1487 of file map_vector.hpp.

◆ vector() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::vector ( const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v)
inline

Constructor from another constant vector.

Parameters
vthe vector

Definition at line 1504 of file map_vector.hpp.

Member Function Documentation

◆ add() [1/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add ( )
inline

It insert a new emtpy object on the vector, eventually it reallocate the grid.

Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

Check if we have enough space

Resize the memory, double up the actual memory allocated for the vector

increase the vector size

Definition at line 490 of file map_vector.hpp.

◆ add() [2/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add ( const T &  v)
inline

It insert a new object on the vector, eventually it reallocate the grid.

Parameters
velement to add
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

Check if we have enough space

Resize the memory, double up the actual memory allocated for the vector

copy the element

increase the vector size

Definition at line 548 of file map_vector.hpp.

◆ add() [3/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add ( const typename grid_base< 1, T, Memory, typename layout_base< T >::type >::container v)
inline

It insert a new object on the vector, eventually it reallocate the vector.

Parameters
vobject (encapsulated)
Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

Check if we have enough space

Resize the memory, double up the actual memory allocated for the vector

copy the added element

increase the vector size

Definition at line 582 of file map_vector.hpp.

◆ add() [4/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename M , typename gp >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add ( const vector< T, M, layout_base, gp, OPENFPM_NATIVE > &  v)
inline

It add the element of another vector to this vector.

Parameters
vfrom where to take the vector

Add the element of v

Definition at line 612 of file map_vector.hpp.

◆ add_no_device()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add_no_device ( )
inline

It insert a new emtpy object on the vector, eventually it reallocate the grid.

Warning
It is not thread safe should not be used in multi-thread environment reallocation, work only on cpu

Check if we have enough space

Resize the memory, double up the actual memory allocated for the vector

increase the vector size

Definition at line 518 of file map_vector.hpp.

◆ add_prp()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base2, unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add_prp ( const vector< S, M, layout_base2, gp, impl > &  v)
inline

It add the element of a source vector to this vector.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector

Add the element of v

Definition at line 1074 of file map_vector.hpp.

◆ add_prp_device()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base2, unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::add_prp_device ( const vector< S, M, layout_base2, gp, impl > &  v)
inline

It add the element of a source vector to this vector.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector

Definition at line 1107 of file map_vector.hpp.

◆ calculateMem()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<int ... prp>
static size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::calculateMem ( size_t  n,
size_t  e 
)
inlinestatic

Calculate the memory size required to allocate n elements.

Calculate the total size required to store n-elements in a vector

Parameters
nnumber of elements
eunused
Returns
the size of the allocation number e

Definition at line 2025 of file map_vector.hpp.

◆ calculateNMem()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
static size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::calculateNMem ( size_t  n)
inlinestatic

How many allocation are required to create n-elements.

Parameters
nnumber of elements
Returns
the number of allocations

Definition at line 2069 of file map_vector.hpp.

◆ capacity()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::capacity ( )
inline

return the maximum capacity of the vector before reallocation

Returns
the capacity of the vector

Definition at line 351 of file map_vector.hpp.

◆ clear()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::clear ( )
inline

Clear the vector.

Eliminate all the elements for from the vector

Definition at line 385 of file map_vector.hpp.

◆ deviceToHost() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::deviceToHost ( )
inline

Synchronize the memory buffer in the device with the memory in the host.

Definition at line 2184 of file map_vector.hpp.

◆ deviceToHost() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::deviceToHost ( size_t  start,
size_t  stop 
)
inline

Synchronize the memory buffer in the device with the memory in the host.

Definition at line 2194 of file map_vector.hpp.

◆ duplicate()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE> openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::duplicate ( ) const
inline

It duplicate the vector.

Returns
a duplicated vector

Definition at line 1464 of file map_vector.hpp.

◆ fill()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int id>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::fill ( unsigned char  c)
inline

Fill the buffer with a byte.

Parameters
cchar to fill the buffer with

Definition at line 1321 of file map_vector.hpp.

◆ get() [1/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p>
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::get ( size_t  id) const -> decltype(base.template get<p>(grid_key_dx<1>(0)))
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 1254 of file map_vector.hpp.

◆ get() [2/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::get ( size_t  id) -> decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Get an element of the vector

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 1284 of file map_vector.hpp.

◆ get() [3/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p>
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::get ( size_t  id) -> decltype(base.template get<p>(grid_key_dx<1>(0)))
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 1408 of file map_vector.hpp.

◆ get() [4/4]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::get ( size_t  id) const -> const decltype(base.get_o(grid_key_dx<1>(id)))
inline

Get an element of the vector.

Get an element of the vector

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 1427 of file map_vector.hpp.

◆ get_o()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const grid_base<1,T,Memory,typename layout_base<T>::type>::container openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::get_o ( size_t  id) const
inline

Get an element of the vector.

Deprecated:

exactly as get, exist to keep the compatibility with grid

Parameters
idElement to get
Returns
the element (encapsulated)

Definition at line 1306 of file map_vector.hpp.

◆ getDeviceBuffer()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int id>
void* openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getDeviceBuffer ( )
inline

It return the properties arrays.

In case of Cuda memory it return the device pointers to pass to the kernels

This variant does not copy the host memory to the device memory

Definition at line 1345 of file map_vector.hpp.

◆ getDeviceBufferCopy()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int id>
void* openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getDeviceBufferCopy ( )
inline

It return the properties arrays.

In case of Cuda memory it return the device pointers to pass to the kernels

Definition at line 1332 of file map_vector.hpp.

◆ getDomainIterator()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector_key_iterator openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getDomainIterator ( ) const
inline

Get the vector elements iterator.

Returns
an iterator to iterate through all the elements of the vector

Definition at line 1942 of file map_vector.hpp.

◆ getInternal_base()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const grid_base<1,T,Memory,layout_type>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getInternal_base ( ) const
inline

Internal function.

Returns
the internal 1D grid base

Definition at line 2166 of file map_vector.hpp.

◆ getInternal_v_size()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const size_t& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getInternal_v_size ( ) const
inline

Internal function.

Returns
the size of the vector

Definition at line 2156 of file map_vector.hpp.

◆ getIterator()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector_key_iterator openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getIterator ( ) const
inline

Get the vector elements iterator.

Returns
an iterator to iterate through all the elements of the vector

Definition at line 1957 of file map_vector.hpp.

◆ getIteratorElements()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p>
vector_key_iterator_ele<p,self_type> openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getIteratorElements ( ) const
inline

Get the vector elements iterator.

Returns
an iterator to iterate through all the elements of the vector

Definition at line 1969 of file map_vector.hpp.

◆ getIteratorFrom()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector_key_iterator openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getIteratorFrom ( size_t  start) const
inline

Get iterator over the particles from a particular index.

Parameters
startstarting point
Returns
an iterator to iterate from a particular index

Definition at line 1900 of file map_vector.hpp.

◆ getIteratorTo()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector_key_iterator openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getIteratorTo ( size_t  stop) const
inline

Get iterator over the particles from 0 until a particular index.

Warning
stop point is not included
Parameters
stopstop point
Returns
an iterator to iterate until a particular index

Definition at line 1914 of file map_vector.hpp.

◆ getMemory()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p>
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getMemory ( ) -> decltype(base.template getMemory<p>())
inline

Return the memory object.

Return the memory object

Template Parameters
parray to retrieve

Definition at line 2082 of file map_vector.hpp.

◆ getPointer() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p = 0>
void* openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getPointer ( )
inline

Return the pointer that store the data.

Template Parameters
propertyfrom which take the pointer
Returns
the pointer that store the data

Definition at line 2126 of file map_vector.hpp.

◆ getPointer() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p = 0>
const void* openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getPointer ( ) const
inline

Return the pointer that store the data.

Returns
the pointer that store the data

Definition at line 2136 of file map_vector.hpp.

◆ getProp() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p, typename KeyType >
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getProp ( const KeyType &  id) -> decltype(base.template get<p>(grid_key_dx<1>(0)))
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 1375 of file map_vector.hpp.

◆ getProp() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p, typename keyType >
auto openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getProp ( const keyType &  id) const -> decltype(base.template get<p>(grid_key_dx<1>(0)))
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 1391 of file map_vector.hpp.

◆ hostToDevice() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::hostToDevice ( )
inline

Copy the memory from host to device.

Definition at line 2175 of file map_vector.hpp.

◆ hostToDevice() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::hostToDevice ( size_t  start,
size_t  stop 
)
inline

Synchronize the memory buffer in the device with the memory in the host.

Definition at line 2203 of file map_vector.hpp.

◆ hostToDeviceNUMA() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::hostToDeviceNUMA ( size_t  start,
size_t  stop 
)
inline

Synchronize the memory buffer in the device with the memory in the host respecting NUMA domains.

Definition at line 2212 of file map_vector.hpp.

◆ hostToDeviceNUMA() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::hostToDeviceNUMA ( )
inline

Synchronize the memory buffer in the device with the memory in the host respecing NUMA domains.

Definition at line 2221 of file map_vector.hpp.

◆ insert()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::insert ( size_t  key)
inline

Insert an entry in the vector.

\size_t key Where to insert the element

Definition at line 1118 of file map_vector.hpp.

◆ isSubset()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::isSubset ( ) const
inline

Indicate that this class is not a subset.

Returns
false

Definition at line 1270 of file map_vector.hpp.

◆ last() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const grid_base<1,T,Memory,layout_type>::container openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::last ( ) const
inline

Get the last element of the vector.

Returns
the last element (encapsulated)

Definition at line 1356 of file map_vector.hpp.

◆ last() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
grid_base<1,T,Memory,typename layout_base<T>::type >::container openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::last ( )
inline

Get the last element of the vector.

Returns
the element (encapsulated)

Definition at line 1446 of file map_vector.hpp.

◆ merge_prp()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp ( const vector< S, M, layout_base, gp, OPENFPM_NATIVE > &  v,
const openfpm::vector< size_t > &  opart 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

*
* 6   8  3   2  1   0  3    v1 elements
*        |   |  |
*       op  op  op
*        |   |  |
*        5   1  9           v2 elements
*
*-------------------------------------
* 6   8  8   3  10  0   3   updated v1 elements
*
* This operation is done for each selected property in args
*
* 

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
startindex from where to start the merging

Add the element of v

Definition at line 655 of file map_vector.hpp.

◆ merge_prp_device()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_device ( const vector< S, M, layout_base, gp, OPENFPM_NATIVE > &  v,
unsigned int  start 
)
inline

It merge the elements of a source vector to this vector (on device)

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

*
* 6   8  3   2  1   0  3    v1 elements
*        |   |  |
*       op  op  op
*        |   |  |
*        5   1  9           v2 elements
*
*-------------------------------------
* 6   8  8   3  10  0   3   updated v1 elements
*
* This operation is done for each selected property in args
*
* 

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
startindex from where to start the merging

Definition at line 714 of file map_vector.hpp.

◆ merge_prp_v() [1/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_v ( const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &  v,
const vector_opart_type &  opart 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

\verbarim

6 8 3 2 1 0 3 v1 elements | | | op op op | | | 5 1 9 v2 elements


6 8 8 3 10 0 3 updated v1 elements

This operation is done for each selected property in args

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
startindex from where to start the merging

Add the element of v

Definition at line 764 of file map_vector.hpp.

◆ merge_prp_v() [2/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_v ( const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &  v,
unsigned int  offset,
const vector_opart_type &  opart 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

\verbarim

6 8 3 2 1 0 3 v1 elements | | | op op op | | | 5 1 9 v2 elements


6 8 8 3 10 0 3 updated v1 elements

This operation is done for each selected property in args

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
offsetoffset from where to copy in v
startindex from where to start the merging

Definition at line 830 of file map_vector.hpp.

◆ merge_prp_v() [3/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_v ( const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &  v,
size_t  start 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

\verbarim

6 8 3 2 1 0 3 v1 elements | | | op op op | | | 5 1 9 v2 elements


6 8 8 3 10 0 3 updated v1 elements

This operation is done for each selected property in args

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
startindex from where to start the merging

Add the element of v

Definition at line 1037 of file map_vector.hpp.

◆ merge_prp_v_device() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_v_device ( const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &  v,
const vector_opart_type &  opart,
unsigned int  start,
unsigned int  stop 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

\verbarim

6 8 3 2 1 0 3 v1 elements | | | op op op | | | 5 1 9 v2 elements


6 8 8 3 10 0 3 updated v1 elements

This operation is done for each selected property in args

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
opartmerging indexes (property 1)
startstarting merging index for opart
stopstop merging index for opart

Definition at line 891 of file map_vector.hpp.

◆ merge_prp_v_device() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<template< typename, typename > class op, typename S , typename M , typename gp , template< typename > class layout_base2, typename vector_opart_type , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::merge_prp_v_device ( const vector< S, M, layout_base2, gp, OPENFPM_NATIVE > &  v,
unsigned int  start,
const vector_opart_type &  opart 
)
inline

It merge the elements of a source vector to this vector.

Given 2 vector v1 and v2 of size 7,3. and as merging operation the function add. Merging the second vector v2 to the first one v1 starting from the element 2. Mean

\verbarim

6 8 3 2 1 0 3 v1 elements | | | op op op | | | 5 1 9 v2 elements


6 8 8 3 10 0 3 updated v1 elements

This operation is done for each selected property in args

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
opmerging operation
SBase object of the source vector
Mmemory type of the source vector
gpGrow policy of the source vector
argsone or more number that define which property to set-up
Parameters
vsource vector
opartmerging indexes (property 0)
istarting mergong indexes

Definition at line 967 of file map_vector.hpp.

◆ non_zero_one()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::non_zero_one ( size_t  sz[1],
size_t  arg 
)
inlineprivate

If the argument is zero return 1 otherwise return the argument.

Parameters
szoutput
argargument

Definition at line 259 of file map_vector.hpp.

◆ noPointers()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
static bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::noPointers ( )
inlinestatic

This class has pointer inside.

Returns
false

Definition at line 2146 of file map_vector.hpp.

◆ operator!=()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator!= ( const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v) const
inline

Check that two vectors are equal.

Parameters
vectorto compare

Definition at line 1793 of file map_vector.hpp.

◆ operator=() [1/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&  mv)
inline

Assignment operator.

move semantic movement operator=

Parameters
mvvector
Returns
itself

Definition at line 1624 of file map_vector.hpp.

◆ operator=() [2/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  mv)
inline

Assignment operator.

it copy

Parameters
mvvector
Returns
itself

Definition at line 1647 of file map_vector.hpp.

◆ operator=() [3/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename Mem , typename gp >
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( vector< T, Mem, layout_base, gp, OPENFPM_NATIVE > &&  mv)
inline

Assignment operator.

move semantic movement operator=

Parameters
mvvector
Returns
itself

Definition at line 1680 of file map_vector.hpp.

◆ operator=() [4/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename Mem , typename gp >
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( const vector< T, Mem, layout_base, gp, OPENFPM_NATIVE > &  mv)
inline

Assignment operator.

it copy

Parameters
mvvector
Returns
itself

Definition at line 1703 of file map_vector.hpp.

◆ operator=() [5/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename Mem , template< typename > class layout_base2>
vector<T, Memory,layout_base2,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( vector< T, Mem, layout_base2, grow_p, OPENFPM_NATIVE > &&  mv)
inline

Assignment operator.

move semantic movement operator=

Parameters
mvvector
Returns
itself

Definition at line 1737 of file map_vector.hpp.

◆ operator=() [6/6]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename Mem , template< typename > class layout_base2, typename check = typename std::enable_if<!std::is_same<typename layout_base2<T>::type,typename layout_base<T>::type>::value >::type>
vector<T, Memory,layout_base,grow_p,OPENFPM_NATIVE>& openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator= ( const vector< T, Mem, layout_base2, grow_p, OPENFPM_NATIVE > &  mv)
inline

Assignment operator.

Parameters
mvvector to copy
Returns
itself

Definition at line 1764 of file map_vector.hpp.

◆ operator==()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::operator== ( const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v) const
inline

Check that two vectors are not equal.

Parameters
vectorto compare

Definition at line 1803 of file map_vector.hpp.

◆ pack() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
static bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::pack ( )
inlinestatic

This file contains the implemetation of packer and unpacker for vector Created on: Jan 5, 2016 Author: Yaroslav Zaluzhnyi and Pietro Incardona

This Function to indicate the vector class has a packer function

Returns
true vector has a pack function

Definition at line 13 of file map_vector.hpp.

◆ pack() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::pack ( ExtPreAlloc< HeapMemory > &  mem,
Pack_stat sts 
) const
inline

pack a vector selecting the properties to pack

Parameters
mempreallocated memory where to pack the vector
stspack-stat info

Definition at line 315 of file map_vector.hpp.

◆ packMem() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
static bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packMem ( )
inlinestatic

This Function indicate that vector class has a packMem function

Returns
true vector has a packMem function

Definition at line 33 of file map_vector.hpp.

◆ packMem() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<int ... prp>
static size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packMem ( size_t  n,
size_t  e 
)
inlinestatic

Calculate the memory size required to pack n elements.

Calculate the total size required to store n-elements in a vector

Parameters
nnumber of elements
eunused
Returns
the size of the allocation number e

Definition at line 2052 of file map_vector.hpp.

◆ packObject()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packObject ( void *  mem)
inline

Pack the object into the given pointer.

Parameters
mempointer
Returns
the size of the packed message

Definition at line 2010 of file map_vector.hpp.

◆ packObjectSize()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packObjectSize ( )
inline

Return the size of the message needed to pack this object.

Returns
The size

Definition at line 1998 of file map_vector.hpp.

◆ packRequest() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
static bool openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packRequest ( )
inlinestatic

This Function indicate that vector class has a packRequest function

Returns
true vector has a packRequest function

Definition at line 23 of file map_vector.hpp.

◆ packRequest() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<int ... prp>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::packRequest ( size_t &  req) const
inline

It calculate the number of byte required to serialize the object.

Template Parameters
prplist of properties
Parameters
reqreference to the total counter required to pack the information

Definition at line 286 of file map_vector.hpp.

◆ remove() [1/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::remove ( size_t  key)
inline

Remove one entry from the vector.

Parameters
keyelement to remove

Definition at line 1140 of file map_vector.hpp.

◆ remove() [2/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::remove ( openfpm::vector< size_t > &  keys,
size_t  start = 0 
)
inline

Remove several entries from the vector.

Warning
the keys in the vector MUST be sorted
Parameters
keysobjects id to remove
startkey starting point

Definition at line 1166 of file map_vector.hpp.

◆ remove() [3/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::remove ( openfpm::vector< aggregate< int >> &  keys,
size_t  start = 0 
)
inline

Remove several entries from the vector.

Warning
the keys in the vector MUST be sorted
Parameters
keysobjects id to remove
startkey starting point

Definition at line 1208 of file map_vector.hpp.

◆ reserve()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::reserve ( size_t  sp)
inline

Reserve slots in the vector to avoid reallocation.

Reserve slots in the vector to avoid reallocation

Parameters
spnumber of slot to reserve

Resize the memory

Definition at line 364 of file map_vector.hpp.

◆ resize()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::resize ( size_t  slot,
size_t  opt = DATA_ON_DEVICE | DATA_ON_HOST,
unsigned int  blockSize = 1 
)
inline

Resize the vector.

Resize the vector and allocate n elements

Parameters
optoptions for resize. In case we know that the data are only on device memory we can use DATA_ONLY_DEVICE, In case we know that the data are only on host memory we can use DATA_ONLY_HOST
blockSizeThe default is equal to 1. In case of accelerator buffer resize indicate the size of the block of threads ( this is used in case of a vector of blocks where the block object override to operator= to distribute threads on each block element )

Resize the memory

Definition at line 419 of file map_vector.hpp.

◆ resize_no_device()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::resize_no_device ( size_t  slot)
inline

Resize the vector ()

Resize the vector and allocate n elements

Parameters
slotnumber of elements
optoptions

Resize the memory

Definition at line 458 of file map_vector.hpp.

◆ set() [1/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::set ( size_t  id,
const typename grid_base< 1, T, Memory, typename layout_base< T >::type >::container obj 
)
inline

Set the object id to obj.

Parameters
idelement
objobject (encapsulated)

copy the element

Definition at line 1548 of file map_vector.hpp.

◆ set() [2/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::set ( size_t  id,
const T &  obj 
)
inline

Set the object id to obj.

Parameters
id
obj

copy the element

Definition at line 1584 of file map_vector.hpp.

◆ set() [3/3]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::set ( size_t  id,
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v,
size_t  src 
)
inline

Set the element of the vector v from another element of another vector.

Parameters
idelement id
vvector source
srcsource element

Definition at line 1600 of file map_vector.hpp.

◆ set_o()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename encap_S , unsigned int ... args>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::set_o ( size_t  i,
const encap_S &  obj 
)
inline

It set an element of the vector from a object that is a subset of the vector properties.

The number of properties in the source vector must be smaller than the destination all the properties of S must be mapped so if S has 3 properties 3 numbers for args are required

Template Parameters
encap_Sobject that encapsulate the object
argsids of the properties to map the object to
Parameters
ielement to set
objobject that encapsulate the object
vsource vector

Definition at line 1572 of file map_vector.hpp.

◆ setMemory()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int p = 0>
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::setMemory ( Memory &  mem)
inline

Set the memory of the base structure using an object.

Parameters
memMemory object to use for allocation

Definition at line 2092 of file map_vector.hpp.

◆ setMemoryArray()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::setMemoryArray ( Memory *  mem)
inline

Set the memory of the base structure using an object.

Parameters
memMemory object to use for allocation

Definition at line 2108 of file map_vector.hpp.

◆ shrink_to_fit()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::shrink_to_fit ( )
inline

Clear the vector.

Eliminate all the elements for from the vector

Definition at line 395 of file map_vector.hpp.

◆ size()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::size ( ) const
inline

Return the size of the vector.

Returns
the size

Definition at line 330 of file map_vector.hpp.

◆ size_local()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::size_local ( ) const
inline

Return the size of the vector.

Returns
the size

Definition at line 340 of file map_vector.hpp.

◆ swap() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::swap ( openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v)
inline

Swap the memory with another vector.

Parameters
vvector

Definition at line 1851 of file map_vector.hpp.

◆ swap() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::swap ( openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&  v)
inline

Swap the memory with another vector.

Parameters
vvector

Definition at line 1875 of file map_vector.hpp.

◆ swap_nomode()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::swap_nomode ( openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &  v)
inline

Swap the memory with another vector.

Note
this is different from the normal swap please look a grid_base_implementation.hpp method swap_nomode for info
Parameters
vvector

Definition at line 1828 of file map_vector.hpp.

◆ toKernel() [1/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
vector_gpu_ker<typename apply_transform<layout_base,T>::type,layout_base> openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::toKernel ( )
inline

Convert the grid into a data-structure compatible for computing into GPU.

The object created can be considered like a reference of the original

Returns
an usable vector in the kernel

Definition at line 2267 of file map_vector.hpp.

◆ toKernel() [2/2]

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const vector_gpu_ker<typename apply_transform<layout_base,T>::type,layout_base> openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::toKernel ( ) const
inline

Convert the grid into a data-structure compatible for computing into GPU.

The object created can be considered like a reference of the original

Returns
an usable vector in the kernel

Definition at line 2281 of file map_vector.hpp.

◆ toString()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<unsigned int ... prps>
const std::string openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::toString ( std::string  prefix = std::string())
inline

Convert this vector into a string

Parameters
prefixprefix to use for printing
Returns
a string showing thid vector

Definition at line 2301 of file map_vector.hpp.

◆ unpack()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<int ... prp, typename MemType >
void openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::unpack ( ExtPreAlloc< MemType > &  mem,
Unpack_stat ps 
)
inline

unpack a vector

Parameters
mempreallocated memory from where to unpack the vector
psunpack-stat info

Definition at line 343 of file map_vector.hpp.

Field Documentation

◆ v_size

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
size_t openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::v_size
private

Actual size of the vector, warning: it is not the space allocated in grid grid size increase by a fixed amount every time we need a vector bigger than the actually allocated space

Definition at line 248 of file map_vector.hpp.


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