OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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;
}
static const unsigned int x
x property is at position 0 in the boost::fusion::vector
static const unsigned int s
s property is at position 3 in the boost::fusion::vector
static const unsigned int v
v property is at position 4 in the boost::fusion::vector
static const unsigned int y
y property is at position 1 in the boost::fusion::vector
static const unsigned int z
z property is at position 2 in the boost::fusion::vector
static const unsigned int t
t property is at position 5 in the boost::fusion::vector
const grid_base< 1, T, Memory, layout_type >::container last() const
Get the last element of the vector.
Implementation of 1-D std::vector like structure.
size_t size()
Stub size.
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__
 

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, typenamelayout_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

size_t size () const
 Return the size of the vector.
 
size_t size_local () const
 Return the size of the vector.
 
size_t capacity ()
 return the maximum capacity of the vector before reallocation
 
void reserve (size_t sp)
 Reserve slots in the vector to avoid reallocation.
 
void clear ()
 Clear the vector.
 
void shrink_to_fit ()
 Clear the vector.
 
void resize (size_t slot, size_t opt=DATA_ON_DEVICE|DATA_ON_HOST, unsigned int blockSize=1)
 Resize the vector.
 
void resize_no_device (size_t slot)
 Resize the vector ()
 
void add ()
 It insert a new emtpy object on the vector, eventually it reallocate the grid.
 
void add_no_device ()
 It insert a new emtpy object on the vector, eventually it reallocate the grid.
 
void add (const T &v)
 It insert a new object on the vector, eventually it reallocate the grid.
 
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.
 
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.
 
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.
 
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)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
void insert (size_t key)
 Insert an entry in the vector.
 
void remove (size_t key)
 Remove one entry from the vector.
 
void remove (openfpm::vector< size_t > &keys, size_t start=0)
 Remove several entries from the vector.
 
void remove (openfpm::vector< aggregate< int > > &keys, size_t start=0)
 Remove several entries from the vector.
 
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.
 
bool isSubset () const
 Indicate that this class is not a subset.
 
auto get (size_t id) -> decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
const grid_base< 1, T, Memory, typenamelayout_base< T >::type >::container get_o (size_t id) const
 Get an element of the vector.
 
template<unsigned int id>
void fill (unsigned char c)
 Fill the buffer with a byte.
 
template<unsigned int id>
void * getDeviceBufferCopy ()
 It return the properties arrays.
 
template<unsigned int id>
void * getDeviceBuffer ()
 It return the properties arrays.
 
const grid_base< 1, T, Memory, layout_type >::container last () const
 Get the last element of the vector.
 
template<unsigned int p>
auto getProp (const unsigned int &id) -> decltype(base.template get< p >(grid_key_dx< 1 >(0)))
 Get an element of the vector.
 
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.
 
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.
 
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.
 
auto get (size_t id) const -> const decltype(base.get_o(grid_key_dx< 1 >(id)))
 Get an element of the vector.
 
grid_base< 1, T, Memory, typenamelayout_base< T >::type >::container last ()
 Get the last element of the vector.
 
 ~vector () THROW
 Destructor.
 
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > duplicate () const
 It duplicate the vector.
 
 vector (vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&v)
 Constructor from another temporal vector.
 
 vector (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) THROW
 Constructor from another constant vector.
 
 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.
 
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.
 
void set (size_t id, const T &obj)
 Set the object id to obj.
 
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.
 
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.
 
vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > & operator= (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &mv)
 Assignment operator.
 
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.
 
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.
 
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.
 
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.
 
bool operator!= (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) const
 Check that two vectors are equal.
 
bool operator== (const vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v) const
 Check that two vectors are not equal.
 
void swap_nomode (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v)
 Swap the memory with another vector.
 
void swap (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &v)
 Swap the memory with another vector.
 
void swap (openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE > &&v)
 Swap the memory with another vector.
 
vector_key_iterator getIteratorFrom (size_t start) const
 Get iterator over the particles from a particular index.
 
vector_key_iterator getIteratorTo (size_t stop) const
 Get iterator over the particles from 0 until a particular index.
 
vector_key_iterator getDomainIterator () const
 Get the vector elements iterator.
 
vector_key_iterator getIterator () const
 Get the vector elements iterator.
 
template<unsigned int p>
vector_key_iterator_ele< p, self_typegetIteratorElements () const
 Get the vector elements iterator.
 
size_t packObjectSize ()
 Return the size of the message needed to pack this object.
 
size_t packObject (void *mem)
 Pack the object into the given pointer.
 
template<unsigned int p>
auto getMemory () -> decltype(base.template getMemory< p >())
 Return the memory object.
 
template<unsigned int p = 0>
void setMemory (Memory &mem)
 Set the memory of the base structure using an object.
 
void setMemoryArray (Memory *mem)
 Set the memory of the base structure using an object.
 
template<unsigned int p = 0>
void * getPointer ()
 Return the pointer that store the data.
 
template<unsigned int p = 0>
const void * getPointer () const
 Return the pointer that store the data.
 
const size_t & getInternal_v_size () const
 Internal function.
 
