resize the arena \param size size of the array (i.e. number of vectors) \param arena size of the memory arena \param do_alloc a flag to indicate whether to really perform allocations; if false, the function will just return the amount of memory needed \return amount of memory allocated/needed
| 304 | /// \return amount of memory allocated/needed |
| 305 | /// |
| 306 | uint64 resize(const uint32 size, const uint32 arena, const bool do_alloc = true) |
| 307 | { |
| 308 | uint64 bytes = 0; |
| 309 | if (do_alloc) m_arena.resize( arena ); bytes += sizeof(T)*arena; |
| 310 | if (do_alloc) m_index.resize( size ); bytes += sizeof(uint32)*size; |
| 311 | if (do_alloc) m_sizes.resize( size ); bytes += sizeof(uint32)*size; |
| 312 | if (do_alloc) |
| 313 | { |
| 314 | // initialize all slots |
| 315 | thrust::fill( |
| 316 | m_index.begin(), |
| 317 | m_index.begin() + size, |
| 318 | arena ); |
| 319 | |
| 320 | // initialize all slots |
| 321 | thrust::fill( |
| 322 | m_sizes.begin(), |
| 323 | m_sizes.begin() + size, |
| 324 | uint32(0) ); |
| 325 | } |
| 326 | return bytes; |
| 327 | } |
| 328 | |
| 329 | /// check for overlows |
| 330 | /// |