2 #ifndef MultiVectorManager_h 3 #define MultiVectorManager_h 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;
47 size_t localIndex = globalIndex -
offsets[vectorIndex];
49 return {vectorIndex, localIndex};
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
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
void addVector(std::span< const T > vec)
std::vector< std::span< const T > > vectors
size_t getGlobalIndex(size_t vectorIndex, size_t localIndex) const