8 #ifndef MAP_VECTOR_STD_CUDA_HPP_ 9 #define MAP_VECTOR_STD_CUDA_HPP_ 11 #include "map_vector_std_cuda_ker.cuh" 48 typedef void base_to_copy;
53 template<
typename Tobj>
73 base.resize_no_device(slot);
93 inline void add(
const T & v)
96 base.template get<0>(size()-1) = v;
110 base.add_no_device();
111 base.template get<0>(size()-1).swap(v);
119 base.add_no_device();
130 if (base.size() == 0)
131 std::cerr <<
"Error vector: " << __FILE__ <<
":" << __LINE__ <<
" vector of size 0\n";
133 return base.template get<0>(size()-1);
144 if (base.size() == 0)
145 std::cerr <<
"Error vector: " << __FILE__ <<
":" << __LINE__ <<
" vector of size 0\n";
147 return base.template get<0>(size()-1);
178 return base.template get<0>(
id);
194 return base.template get<0>(
id);
206 inline const T&
get(
int id)
const 212 return base.template get<0>(
id);
227 return base.template get<0>(
id);
237 inline const T &
get(
size_t id)
const 242 return base.template get<0>(
id);
263 :base(sz),err_code(0)
279 vector(
const std::initializer_list<T> & v)
328 return vector_key_iterator(base.size());
340 return vector_key_iterator(k);
350 return &base.template get<0>(0);
360 return &base.template get<0>(0);
368 base.template hostToDevice<0>();
376 base.template deviceToHost<0>();
383 template<
unsigned int ... prp>
void deviceToHost(
size_t start,
size_t stop)
385 base.template deviceToHost<0>(start,stop);
392 template<
unsigned int ... prp>
void hostToDevice(
size_t start,
size_t stop)
394 base.template hostToDevice<0>(start,stop);
438 if (v1 >= base.size())
440 std::cerr <<
"Error vector: " << __FILE__ <<
":" << __LINE__ <<
" overflow id: " << v1 <<
"\n";\
441 size_t * err_code_pointer = (
size_t *)&this->err_code;\
442 *err_code_pointer = 2001;\
444 ACTION_ON_ERROR(VECTOR_ERROR_OBJECT);\
vector(const std::initializer_list< T > &v)
Initializer from constructor.
const void * getPointer() const
Return the pointer to the chunk of memory.
void swap(vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > &&v)
swap the memory between the two vector
vector_key_iterator iterator_key
iterator for the vector
void reserve(size_t ns)
reserve a memory space in advance to avoid reallocation
void * getPointer()
Return the pointer to the chunk of memory.
void deviceToHost()
Do nothing.
T value_type
Type of the value the vector is storing.
vector(vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > &&v) noexcept
Constructor from another vector.
void add(const T &v)
It insert a new object on the vector, eventually it reallocate the grid.
~vector() noexcept
destructor
size_t getLastError()
Return the last error.
grid interface available when on gpu
static bool noPointers()
This class has pointer inside.
vector_key_iterator getIterator() const
Get an iterator over all the elements of the vector.
int yes_i_am_vector
it define that it is a vector
void hostToDevice(size_t start, size_t stop)
Do nothing.
Transform the boost::fusion::vector into memory specification (memory_traits)
vector< aggregate< T >, CudaMemory, memory_traits_inte, grow_policy_double > base
1-D static grid
vector() noexcept
Constructor, vector of size 0.
T & get(int id)
Get an element of the vector.
void add(T &&v)
It insert a new object on the vector, eventually it reallocate the grid.
Implementation of 1-D std::vector like structure.
T & last()
Get the last element.
vector_key_iterator getIteratorTo(size_t k) const
Get iterator until a specified element.
T & get(size_t id)
Get an element of the vector.
vector_custd_ker< typename apply_transform< memory_traits_inte, aggregate< T > >::type, memory_traits_inte > toKernel()
Convert the grid into a data-structure compatible for computing into GPU.
void hostToDevice()
Do nothing.
const T & last() const
Get the last element.
grow_policy_double grow_policy
growing policy of this vector
size_t size() const
return the size of the vector
vector(size_t sz) noexcept
Constructor, vector of size sz.
const T & get(int id) const
Get an element of the vector.
vector(const vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > &v) noexcept
Constructor from another vector.
void swap(vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > &v)
T & operator[](int id)
Get an element of the vector.
void deviceToHost(size_t start, size_t stop)
Do nothing.
const T & get(size_t id) const
Get an element of the vector.
void vector_overflow(size_t v1) const
check that the id does not overflow the buffer
void add()
Add an empty object (it call the default constructor () ) at the end of the vector.
void clear()
Remove all the element from the vector.
vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > & operator=(const vector< T, CudaMemory, memory_traits_inte, grow_policy_double, STD_VECTOR > &v)
Operator= copy the vector into another.