2 #ifndef MultiVectorManager_h 3 #define MultiVectorManager_h 14 vectors.emplace_back(vec.begin(), vec.end());
20 return const_cast<T&
>(
static_cast<const MultiVectorManager*
>(
this)->
operator[](globalIndex));
28 size_t localIndex = globalIndex -
offsets[vectorIndex];
30 return vectors[vectorIndex][localIndex];
34 assert(vectorIndex <
vectors.size() &&
"Vector index out of range");
36 const auto& vec =
vectors[vectorIndex];
37 assert(localIndex < vec.size() &&
"Local index out of range");
39 return offsets[vectorIndex] + localIndex;
49 size_t localIndex = globalIndex -
offsets[vectorIndex];
51 return {vectorIndex, localIndex};
std::vector< std::vector< T > > vectors
Iterator(const MultiVectorManager &manager, size_t index)
std::pair< size_t, size_t > getVectorAndLocalIndex(size_t globalIndex) const
bool operator!=(const Iterator &other) const
std::ptrdiff_t difference_type
void addVector(const std::vector< T > &vec)
T & operator[](size_t globalIndex)
const T & operator[](size_t globalIndex) const
std::vector< size_t > offsets
std::forward_iterator_tag iterator_category
const MultiVectorManager & manager
size_t getGlobalIndex(size_t vectorIndex, size_t localIndex) const