const grid_base< 1, T, Memory, layout_type > & getInternal_base () const
 Internal function.
 
template<unsigned int ... prp>
void hostToDevice ()
 Copy the memory from host to device.
 
template<unsigned int ... prp>
void deviceToHost ()
 Synchronize the memory buffer in the device with the memory in the host.
 
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.
 
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.
 
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.
 
template<unsigned int ... prp>
void hostToDeviceNUMA ()
 Synchronize the memory buffer in the device with the memory in the host respecing NUMA domains.
 
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.
 
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.
 
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

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

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.
 

Private Attributes

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

Member Typedef Documentation

◆ access_key

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

Access key for the vector.

Definition at line 482 of file map_vector.hpp.

◆ container

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
typedef grid_base<1,T,Memory,typenamelayout_base<T>::type>::container openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::container

Object container for T, it is the return type of get_o it return a object type trough.

Definition at line 305 of file map_vector.hpp.

◆ grow_policy

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

growing policy of this vector

Definition at line 314 of file map_vector.hpp.

◆ iterator_key

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

iterator for the vector

Definition at line 301 of file map_vector.hpp.

◆ layout_base_

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

Type of the encapsulation memory parameter.

Definition at line 298 of file map_vector.hpp.

◆ layout_type

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

Type of the encapsulation memory parameter.

Definition at line 295 of file map_vector.hpp.

◆ Memory_type

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

Type of memory this vector use.

Definition at line 311 of file map_vector.hpp.

◆ self_type

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

Definition at line 243 of file map_vector.hpp.

◆ value_type

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

Type of the value the vector is storing.

Definition at line 308 of file map_vector.hpp.

◆ yes_i_am_vector

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

it define that it is a vector

Definition at line 289 of file map_vector.hpp.

◆ yes_i_am_vector_native

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

it define that it is a vector

Definition at line 292 of file map_vector.hpp.

Constructor & Destructor Documentation

◆ ~vector()

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

Destructor.

Definition at line 1468 of file map_vector.hpp.

◆ vector() [1/4]

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 1501 of file map_vector.hpp.

◆ vector() [2/4]

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 1518 of file map_vector.hpp.

◆ vector() [3/4]

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

Constructor, vector of size 0.

Definition at line 1531 of file map_vector.hpp.

◆ vector() [4/4]

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

Constructor, vector of size sz.

Definition at line 1544 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 2049 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 2093 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 2208 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 2218 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 1478 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 >
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() [2/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 1422 of file map_vector.hpp.

◆ get() [3/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 1441 of file map_vector.hpp.

◆ get() [4/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_o()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
const grid_base< 1, T, Memory, typenamelayout_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 1958 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 2190 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 2180 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 1973 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 1985 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 1915 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 1929 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 2106 of file map_vector.hpp.

◆ getOriginKey()

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
template<typename key_type >
key_type openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::getOriginKey ( key_type  vec_key)
inline

Definition at line 1623 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 2150 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 2160 of file map_vector.hpp.

◆ getProp() [1/3]

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 1388 of file map_vector.hpp.

◆ getProp() [2/3]

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 1405 of file map_vector.hpp.

◆ getProp() [3/3]

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 >::getProp ( const unsigned int &  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 1373 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 2199 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 2227 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 ( )
inline

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

Definition at line 2245 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 ( 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 2236 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.

◆ internal_get_size_pointer()

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

Definition at line 2349 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 >
grid_base< 1, T, Memory, typenamelayout_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 1460 of file map_vector.hpp.

◆ last() [2/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.

◆ 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, 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() [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, 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_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 2170 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 1808 of file map_vector.hpp.

◆ operator=() [1/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 1718 of file map_vector.hpp.

◆ operator=() [2/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 1779 of file map_vector.hpp.

◆ operator=() [3/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 1661 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= ( vector< T, Mem, layout_base, gp, OPENFPM_NATIVE > &&  mv)
inline

Assignment operator.

move semantic movement operator=

Parameters
mvvector
Returns
itself

Definition at line 1695 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 1752 of file map_vector.hpp.

◆ operator=() [6/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 1638 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 1818 of file map_vector.hpp.

◆ packMem()

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 2076 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 2034 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 2022 of file map_vector.hpp.

◆ print_size()

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

Definition at line 2351 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 ( 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.

◆ 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 ( size_t  key)
inline

Remove one entry from the vector.

Parameters
keyelement to remove

Definition at line 1140 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 T &  obj 
)
inline

Set the object id to obj.

Parameters
id
obj

copy the element

Definition at line 1598 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 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 1562 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 1614 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 1586 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 2116 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 2132 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 1890 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 1866 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 1843 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 2291 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 2305 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 2325 of file map_vector.hpp.

Field Documentation

◆ base

template<typename T , typename Memory , template< typename > class layout_base, typename grow_p >
grid_base<1,T,Memory,typename layout_base<T>::type> openfpm::vector< T, Memory, layout_base, grow_p, OPENFPM_NATIVE >::base
private

1-D static grid

Definition at line 251 of file map_vector.hpp.

◆ 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: