Implementation of 1-D std::vector like structure. More...
Implementation of 1-D std::vector like structure.
The layout is memory_traits_lin
T | type of object the vector store |
base | memory layout to use |
Memory | allocator to use |
grow_p | grow policy for vector in case of reallocation |
OPENFPM_NATIVE implementation
Definition at line 166 of file map_vector.hpp.
#include <map_vector.hpp>
Data Structures | |
struct | pack_cond |
struct | pack_cond< true, T1, Memory1, prp...> |
struct | packMem_cond |
struct | packMem_cond< true, T1 > |
Public Types | |
typedef int | yes_i_am_vector |
it define that it is a vector | |
typedef grid_cpu< 1, T > ::memory_conf | memory_conf |
Type of the encapsulation memory parameter. | |
typedef vector_key_iterator | iterator_key |
iterator for the vector | |
typedef grid_cpu< 1, T >::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 size_t | access_key |
Access key for the vector. | |
Public Member Functions | |
template<int... prp> | |
void | pack (ExtPreAlloc< Memory > &mem, Pack_stat &sts) |
pack a vector selecting the properties to pack More... | |
template<int... prp> | |
void | packRequest (std::vector< size_t > &v) |
Insert an allocation request into the vector. More... | |
template<unsigned int... prp> | |
void | unpack (ExtPreAlloc< Memory > &mem, Unpack_stat &ps) |
unpack a vector More... | |
size_t | size () const |
Return the size of the vector. More... | |
void | reserve (size_t sp) |
Reserve slots in the vector to avoid reallocation. More... | |
void | clear () |
Clear the vector. More... | |
void | resize (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 (const T &v) |
It insert a new object on the vector, eventually it reallocate the grid. More... | |
void | add (const typename grid_cpu< 1, T >::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, gp, OPENFPM_NATIVE > &v) |
It add the element of another vector to this vector. More... | |
template<typename S , typename M , typename gp , unsigned int... args> | |
void | add_prp (const vector< S, M, gp, OPENFPM_NATIVE > &v) |
It add the element of a source vector to this 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... | |
template<unsigned int p> | |
const type_cpu_prop< p, memory_lin >::type & | get (size_t id) const |
Get an element of the vector. More... | |
const grid_cpu< 1, T >::container | get (size_t id) const |
Get an element of the vector. More... | |
const grid_cpu< 1, T >::container | last () const |
Get the last element of the vector. More... | |
template<unsigned int p> | |
type_cpu_prop< p, memory_lin > ::type & | get (size_t id) |
Get an element of the vector. More... | |
grid_cpu< 1, T >::container | get (size_t id) |
Get an element of the vector. More... | |
grid_cpu< 1, T >::container | last () |
Get the last element of the vector. More... | |
~vector () THROW | |
Destructor. | |
vector< T, Memory, grow_p, OPENFPM_NATIVE > | duplicate () const |
It duplicate the vector. More... | |
vector (vector< T, Memory, grow_p, OPENFPM_NATIVE > &&v) | |
Constructor from another temporal vector. More... | |
vector (const vector< T, Memory, 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_cpu< 1, T >::container &obj) |
Set the object id to obj. More... | |
void | set (size_t id, const T &obj) |
Set the object id to obj. More... | |
void | set (size_t id, vector< T, Memory, grow_p, OPENFPM_NATIVE > &v, size_t src) |
Set the element of the vector v from another element of another vector. More... | |
vector< T, Memory, grow_p, OPENFPM_NATIVE > & | operator= (vector< T, Memory, grow_p, OPENFPM_NATIVE > &&mv) |
Assignment operator. More... | |
vector< T, Memory, grow_p, OPENFPM_NATIVE > & | operator= (const vector< T, Memory, grow_p, OPENFPM_NATIVE > &mv) |
Assignment operator. More... | |
bool | operator!= (const vector< T, Memory, grow_p, OPENFPM_NATIVE > &v) const |
Check that two vectors are equal. More... | |
bool | operator== (const vector< T, Memory, grow_p, OPENFPM_NATIVE > &v) const |
Check that two vectors are not equal. More... | |
void | swap (openfpm::vector< T, Memory, grow_p, OPENFPM_NATIVE > &v) |
Swap the memory with another vector. More... | |
void | swap (openfpm::vector< T, Memory, grow_p, OPENFPM_NATIVE > &&v) |
Swap the memory with another vector. More... | |
vector_key_iterator | getIteratorFrom (size_t mark) const |
Get iterator over the particles from a particular index. More... | |
vector_key_iterator | getIterator () 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... | |
void | setMemory (Memory &mem) |
Set the memory of the base structure using an object. More... | |
void * | getPointer () |
Return the pointer that store the data. More... | |
const void * | getPointer () const |
Return the pointer that store the data. More... | |
size_t | getLastError () |
Return the last error. More... | |
long int | who () |
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 grid_cpu< 1, T, Memory > ::memory_lin | memory_lin |
This structure use this layout. | |
Private Member Functions | |
std::vector< size_t > | getV (size_t sz) |
Create a 1D vector that contain the vector size. More... | |
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_cpu< 1, T, Memory > | base |
1-D static grid | |
size_t | err_code |
Error code. | |
|
inline |
Constructor from another temporal vector.
v | the vector |
Definition at line 671 of file map_vector.hpp.
|
inline |
Constructor from another constant vector.
v | the vector |
Definition at line 686 of file map_vector.hpp.
|
inline |
It insert a new emtpy object on the vector, eventually it reallocate the grid.
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 319 of file map_vector.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
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 346 of file map_vector.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the vector.
v | object (encapsulated) |
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 377 of file map_vector.hpp.
|
inline |
It add the element of another vector to this vector.
v | from where to take the vector |
Add the element of v
Definition at line 404 of file map_vector.hpp.
|
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
S | Base object of the source vector |
M | memory type of the source vector |
gp | Grow policy of the source vector |
args | one or more number that define which property to set-up |
v | source vector |
Add the element of v
Definition at line 428 of file map_vector.hpp.
|
inlinestatic |
Calculate the memory size required to allocate n elements.
Calculate the total size required to store n-elements in a vector
n | number of elements |
e | unused |
Definition at line 954 of file map_vector.hpp.
|
inlinestatic |
How many allocation are required to create n-elements.
n | number of elements |
Definition at line 1002 of file map_vector.hpp.
|
inline |
Clear the vector.
Eliminate all the elements for from the vector
Definition at line 275 of file map_vector.hpp.
|
inline |
|
inline |
Get an element of the vector.
Get an element of the vector
p | Property to get |
id | Element to get |
Definition at line 524 of file map_vector.hpp.
|
inline |
Get an element of the vector.
Get an element of the vector
id | Element to get |
Definition at line 547 of file map_vector.hpp.
|
inline |
Get an element of the vector.
Get an element of the vector
p | Property to get |
id | Element to get |
Definition at line 587 of file map_vector.hpp.
|
inline |
Get an element of the vector.
Get an element of the vector
id | Element to get |
Definition at line 610 of file map_vector.hpp.
|
inline |
Get the vector elements iterator.
Definition at line 907 of file map_vector.hpp.
|
inline |
Get iterator over the particles from a particular index.
Definition at line 892 of file map_vector.hpp.
|
inline |
Return the last error.
Definition at line 1049 of file map_vector.hpp.
|
inline |
Return the pointer that store the data.
Definition at line 1025 of file map_vector.hpp.
|
inline |
Return the pointer that store the data.
Definition at line 1038 of file map_vector.hpp.
|
inlineprivate |
Create a 1D vector that contain the vector size.
Used to construct the underline 1D-grid
sz | size of the vector |
Definition at line 191 of file map_vector.hpp.
|
inline |
Get the last element of the vector.
Definition at line 566 of file map_vector.hpp.
|
inline |
Get the last element of the vector.
Definition at line 629 of file map_vector.hpp.
|
inlineprivate |
If the argument is zero return 1 otherwise return the argument.
sz | output |
arg | argument |
Definition at line 206 of file map_vector.hpp.
|
inlinestatic |
|
inline |
Check that two vectors are equal.
vector | to compare |
Definition at line 822 of file map_vector.hpp.
|
inline |
Assignment operator.
move semantic movement operator=
mv | vector |
Definition at line 778 of file map_vector.hpp.
|
inline |
Assignment operator.
it copy
mv | vector |
Definition at line 798 of file map_vector.hpp.
|
inline |
Check that two vectors are not equal.
vector | to compare |
Definition at line 832 of file map_vector.hpp.
|
inlinestatic |
This file include the implemetation of packer and unpacker for vector
Definition at line 8 of file map_vector.hpp.
|
inline |
pack a vector selecting the properties to pack
mem | preallocated memory where to pack the vector |
obj | object to pack |
sts | pack-stat info |
Definition at line 91 of file map_vector.hpp.
|
inlinestatic |
Calculate the memory size required to pack n elements.
Calculate the total size required to store n-elements in a vector
n | number of elements |
e | unused |
Definition at line 983 of file map_vector.hpp.
|
inline |
Pack the object into the given pointer.
mem | pointer |
Definition at line 936 of file map_vector.hpp.
|
inline |
Return the size of the message needed to pack this object.
Definition at line 921 of file map_vector.hpp.
|
inline |
Insert an allocation request into the vector.
obj | vector object to pack |
requests | vector |
Definition at line 139 of file map_vector.hpp.
|
inline |
Remove one entry from the vector.
key | element to remove |
Definition at line 449 of file map_vector.hpp.
|
inline |
Remove several entries from the vector.
keys | objects id to remove |
start | key starting point |
Definition at line 476 of file map_vector.hpp.
|
inline |
Reserve slots in the vector to avoid reallocation.
Reserve slots in the vector to avoid reallocation
sp | number of slot to reserve |
Resize the memory
Definition at line 257 of file map_vector.hpp.
|
inline |
Resize the vector.
Resize the vector and allocate n elements
slot | number of elements |
Resize the memory
Definition at line 290 of file map_vector.hpp.
|
inline |
Set the object id to obj.
id | element |
obj | object (encapsulated) |
copy the element
Definition at line 721 of file map_vector.hpp.
|
inline |
Set the object id to obj.
id | |
obj |
copy the element
Definition at line 739 of file map_vector.hpp.
|
inline |
Set the element of the vector v from another element of another vector.
id | element id |
v | vector source |
src | source element |
Definition at line 758 of file map_vector.hpp.
|
inline |
Set the memory of the base structure using an object.
mem | Memory object to use for allocation |
Definition at line 1012 of file map_vector.hpp.
|
inline |
|
inline |
Swap the memory with another vector.
v | vector |
Definition at line 854 of file map_vector.hpp.
|
inline |
Swap the memory with another vector.
v | vector |
Definition at line 873 of file map_vector.hpp.
|
inline |
unpack a vector
ext | preallocated memory from where to unpack the vector |
obj | object where to unpack |
Definition at line 162 of file map_vector.hpp.
|
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 174 of file map_vector.hpp.