MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / crop_to_tile_impl

Method crop_to_tile_impl

tiledb/sm/subarray/subarray.cc:2743–2773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2741
2742template <class T, class SubarrayT>
2743void 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
2776template void Subarray::compute_tile_coords<int8_t>();

Callers

nothing calls this directly

Calls 11

overlapFunction · 0.85
array_schema_latestMethod · 0.80
get_tile_subarrayMethod · 0.80
num_rangesMethod · 0.80
RangeClass · 0.70
domainMethod · 0.45
coord_sizeMethod · 0.45
dimension_ptrMethod · 0.45
dataMethod · 0.45
add_range_unsafeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected