-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix multipolygon geometry iterator. #1402
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,10 +164,26 @@ class multipolygon_array { | |
{ | ||
auto [geometry_offsets, part_offsets, ring_offsets, coordinates] = arr.to_host(); | ||
|
||
return os << "Geometry Offsets:\n\t{" << geometry_offsets << "}\n" | ||
<< "Part Offsets:\n\t{" << part_offsets << "}\n" | ||
<< "Ring Offsets: \n\t{" << ring_offsets << "}\n" | ||
<< "Coordinates: \n\t{" << coordinates << "}\n"; | ||
auto print_vector = [&](auto const& vec) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without these changes, I was seeing errors that no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did thrust remove this overload from host_vector? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't aware that such an overload ever existed. I don't see that implemented: https://github.com/search?q=repo%3ANVIDIA%2Fcccl%20operator%3C%3C&type=code |
||
for (auto it = vec.begin(); it != vec.end(); it++) { | ||
os << *it; | ||
if (std::next(it) != vec.end()) { os << ", "; } | ||
} | ||
}; | ||
|
||
os << "Geometry Offsets:\n\t{"; | ||
print_vector(geometry_offsets); | ||
os << "}\n"; | ||
os << "Part Offsets:\n\t{"; | ||
print_vector(part_offsets); | ||
os << "}\n"; | ||
os << "Ring Offsets: \n\t{"; | ||
print_vector(ring_offsets); | ||
os << "}\n"; | ||
os << "Coordinates: \n\t{"; | ||
print_vector(coordinates); | ||
os << "}\n"; | ||
return os; | ||
} | ||
|
||
protected: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* Copyright (c) 2023-2024, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -1069,7 +1069,7 @@ class MultipolygonRangeOneTest : public MultipolygonRangeTestBase<T> { | |
void test_geometry_offsets_it() | ||
{ | ||
rmm::device_uvector<std::size_t> d_offsets = this->copy_geometry_offsets(); | ||
auto expected = make_device_vector<std::size_t>({0, 1}); | ||
auto expected = make_device_vector<std::size_t>({0, 2}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The geometry offsets are |
||
|
||
CUSPATIAL_EXPECT_VECTORS_EQUIVALENT(d_offsets, expected); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core bug: the
thrust::copy
call using the geometry offsets was getting the wrong size because the wrong iterator was being returned.This only became visible in the one test case where a multipolygon contained more than one polygon.