Implementation of 1-D std::vector like structure. More...
Implementation of 1-D std::vector like structure.
this implementation is just a wrapper for the std::vector in the case of data where the members cannot be parsed see openFPM_data wiki for more information
T | base type |
Definition at line 93 of file map_vector_std.hpp.
#include <map_vector_std.hpp>
Data Structures | |
struct | layout_base__ |
Public Types | |
typedef int | yes_i_am_vector |
it define that it is a vector | |
typedef memory_traits_lin< T > | layout_base_ |
typedef vector_key_iterator | iterator_key |
iterator for the vector | |
typedef T | value_type |
Type of the value the vector is storing. | |
typedef void | base_to_copy |
typedef grow_policy_double | grow_policy |
growing policy of this vector | |
Public Member Functions | |
size_t | size () const |
return the size of the vector | |
void | resize (size_t slot) |
void | clear () |
Remove all the element from the vector. | |
void | shrink_to_fit () |
Fit the memory to the size of the vector. | |
void | add (const T &v) |
It insert a new object on the vector, eventually it reallocate the grid. | |
void | add (T &&v) |
It insert a new object on the vector, eventually it reallocate the grid. | |
void | add () |
Add an empty object (it call the default constructor () ) at the end of the vector. | |
template<typename Mem , template< typename > class lb, typename gp > | |
void | add (const openfpm::vector< T, Mem, lb, gp > &eles) |
add elements to the vector | |
template<typename S > | |
void | add (const S &v) |
It insert a new object on the vector, eventually it reallocate the object. | |
template<typename S > | |
void | add (const S &&v) |
It insert a new object on the vector, eventually it reallocate the grid. | |
template<typename S , typename M , typename gp , unsigned int impl, template< typename > class layout_base, unsigned int ... args> | |
void | add_prp (const vector< S, M, layout_base, 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_base, unsigned int ... args> | |
void | add_prp_device (const vector< S, M, layout_base, 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_base, unsigned int ... args> | |
void | add_prp (const T &v) |
It add the element it is equivalent to add. | |
void | erase (typename std::vector< T >::iterator start, typename std::vector< T >::iterator end) |
Erase the elements from start to end. | |
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. | |
auto | begin () -> decltype(base.begin()) |
Return an std compatible iterator to the first element. | |
auto | end () -> decltype(base.begin()) |
Return an std compatible iterator to the last element. | |
auto | begin () const -> const decltype(base.begin()) |
Return an std compatible iterator to the first element. | |
auto | end () const -> const decltype(base.begin()) |
Return an std compatible iterator to the last element. | |
T & | last () |
Get the last element. | |
const T & | last () const |
Get the last element. | |
openfpm::vector< T > | duplicate () const |
Duplicate the vector. | |
void | swap (std::vector< T > &&v) |
swap the memory between the two vector | |
void | unique () |
It eliminate double entries. | |
void | sort () |
It sort the vector. | |
template<unsigned int p> | |
T & | get (size_t id) |
Get an element of the vector. | |
template<unsigned int p> | |
const T & | get (size_t id) const |
Get an element of the vector. | |
T & | get (size_t id) |
Get an element of the vector. | |
const T & | get (size_t id) const |
Get an element of the vector. | |
void | fill (unsigned char fl) |
it fill all the memory of fl patterns | |
void | reserve (size_t ns) |
reserve a memory space in advance to avoid reallocation | |
vector () noexcept | |
Constructor, vector of size 0. | |
vector (size_t sz) noexcept | |
Constructor, vector of size sz. | |
vector (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) noexcept | |
Constructor from another vector. | |
vector (const std::initializer_list< T > &v) | |
Initializer from constructor. | |
vector (vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) noexcept | |
Constructor from another vector. | |
template<class InputIt > | |
vector (InputIt first, InputIt last) | |
Constructor from iterators. | |
~vector () noexcept | |
destructor | |
void | swap (openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) |
void | swap (openfpm::vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) |
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) |
Operator= copy the vector into another. | |
template<typename Mem , typename gp > | |
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (const vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &v) |
Operator= copy the vector into another. | |
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &&v) |
Operator= copy the vector into another. | |
template<typename Mem , typename gp > | |
vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > & | operator= (vector< T, Mem, memory_traits_lin, gp, STD_VECTOR > &&v) |
Operator= copy the vector into another. | |
bool | operator!= (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are equal. | |
bool | operator== (const vector< T, HeapMemory, memory_traits_lin, grow_policy_double, STD_VECTOR > &v) const |
Check that two vectors are not equal. | |
vector_key_iterator | getIterator () const |
Get an iterator over all the elements of the vector. | |
vector_key_iterator | getIteratorTo (size_t k) const |
Get iterator until a specified element. | |
template<int ... prp> | |
size_t | packMem (size_t n, size_t e) const |
Calculate the memory size required to allocate n elements. | |
void * | getPointer () |
Return the pointer to the chunk of memory. | |
template<unsigned int ... prp> | |
void | hostToDevice () |
Do nothing. | |
template<unsigned int ... prp> | |
void | deviceToHost () |
Do nothing. | |
template<unsigned int ... prp> | |
void | deviceToHost (size_t start, size_t stop) |
Do nothing. | |
template<unsigned int ... prp> | |
void | hostToDevice (size_t start, size_t stop) |
Do nothing. | |
const void * | getPointer () const |
Return the pointer to the chunk of memory. | |
size_t | getLastError () |
Return the last error. | |
void | vector_overflow (size_t v1) const |
check that the id does not overflow the buffer | |
Static Public Member Functions | |
static size_t | calculateMemDummy (size_t n, size_t e) |
Calculate the memory size required to allocate 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 memory_traits_lin< T >::type | layout |
Private Attributes | |
std::vector< T > | base |
1-D static grid | |
size_t | err_code = 0 |
Error code. | |
typedef void vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::base_to_copy |
Definition at line 118 of file map_vector_std.hpp.
typedef grow_policy_double vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::grow_policy |
growing policy of this vector
Definition at line 121 of file map_vector_std.hpp.
typedef vector_key_iterator vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::iterator_key |
iterator for the vector
Definition at line 114 of file map_vector_std.hpp.
|
private |
Definition at line 96 of file map_vector_std.hpp.
typedef memory_traits_lin<T> vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::layout_base_ |
Definition at line 111 of file map_vector_std.hpp.
typedef T vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::value_type |
Type of the value the vector is storing.
Definition at line 116 of file map_vector_std.hpp.
typedef int vector< T, HeapMemory, memory_traits_lin, grow_p, STD_VECTOR >::yes_i_am_vector |
it define that it is a vector
Definition at line 109 of file map_vector_std.hpp.
|
inlinenoexcept |
Constructor, vector of size 0.
Definition at line 612 of file map_vector_std.hpp.
|
inlinenoexcept |
Constructor, vector of size sz.
Definition at line 618 of file map_vector_std.hpp.
|
inlinenoexcept |
Constructor from another vector.
Definition at line 624 of file map_vector_std.hpp.
|
inline |
Initializer from constructor.
v | Initializer list |
Definition at line 635 of file map_vector_std.hpp.
|
inlinenoexcept |
Constructor from another vector.
Definition at line 641 of file map_vector_std.hpp.
|
inline |
Constructor from iterators.
Definition at line 649 of file map_vector_std.hpp.
|
inlinenoexcept |
destructor
Definition at line 658 of file map_vector_std.hpp.
|
inline |
Add an empty object (it call the default constructor () ) at the end of the vector.
Definition at line 208 of file map_vector_std.hpp.
|
inline |
add elements to the vector
eles | elements to add |
Definition at line 218 of file map_vector_std.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
vector_isel<T>::value
Definition at line 256 of file map_vector_std.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the object.
v | element to add |
vector_isel<T>::value
Definition at line 242 of file map_vector_std.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
vector_isel<T>::value
Definition at line 174 of file map_vector_std.hpp.
|
inline |
It insert a new object on the vector, eventually it reallocate the grid.
v | element to add |
vector_isel<T>::value
Definition at line 194 of file map_vector_std.hpp.
|
inline |
It add the element it is equivalent to add.
exist to respect a general interface template parameters are unused the explanation refer to the interface specification, but is unused in this case
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 |
Definition at line 336 of file map_vector_std.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 |
Definition at line 287 of file map_vector_std.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 |
Definition at line 312 of file map_vector_std.hpp.
|
inline |
Return an std compatible iterator to the first element.
Definition at line 412 of file map_vector_std.hpp.
|
inline |
Return an std compatible iterator to the first element.
Definition at line 432 of file map_vector_std.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 815 of file map_vector_std.hpp.
|
inlinestatic |
How many allocation are required to create n-elements.
n | number of elements |
Definition at line 827 of file map_vector_std.hpp.
|
inline |
Remove all the element from the vector.
Definition at line 152 of file map_vector_std.hpp.
|
inline |
Do nothing.
Definition at line 852 of file map_vector_std.hpp.
|
inline |
Do nothing.
Definition at line 859 of file map_vector_std.hpp.
|
inline |
Duplicate the vector.
Definition at line 480 of file map_vector_std.hpp.
|
inline |
Return an std compatible iterator to the last element.
Definition at line 422 of file map_vector_std.hpp.
|
inline |
Return an std compatible iterator to the last element.
Definition at line 442 of file map_vector_std.hpp.
|
inline |
Erase the elements from start to end.
start | element |
end | element |
Definition at line 347 of file map_vector_std.hpp.
|
inline |
it fill all the memory of fl patterns
WARNING does not assign a value to each element but it fill the memory Useful to fast set the memory to zero
fl | byte to fill |
Definition at line 596 of file map_vector_std.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 525 of file map_vector_std.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 565 of file map_vector_std.hpp.
|
inline |
Get an element of the vector.
p | must be 0 |
id | element to get |
Definition at line 546 of file map_vector_std.hpp.
|
inline |
Get an element of the vector.
id | element to get |
Definition at line 580 of file map_vector_std.hpp.
|
inline |
Get an iterator over all the elements of the vector.
Definition at line 767 of file map_vector_std.hpp.
|
inline |
Get iterator until a specified element.
k | key |
Definition at line 779 of file map_vector_std.hpp.
|
inline |
|
inline |
Return the pointer to the chunk of memory.
Definition at line 838 of file map_vector_std.hpp.
|
inline |
Return the pointer to the chunk of memory.
Definition at line 874 of file map_vector_std.hpp.
|
inline |
Do nothing.
Definition at line 846 of file map_vector_std.hpp.
|
inline |
Do nothing.
Definition at line 866 of file map_vector_std.hpp.
|
inline |
Get the last element.
Definition at line 452 of file map_vector_std.hpp.
|
inline |
Get the last element.
Definition at line 466 of file map_vector_std.hpp.
|
inlinestatic |
|
inline |
Check that two vectors are equal.
v | vector to compare |
Definition at line 745 of file map_vector_std.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 689 of file map_vector_std.hpp.
|
inline |
Operator= copy the vector into another.
Definition at line 701 of file map_vector_std.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 717 of file map_vector_std.hpp.
|
inline |
Operator= copy the vector into another.
v | vector to copy |
Definition at line 731 of file map_vector_std.hpp.
|
inline |
Check that two vectors are not equal.
v | vector to compare |
Definition at line 757 of file map_vector_std.hpp.
|
inline |
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 794 of file map_vector_std.hpp.
|
inline |
Remove several entries from the vector.
keys | objects id to remove |
start | key starting point |
Definition at line 373 of file map_vector_std.hpp.
|
inline |
Remove one entry from the vector.
key | element to remove |
Definition at line 357 of file map_vector_std.hpp.
|
inline |
reserve a memory space in advance to avoid reallocation
ns | number of element the memory has to store |
Definition at line 606 of file map_vector_std.hpp.
|
inline |
\ brief Resize the vector to contain n elements
slot | number of elements |
Definition at line 144 of file map_vector_std.hpp.
|
inline |
Fit the memory to the size of the vector.
Definition at line 160 of file map_vector_std.hpp.
|
inline |
return the size of the vector
Definition at line 133 of file map_vector_std.hpp.
|
inline |
It sort the vector.
Definition at line 511 of file map_vector_std.hpp.
|
inline |
swap the content of the vector
v | vector to be swapped with |
Definition at line 677 of file map_vector_std.hpp.
|
inline |
swap the content of the vector
v | vector to be swapped with |
Definition at line 667 of file map_vector_std.hpp.
|
inline |
swap the memory between the two vector
v | vector to swap |
Definition at line 490 of file map_vector_std.hpp.
|
inline |
It eliminate double entries.
Definition at line 500 of file map_vector_std.hpp.
|
inline |
check that the id does not overflow the buffer
v1 | id to check |
Definition at line 904 of file map_vector_std.hpp.
|
private |
1-D static grid
Definition at line 101 of file map_vector_std.hpp.
|
private |
Error code.
Definition at line 104 of file map_vector_std.hpp.