21 #ifndef __RANGED_INDEX_SET_H 22 #define __RANGED_INDEX_SET_H 26 #include <dolfin/log/log.h> 44 : _range(range), _is_set(range.second - range.first)
51 : _range(std::pair<std::size_t, std::size_t>(0, upper_range)), _is_set(upper_range)
59 return (i >= _range.first && i < _range.second);
66 return _is_set[i - _range.first];
74 std::vector<bool>::reference entry = _is_set[i - _range.first];
90 _is_set[i - _range.first] =
false;
96 std::fill(_is_set.begin(), _is_set.end(),
false);
101 const std::pair<std::size_t, std::size_t> _range;
102 std::vector<bool> _is_set;
bool has_index(std::size_t i) const
Check is the set contains the given index.
Definition: RangedIndexSet.h:63
bool in_range(std::size_t i) const
Return true if a given index is within range, i.e., if it can be stored in the set.
Definition: RangedIndexSet.h:57
Definition: RangedIndexSet.h:37
void clear()
Erase all indices from the set.
Definition: RangedIndexSet.h:94
bool insert(std::size_t i)
Definition: RangedIndexSet.h:71
RangedIndexSet(std::pair< std::size_t, std::size_t > range)
Create a ranged set with range given as a (lower, upper) pair.
Definition: RangedIndexSet.h:43
void erase(std::size_t i)
Erase an index from the set.
Definition: RangedIndexSet.h:87
RangedIndexSet(std::size_t upper_range)
Create a ranged set with 0 as lower range.
Definition: RangedIndexSet.h:50