77 static constexpr size_t MAX = std::numeric_limits<size_t>::max();
80 DataRegion(std::pair<size_t, size_t> b,
size_t m_reps,
size_t m_stride)
81 : start(b.first), end(
82 (b.second != MAX && b.second + 1 == b.first + m_stride)
83 ? b.second + m_reps * m_stride
87 (b.second == MAX || b.second + 1 == b.first + m_stride) ? 0 : m_reps
89 stride(reps == 0 ? MAX : m_stride) {
90 fenix_assert(start <= end);
91 fenix_assert(stride != MAX || reps == 0);
92 fenix_assert(reps == 0 || start + stride > end);
96 std::pair<size_t, size_t> range()
const;
101 bool operator==(
const DataRegion& other)
const;
102 bool operator!=(
const DataRegion& other)
const;
105 bool operator<(
const DataRegion& other)
const;
108 bool operator&&(
const DataRegion& other)
const;
112 std::set<DataRegion> operator&(
const DataRegion& other)
const;
115 std::set<DataRegion> operator-(
const DataRegion& other)
const;
120 DataRegion get_reps(
size_t first,
size_t last)
const;
126 std::optional<DataRegion> try_merge(
const DataRegion& other)
const;
128 std::string str()
const;
153 static constexpr size_t MAX = detail::DataRegion::MAX;
171 DataSubset(std::pair<size_t, size_t> b,
size_t n,
size_t stride);
173 DataSubset(std::vector<std::pair<size_t, size_t>> bounds);
180 explicit DataSubset(SubsetType special_type) : type(special_type) {};
189 bool operator==(
const DataSubset& other)
const;
190 bool operator!=(
const DataSubset& other)
const;
195 std::pair<size_t, size_t> range()
const;
197 size_t start()
const;
202 size_t count(
size_t max_index)
const;
206 size_t max_count()
const;
228 bool includes(
size_t idx)
const;
230 bool includes_all(
size_t end)
const;
232 bool is_bounded()
const {
return empty() || end() != MAX; }
246 std::set<detail::DataRegion> bounded_regions(
size_t max_index)
const;
248 std::set<detail::DataRegion> bounded_regions(
size_t start,
size_t end)
const;
250 std::string str()
const;
253 std::set<detail::DataRegion> regions;
255 SubsetType type = BasicSubset;
259 void merge_regions();