| 2741 | |
| 2742 | template <class T, class SubarrayT> |
| 2743 | void Subarray::crop_to_tile_impl(const T* tile_coords, SubarrayT& ret) const { |
| 2744 | T new_range[2]; |
| 2745 | bool overlaps; |
| 2746 | |
| 2747 | // Get tile subarray based on the input coordinates |
| 2748 | const auto& array_schema = array_->array_schema_latest(); |
| 2749 | std::vector<T> tile_subarray(2 * dim_num()); |
| 2750 | array_schema.domain().get_tile_subarray(tile_coords, &tile_subarray[0]); |
| 2751 | |
| 2752 | // Compute cropped subarray |
| 2753 | for (unsigned d = 0; d < dim_num(); ++d) { |
| 2754 | auto r_size{2 * array_schema.dimension_ptr(d)->coord_size()}; |
| 2755 | uint64_t i = 0; |
| 2756 | for (size_t r = 0; r < range_subset_[d].num_ranges(); ++r) { |
| 2757 | const auto& range = range_subset_[d][r]; |
| 2758 | rectangle::overlap( |
| 2759 | (const T*)range.data(), |
| 2760 | &tile_subarray[2 * d], |
| 2761 | 1, |
| 2762 | new_range, |
| 2763 | &overlaps); |
| 2764 | |
| 2765 | if (overlaps) { |
| 2766 | ret.add_range_unsafe(d, Range(new_range, r_size)); |
| 2767 | ret.original_range_idx_unsafe().resize(dim_num()); |
| 2768 | ret.original_range_idx_unsafe()[d].resize(i + 1); |
| 2769 | ret.original_range_idx_unsafe()[d][i++] = r; |
| 2770 | } |
| 2771 | } |
| 2772 | } |
| 2773 | } |
| 2774 | |
| 2775 | // Explicit instantiations |
| 2776 | template void Subarray::compute_tile_coords<int8_t>(); |
nothing calls this directly
no test coverage detected