Loading...
Searching...
No Matches
intersection.cuh
1/*
2 * Copyright (c) 2022-2024, NVIDIA CORPORATION.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
21
22#include <rmm/cuda_stream_view.hpp>
23#include <rmm/device_uvector.hpp>
24#include <rmm/mr/device/per_device_resource.hpp>
25#include <rmm/resource_ref.hpp>
26
27#include <thrust/pair.h>
28
29namespace cuspatial {
30
31enum IntersectionTypeCode : uint8_t { POINT = 0, LINESTRING = 1 };
32
42template <typename T, typename OffsetType>
44 using point_t = vec_2d<T>;
45 using segment_t = segment<T>;
46 using types_t = uint8_t;
47 using index_t = OffsetType;
48
50 std::unique_ptr<rmm::device_uvector<index_t>> geometry_collection_offset;
51
53 std::unique_ptr<rmm::device_uvector<types_t>> types_buffer;
54 std::unique_ptr<rmm::device_uvector<index_t>> offset_buffer;
55
57 std::unique_ptr<rmm::device_uvector<point_t>> points_coords;
58
60 std::unique_ptr<rmm::device_uvector<segment_t>> segments_coords;
61
63 std::unique_ptr<rmm::device_uvector<index_t>> lhs_linestring_id;
64 std::unique_ptr<rmm::device_uvector<index_t>> lhs_segment_id;
65 std::unique_ptr<rmm::device_uvector<index_t>> rhs_linestring_id;
66 std::unique_ptr<rmm::device_uvector<index_t>> rhs_segment_id;
67};
68
84template <typename T,
85 typename index_t,
86 typename MultiLinestringRange1,
87 typename MultiLinestringRange2>
88linestring_intersection_result<T, index_t> pairwise_linestring_intersection(
89 MultiLinestringRange1 multilinestrings1,
90 MultiLinestringRange2 multilinestrings2,
91 rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource(),
92 rmm::cuda_stream_view stream = rmm::cuda_stream_default);
93
94} // namespace cuspatial
95
96#include <cuspatial/detail/intersection/linestring_intersection.cuh>
Result of linestring intersections.
std::unique_ptr< rmm::device_uvector< segment_t > > segments_coords
Child 1: Segment Results.
std::unique_ptr< rmm::device_uvector< index_t > > geometry_collection_offset
List offsets to the union column.
std::unique_ptr< rmm::device_uvector< point_t > > points_coords
Child 0: Point Results.
std::unique_ptr< rmm::device_uvector< index_t > > lhs_linestring_id
Look-back Indices.
std::unique_ptr< rmm::device_uvector< types_t > > types_buffer
Union Column Results.