Loading...
Searching...
No Matches
intersection.cuh
1/*
2 * Copyright (c) 2022-2023, 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
26#include <thrust/pair.h>
27
28namespace cuspatial {
29
30enum IntersectionTypeCode : uint8_t { POINT = 0, LINESTRING = 1 };
31
41template <typename T, typename OffsetType>
43 using point_t = vec_2d<T>;
44 using segment_t = segment<T>;
45 using types_t = uint8_t;
46 using index_t = OffsetType;
47
49 std::unique_ptr<rmm::device_uvector<index_t>> geometry_collection_offset;
50
52 std::unique_ptr<rmm::device_uvector<types_t>> types_buffer;
53 std::unique_ptr<rmm::device_uvector<index_t>> offset_buffer;
54
56 std::unique_ptr<rmm::device_uvector<point_t>> points_coords;
57
59 std::unique_ptr<rmm::device_uvector<segment_t>> segments_coords;
60
62 std::unique_ptr<rmm::device_uvector<index_t>> lhs_linestring_id;
63 std::unique_ptr<rmm::device_uvector<index_t>> lhs_segment_id;
64 std::unique_ptr<rmm::device_uvector<index_t>> rhs_linestring_id;
65 std::unique_ptr<rmm::device_uvector<index_t>> rhs_segment_id;
66};
67
83template <typename T,
84 typename index_t,
85 typename MultiLinestringRange1,
86 typename MultiLinestringRange2>
87linestring_intersection_result<T, index_t> pairwise_linestring_intersection(
88 MultiLinestringRange1 multilinestrings1,
89 MultiLinestringRange2 multilinestrings2,
90 rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource(),
91 rmm::cuda_stream_view stream = rmm::cuda_stream_default);
92
93} // namespace cuspatial
94
95#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.