21 #include <type_traits> 31 template<
size_t,
class E>
47 template<
size_t M,
class E>
83 template<
typename,
typename...>
class ID_STORAGE_TYPE = std::vector,
84 template<
typename,
typename...>
class STORAGE_TYPE = ID_STORAGE_TYPE>
89 using id_t =
typename std::remove_pointer<T>::type::id_t;
101 using ref_t =
typename index_space_ref_type<T>::type;
129 : items_(&items), begin_(0), end_(items_->size()) {}
135 : items_(&items), begin_(begin), end_(end) {}
140 typename id_storage_t::const_iterator
begin()
const {
141 return items_->begin() + begin_;
147 typename id_storage_t::const_iterator
end()
const {
148 return items_->begin() + end_;
171 : items_(&items), index_(index), end_(end), s_(s) {}
180 : items_(&items), index_(index), end_(end),
187 return index_ == itr.index_;
194 return index_ != itr.index_;
201 return index_ < itr.index_;
208 return index_ <= itr.index_;
215 return index_ > itr.index_;
222 return index_ >= itr.index_;
229 return index_ - itr.index_;
236 return static_cast<cast_t>((*s_)[(*items_)[index].index_space_index()]);
261 template<
class S,
class P>
274 :
B(s, items, index, end) {}
283 :
B(s, items, index, end) {}
324 itr.B::index_ += offset;
333 itr2.B::index_ += offset;
342 itr.B::index_ -= offset;
351 itr2.B::index_ = offset - itr.B::index_;
375 while(B::index_ < B::end_) {
376 T & item = B::get_(B::index_);
383 assert(
false &&
"end of range");
390 while(B::index_ < B::end_) {
391 T & item = B::get_(B::index_);
398 assert(
false &&
"end of range");
424 :
B(s, items, index, end) {}
433 :
B(s, items, index, end) {}
474 itr.B::index_ += offset;
483 itr2.B::index_ += offset;
492 itr.B::index_ -= offset;
501 itr2.B::index_ = offset - itr.B::index_;
525 return B::get_(B::index_);
532 return &B::get_(B::index_);
541 : v_(new
id_storage_t), begin_(0), end_(0), owned_(true), sorted_(SORTED),
543 assert((STORAGE || !storage) &&
"invalid instantiation");
555 template<
typename,
typename...>
556 class ID_STORAGE_TYPE2,
557 template<
typename,
typename...>
568 : v_(is.v_), begin_(begin), end_(end), owned_(false), sorted_(is.sorted_),
569 s_(reinterpret_cast<
storage_t *>(is.s_)) {
572 std::is_convertible<T, S>::value,
"invalid index space construction");
573 static_assert(!STORAGE,
"expected !STORAGE");
574 static_assert(!OWNED,
"expected !OWNED");
581 : v_(OWNED ? new
id_storage_t(*is.v_) : is.v_), begin_(is.begin_),
582 end_(is.end_), owned_(OWNED), sorted_(is.sorted_), s_(is.s_) {
583 assert(s_ &&
"no storage");
584 static_assert(!STORAGE,
"expected !STORAGE");
591 : v_(std::move(is.v_)), begin_(std::move(is.begin_)),
592 end_(std::move(is.end_)), sorted_(std::move(is.sorted_)),
593 s_(std::move(is.s_)) {
595 if(OWNED || is.owned_) {
615 if(OWNED || owned_) {
649 assert(!STORAGE &&
"invalid assignment");
663 sorted_ = is.sorted_;
673 v_ = std::move(is.v_);
675 if(OWNED || is.owned_) {
683 begin_ = std::move(is.begin_);
684 end_ = std::move(is.end_);
685 sorted_ = std::move(is.sorted_);
686 s_ = std::move(is.s_);
703 bool STORAGE2 = STORAGE,
705 bool SORTED2 = SORTED,
707 template<
typename,
typename...>
class ID_STORAGE_TYPE2 = ID_STORAGE_TYPE,
708 template<
typename,
typename...>
class STORAGE_TYPE2 = STORAGE_TYPE>
710 static_assert(std::is_convertible<S, T>::value,
"invalid index space cast");
718 STORAGE_TYPE2
> *>(
this);
719 assert(res !=
nullptr &&
"invalid cast");
728 bool STORAGE2 = STORAGE,
730 bool SORTED2 = SORTED,
732 template<
typename,
typename...>
class ID_STORAGE_TYPE2 = ID_STORAGE_TYPE,
733 template<
typename,
typename...>
class STORAGE_TYPE2 = STORAGE_TYPE>
735 static_assert(std::is_convertible<S, T>::value,
"invalid index space cast");
743 STORAGE_TYPE2
> *>(
this);
744 assert(res !=
nullptr &&
"invalid cast");
752 return iterator_<T, F>(s_, *v_, begin_, end_);
759 return iterator_<const T, F>(s_, *v_, begin_, end_);
766 return iterator_<T, F>(s_, *v_, end_, end_);
773 return iterator_<const T, F>(s_, *v_, end_, end_);
794 return (*s_)[(*v_)[offset].index_space_index()];
801 return (*s_)[(*v_)[offset].index_space_index()];
808 return id_range_(*v_, begin_, end_);
814 id_range_
ids(
size_t begin,
size_t end)
const {
815 return id_range_(*v_, begin, end);
821 id_range_
ids(
const std::pair<size_t, size_t> & p)
const {
822 return id_range_(*v_, p.first, p.second);
832 template<
class S = T>
833 auto slice(
size_t begin,
size_t end)
const {
840 STORAGE_TYPE>(*
this, begin, end);
851 template<
class S = T>
852 auto slice(
const std::pair<size_t, size_t> & range)
const {
859 STORAGE_TYPE>(*
this, range.first, range.second);
869 template<
class S = T>
877 STORAGE_TYPE>(*
this, begin_, end_);
884 return static_cast<cast_t>(
885 (*s_)[(*v_)[begin_ + offset].index_space_index()]);
892 return static_cast<cast_t>(
893 (*s_)[(*v_)[begin_ + offset].index_space_index()]);
900 return static_cast<cast_t>(
901 (*s_)[(*v_)[end_ - 1 - offset].index_space_index()]);
908 return static_cast<cast_t>(
909 (*s_)[(*v_)[end_ - 1 - offset].index_space_index()]);
931 return (*v_)[begin_ + i];
939 return (*v_)[begin_ + i];
974 return end_ - begin_;
981 return begin_ == end_;
991 if(OWNED || owned_) {
1005 template<
bool STORAGE2,
1009 template<
typename,
typename...>
1010 class INDEX_STORAGE_TYPE2,
1011 template<
typename,
typename...>
1012 class STORAGE_TYPE2>
1018 INDEX_STORAGE_TYPE2,
1019 STORAGE_TYPE2> & master) {
1025 INDEX_STORAGE_TYPE2,
1026 STORAGE_TYPE2
> &>(master));
1033 template<
bool STORAGE2,
1037 template<
typename,
typename...>
1038 class INDEX_STORAGE_TYPE2,
1039 template<
typename,
typename...>
1040 class STORAGE_TYPE2>
1046 INDEX_STORAGE_TYPE2,
1047 STORAGE_TYPE2> & master) {
1048 s_ =
reinterpret_cast<storage_t *
>(master.s_);
1056 return to_vec_<const T>();
1064 return to_vec_<T>();
1076 size_t n = end_ - begin_;
1078 for(
size_t i = 0; i < n; ++i) {
1079 ret.push_back((*
this)[i]);
1127 template<
typename Predicate>
1132 for(
auto item : *
this) {
1133 if(std::forward<Predicate>(f)(item)) {
1146 for(
auto ent : *
this) {
1160 is.begin_push_(v_->size());
1162 for(
auto item : *
this) {
1163 is.batch_push_(f(*item));
1174 template<
typename S>
1178 for(
auto item : *
this) {
1200 template<
typename Predicate>
1201 auto bin(Predicate && f)
const {
1202 return bin_as_map(std::forward<Predicate>(f));
1221 template<
typename Predicate>
1230 std::decay_t<decltype(std::forward<Predicate>(f)(
operator[](0)))>;
1233 std::map<result_t, new_index_space_t> bins;
1234 for(
auto ent : *
this)
1235 bins[std::forward<Predicate>(f)(ent)].
push_back(ent);
1238 for(
auto & entry : bins)
1239 entry.second.set_master(*
this);
1259 template<
typename Predicate>
1263 auto bins_map = bin_as_map(std::forward<Predicate>(f));
1267 using new_index_space_t =
1268 typename std::decay_t<decltype(bins_map)>::mapped_type;
1272 std::vector<new_index_space_t> bins_vec;
1273 bins_vec.reserve(bins_map.size());
1275 for(
auto && entry : bins_map)
1276 bins_vec.emplace_back(std::move(entry.second));
1287 if(!OWNED && !owned_) {
1292 if(!SORTED && !sorted_) {
1294 std::sort(vc->begin(), vc->end());
1310 ret.resize(std::min(v_->size(), r.v_->size()));
1312 auto itr = std::set_intersection(
1313 v_->begin(), v_->end(), r.v_->begin(), r.v_->end(), ret.begin());
1315 ret.resize(itr - ret.begin());
1319 std::sort(v2.begin(), v2.end());
1321 ret.resize(std::min(v_->size(), v2.size()));
1323 auto itr = std::set_intersection(
1324 v_->begin(), v_->end(), v2.begin(), v2.end(), ret.begin());
1326 ret.resize(itr - ret.begin());
1329 *v_ = std::move(ret);
1357 ret.resize(v_->size() + r.v_->size());
1359 auto itr = std::set_union(
1360 v_->begin(), v_->end(), r.v_->begin(), r.v_->end(), ret.begin());
1362 ret.resize(itr - ret.begin());
1367 std::sort(v2.begin(), v2.end());
1369 ret.resize(v_->size() + v2.size());
1371 auto itr = std::set_union(
1372 v_->begin(), v_->end(), v2.begin(), v2.end(), ret.begin());
1374 ret.resize(itr - ret.begin());
1377 *v_ = std::move(ret);
1405 auto itr = std::set_difference(
1406 v_->begin(), v_->end(), r.v_->begin(), r.v_->end(), ret.begin());
1408 ret.resize(itr - ret.begin());
1413 std::sort(v2.begin(), v2.end());
1415 auto itr = std::set_difference(
1416 v_->begin(), v_->end(), v2.begin(), v2.end(), ret.begin());
1418 ret.resize(itr - ret.begin());
1421 *v_ = std::move(ret);
1444 if(!OWNED && !owned_) {
1450 s_->push_back(item);
1453 if(SORTED || sorted_) {
1454 auto id = id_(item);
1455 auto itr = std::upper_bound(v_->begin(), v_->end(), id);
1456 v_->insert(itr,
id);
1459 v_->push_back(id_(item));
1471 if(!OWNED && !owned_) {
1476 if(SORTED || sorted_) {
1477 auto itr = std::upper_bound(v_->begin(), v_->end(), index);
1478 v_->insert(itr, index);
1481 v_->push_back(index);
1501 if(!OWNED && !owned_) {
1507 s_->insert(s_->begin(), is.s_->begin(), is.s_->end());
1510 size_t n = is.
size();
1512 if(SORTED || sorted_) {
1515 for(
auto ent : is) {
1517 auto itr = std::upper_bound(v_->begin(), v_->end(), id);
1518 v_->insert(itr,
id);
1522 v_->insert(v_->begin(), is.v_->begin(), is.v_->end());
1539 void append_(
const std::vector<T> & ents,
const std::vector<id_t> & ids) {
1540 static_assert(STORAGE,
"expected STORAGE");
1541 static_assert(OWNED,
"expected OWNED");
1543 assert(ents.size() == ids.size());
1545 s_->insert(s_->begin(), ents.begin(), ents.end());
1547 size_t n = ents.size();
1549 if(SORTED || sorted_) {
1552 for(
id_t id : ids) {
1553 auto itr = std::upper_bound(v_->begin(), v_->end(), id);
1554 v_->insert(itr,
id);
1558 v_->insert(v_->begin(), ids.begin(), ids.end());
1568 return item.index_space_id();
1575 return item->index_space_id();
1598 template<
class,
class...>
1600 template<
class,
class...>
1616 size_t begin_push_() {
1617 static_assert(OWNED,
"expected OWNED");
1624 void reserve_(
size_t n) {
1625 static_assert(OWNED,
"expected OWNED");
1626 return v_->reserve(n);
1632 void begin_push_(
size_t n) {
1633 static_assert(OWNED,
"expected OWNED");
1634 assert(begin_ == 0);
1635 size_t m = v_->size();
1644 static_assert(OWNED,
"expected OWNED");
1645 v_->push_back(index);
1651 void push_(
id_t index) {
1652 static_assert(OWNED,
"expected OWNED");
1653 v_->push_back(index);
1660 void end_push_(
size_t n) {
1661 static_assert(OWNED,
"expected OWNED");
1662 assert(begin_ == 0);
1663 end_ += v_->size() - n;
1669 void resize_(
size_t n) {
1670 static_assert(OWNED,
"expected OWNED");
1671 assert(begin_ == 0);
1679 void fill_(
id_t index) {
1680 static_assert(OWNED,
"expected OWNED");
1681 std::fill(v_->begin(), v_->end(), index);
1694 typename id_storage_t::iterator index_begin_() {
1701 typename id_storage_t::iterator index_end_() {
1722 operator size_t()
const {
1730 return id_ < eid.id_;
1747 template<
typename T>
1761 operator T()
const {
bool operator<(const iterator_base_ &itr) const
Less than operator.
Definition: index_space.hh:200
iterator_ & operator+=(size_t offset)
Plus assignment offset operator.
Definition: index_space.hh:508
iterator_ & operator-=(size_t offset)
Minus assignment offset operator.
Definition: index_space.hh:516
auto bin_as_vector(Predicate &&f) const
Bin entities using a predicate function.
Definition: index_space.hh:1260
iterator_ operator-(size_t offset) const
Minus offset operator.
Definition: index_space.hh:490
Definition: index_space.hh:262
id_storage_t::const_iterator begin() const
Get begin iterator.
Definition: index_space.hh:140
index_space(bool storage=STORAGE)
Definition: index_space.hh:540
iterator_ operator+(size_t offset) const
Plus offset operator.
Definition: index_space.hh:472
std::function< void(entity_t * &, S &)> reduce_function
Reduce function signature.
Definition: index_space.hh:115
const ref_t back() const
Get the entity at the back of the index space.
Definition: index_space.hh:966
helper classes for resolving types
Definition: index_space.hh:36
auto slice(size_t begin, size_t end) const
Definition: index_space.hh:833
S * operator->()
Arrow operator.
Definition: index_space.hh:389
auto filter(Predicate &&f) const
Definition: index_space.hh:1128
~index_space()
Destructor.
Definition: index_space.hh:614
void append(const index_space &is)
Definition: index_space.hh:1500
typename std::remove_pointer< entity_t * >::type item_t
item, e.g. entity type
Definition: index_space.hh:98
bool operator>=(const iterator_base_ &itr) const
Greater than equal operator.
Definition: index_space.hh:221
const ref_t get_end_(size_t offset) const
Helper method. Get item at offset from end.
Definition: index_space.hh:907
std::function< S(entity_t * &)> map_function
map function signature
Definition: index_space.hh:111
index_space & operator=(index_space &&is)
Move assignment operator.
Definition: index_space.hh:672
index_space operator &(const index_space &r) const
Return r-value of set intersection of passed index spaces.
Definition: index_space.hh:1340
ref_t get_(size_t offset)
Helper method. Get item at offset.
Definition: index_space.hh:883
void prepare_()
Definition: index_space.hh:1286
iterator_ operator+(size_t offset) const
Plus offset operator.
Definition: index_space.hh:322
a convenience class which associates a simple ID with type T
Definition: index_space.hh:1748
index_space(const index_space< S, STORAGE2, OWNED2, SORTED2, F2, ID_STORAGE_TYPE2, STORAGE_TYPE2 > &is, size_t begin, size_t end)
Definition: index_space.hh:559
std::decay_t< ref_t > cast_t
reference casting type
Definition: index_space.hh:104
typename std::remove_pointer< entity_t * >::type::id_t id_t
ID type.
Definition: index_space.hh:89
const ref_t operator[](size_t i) const
Get item at offset.
Definition: index_space.hh:922
void apply(apply_function f) const
Definition: index_space.hh:1145
index_space operator-(const index_space &r) const
Return r-value of set difference of passed index spaces.
Definition: index_space.hh:1432
iterator_(const storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from item storage and index range.
Definition: index_space.hh:279
simple_id(size_t id)
Constructor.
Definition: index_space.hh:1717
void append_(const std::vector< T > &ents, const std::vector< id_t > &ids)
Append helper method. Do not call directly.
Definition: index_space.hh:1539
const ref_t get_(size_t offset) const
Helper method. Get item at offset.
Definition: index_space.hh:891
Definition: array_buffer.hh:71
auto bin(Predicate &&f) const
Bin entities using a predicate function.
Definition: index_space.hh:1201
std::function< void(entity_t * &)> apply_function
apply function signature
Definition: index_space.hh:107
id_range_ ids(size_t begin, size_t end) const
Get all IDs in range.
Definition: index_space.hh:814
ID_STORAGE_TYPE< id_t > id_storage_t
ID storage type.
Definition: index_space.hh:92
bool operator==(const iterator_base_ &itr) const
Equality operator.
Definition: index_space.hh:186
index_space(index_space &&is)
Move constructor.
Definition: index_space.hh:590
iterator_ & operator++()
Increment operator.
Definition: index_space.hh:288
bool operator!=(const iterator_base_ &itr) const
Inequality operator.
Definition: index_space.hh:193
ref_t operator[](size_t offset)
Get item at offset.
Definition: index_space.hh:915
id_storage_t::const_iterator end() const
Get end iterator.
Definition: index_space.hh:147
const id_t * id_array() const
Return the index space IDs as an array.
Definition: index_space.hh:1113
bool operator<=(const iterator_base_ &itr) const
Less than equal operator.
Definition: index_space.hh:207
auto begin() const
Return begin iterator.
Definition: index_space.hh:758
auto operator[](size_t index) const
Get item at index.
Definition: index_space.hh:242
id_t id_(const item_t &item)
Helper method to get ID.
Definition: index_space.hh:1567
ref_t front()
Get the entity at the front of the index space.
Definition: index_space.hh:945
index_space & operator-=(const index_space &r)
Definition: index_space.hh:1399
auto end()
Return end iterator.
Definition: index_space.hh:765
int start(const std::function< int()> &action)
Definition: execution.hh:69
id_t & operator()(size_t i)
Definition: index_space.hh:938
iterator_ & operator+=(size_t offset)
Plus assignment offset operator.
Definition: index_space.hh:358
S & operator*()
Dereference operator.
Definition: index_space.hh:374
bool operator<(const simple_id &eid) const
Comparison operator.
Definition: index_space.hh:1729
std::string type()
Definition: demangle.hh:44
auto slice() const
Definition: index_space.hh:870
iterator_base_(storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from items and range.
Definition: index_space.hh:167
auto end() const
Return end iterator.
Definition: index_space.hh:772
index_space & operator &=(const index_space &r)
Definition: index_space.hh:1304
id_storage_t & id_storage()
Return the index storage object.
Definition: index_space.hh:1094
size_t operator-(const iterator_base_ &itr) const
Difference.
Definition: index_space.hh:228
iterator_ & operator-=(size_t offset)
Minus assignment offset operator.
Definition: index_space.hh:366
STORAGE_TYPE< T > storage_t
Storage type.
Definition: index_space.hh:95
auto & cast() const
Definition: index_space.hh:734
auto & cast()
Definition: index_space.hh:709
S reduce(T start, reduce_function< T > f) const
Definition: index_space.hh:1175
Definition: index_space.hh:85
void push_back(id_t index)
Definition: index_space.hh:1470
auto map(map_function< S > f) const
Definition: index_space.hh:1156
iterator_base_(const storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from items and range.
Definition: index_space.hh:176
const ref_t front() const
Get the entity at the front of the index space.
Definition: index_space.hh:952
index_space & operator=(const index_space &is)
Assignment operator. Alias an existing index space unless OWNED.
Definition: index_space.hh:648
simple_entry(id_t id, const T &entry)
Constructor to associate an id with an entry.
Definition: index_space.hh:1756
storage_t * storage()
Return the storage object.
Definition: index_space.hh:627
auto get_(size_t index)
Helper method. Get item at index.
Definition: index_space.hh:235
Definition: index_space.hh:1711
void set_master(const index_space< T, STORAGE2, OWNED2, SORTED2, F2, INDEX_STORAGE_TYPE2, STORAGE_TYPE2 > &master)
Definition: index_space.hh:1013
std::vector< const T > to_vec() const
Definition: index_space.hh:1055
ref_t get_offset(size_t offset)
Get offset.
Definition: index_space.hh:793
void set_storage(storage_t *s)
Set the storage object.
Definition: index_space.hh:641
id_range_ ids(const std::pair< size_t, size_t > &p) const
Get all IDs in range.
Definition: index_space.hh:821
index_space & operator<<(T item)
Shortcut for push_back()
Definition: index_space.hh:1531
friend iterator_ operator-(size_t offset, const iterator_ &itr)
Minus offset operator.
Definition: index_space.hh:499
typename index_space_ref_type< entity_t * >::type ref_t
Reference type.
Definition: index_space.hh:101
bool operator>(const iterator_base_ &itr) const
Greater than operator.
Definition: index_space.hh:214
iterator_ & operator++()
Increment operator.
Definition: index_space.hh:438
iterator_ operator++(int)
Post-increment operator.
Definition: index_space.hh:304
index_space & operator|=(const index_space &r)
Definition: index_space.hh:1351
auto begin()
Return begin iterator.
Definition: index_space.hh:751
Definition: index_space.hh:122
id_range_(const id_storage_t &items, size_t begin, size_t end)
Initialize range from items with beginning and end.
Definition: index_space.hh:134
friend iterator_ operator+(size_t offset, const iterator_ &itr)
Plus offset operator.
Definition: index_space.hh:481
S * operator->()
Arrow operator.
Definition: index_space.hh:531
auto bin_as_map(Predicate &&f) const
Bin entities using a predicate function.
Definition: index_space.hh:1222
domain_entity is a simple wrapper to mesh entity that associates with its a domain id ...
Definition: array_buffer.hh:24
id_range_ ids() const
Get all IDs in range.
Definition: index_space.hh:807
iterator_ operator--(int)
Post-decrement operator.
Definition: index_space.hh:313
iterator_ operator++(int)
Post-increment operator.
Definition: index_space.hh:454
ref_t get_end_(size_t offset)
Helper method. Get item at offset from end.
Definition: index_space.hh:899
const ref_t get_offset(size_t offset) const
Get offset.
Definition: index_space.hh:800
void set_end(size_t end)
Set the end index of contained IDs.
Definition: index_space.hh:1588
iterator_ operator--(int)
Post-decrement operator.
Definition: index_space.hh:463
iterator_(storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from items and range.
Definition: index_space.hh:420
void clear()
Clear all indices and entities.
Definition: index_space.hh:987
const id_storage_t & id_storage() const
Return the index storage object.
Definition: index_space.hh:1087
iterator_(const storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from items and range.
Definition: index_space.hh:429
size_t index_space_index() const
Define the index space ID.
Definition: index_space.hh:1736
const storage_t * storage() const
Return the storage object.
Definition: index_space.hh:634
void push_back(const T &item)
Definition: index_space.hh:1443
auto entry_id() const
Get the entry ID.
Definition: index_space.hh:1768
Iterator base, const be parameterized with 'T' or 'const T'.
Definition: index_space.hh:161
iterator_ & operator--()
Decrement operator.
Definition: index_space.hh:446
id_t index_space_id() const
Get the index space ID.
Definition: index_space.hh:1775
size_t end_offset() const
Return end offset.
Definition: index_space.hh:786
friend iterator_ operator-(size_t offset, const iterator_ &itr)
Minus offset operator.
Definition: index_space.hh:349
index_space operator|(const index_space &r) const
Return r-value of set union of passed index spaces.
Definition: index_space.hh:1388
void set_begin(size_t begin)
Set to begin index of contained IDs.
Definition: index_space.hh:1581
std::vector< S > to_vec_()
Definition: index_space.hh:1074
void set_master(index_space< T, STORAGE2, OWNED2, SORTED2, F2, INDEX_STORAGE_TYPE2, STORAGE_TYPE2 > &master)
Definition: index_space.hh:1041
S operator*()
Dereference operator.
Definition: index_space.hh:524
std::vector< T > to_vec()
Definition: index_space.hh:1063
void pushed()
Called if an index was added to storage internally.
Definition: index_space.hh:1490
connectivity_t provides basic connectivity information in a compressed storage format.
Definition: connectivity.hh:41
void set_id_storage(id_storage_t *v)
Set the index storage object.
Definition: index_space.hh:1101
ref_t back()
Get the entity at the back of the index space.
Definition: index_space.hh:959
const id_t & operator()(size_t i) const
Definition: index_space.hh:930
bool empty() const
Return if the index space is empty, i.e. has no indices.
Definition: index_space.hh:980
size_t begin_offset() const
Return begin offset.
Definition: index_space.hh:779
friend iterator_ operator+(size_t offset, const iterator_ &itr)
Plus offset operator.
Definition: index_space.hh:331
size_t size() const
Get the size of the index space.
Definition: index_space.hh:973
auto slice(const std::pair< size_t, size_t > &range) const
Definition: index_space.hh:852
id_t id_(const item_t *item)
Helper method to get ID.
Definition: index_space.hh:1574
iterator_ operator-(size_t offset) const
Minus offset operator.
Definition: index_space.hh:340
iterator_(storage_t *s, const id_storage_t &items, size_t index, size_t end)
Initialize iterator from item storage and index range.
Definition: index_space.hh:270
iterator_ & operator--()
Decrement operator.
Definition: index_space.hh:296
id_range_(const id_storage_t &items)
Initialize range from items.
Definition: index_space.hh:128
Definition: control.hh:31
index_space(const index_space &is)
Constructor to alias an existing index space unless OWNED.
Definition: index_space.hh:580