Loading...
Searching...
No Matches
Functions
Factory Methods

Factory method to create coordinate iterators. More...

Functions

template<typename FirstIter , typename SecondIter >
auto cuspatial::make_vec_2d_iterator (FirstIter first, SecondIter second)
 Create an iterator to vec_2d data from two input iterators.
 
template<typename Iter >
auto cuspatial::make_vec_2d_iterator (Iter xy_begin)
 Create an iterator to vec_2d data from a single iterator.
 
template<typename FirstIter , typename SecondIter >
auto cuspatial::make_vec_2d_output_iterator (FirstIter first, SecondIter second)
 Create an output iterator to vec_2d data from two output iterators.
 
template<typename Iter >
auto cuspatial::make_vec_2d_output_iterator (Iter d_points_begin)
 Create an output iterator to vec_2d data from an iterator to an interleaved array.
 
template<typename FirstIter , typename SecondIter >
auto cuspatial::make_box_iterator (FirstIter first, SecondIter second)
 Create an iterator to box data from two input iterators of vec_2d.
 
template<typename MinXIter , typename MinYIter , typename MaxXIter , typename MaxYIter >
auto cuspatial::make_box_output_iterator (MinXIter min_x, MinYIter min_y, MaxXIter max_x, MaxYIter max_y)
 Create an output iterator to box data from multiple output iterators.
 
template<typename IndexT , typename GeometryIter >
auto cuspatial::make_geometry_id_iterator (GeometryIter offsets_begin, GeometryIter offsets_end)
 Create an input iterator that generates zero-based sequential geometry IDs for each element based on the input offset range.
 
template<typename IndexT , typename GeometryIter , typename PartIter >
auto cuspatial::make_geometry_id_iterator (GeometryIter geometry_offsets_begin, GeometryIter geometry_offsets_end, PartIter part_offsets_begin)
 Create an input iterator that generates zero-based sequential geometry IDs for each element of a nested geometry based on the input geometry and part offset ranges.
 
template<typename OffsetIterator >
auto cuspatial::make_count_iterator_from_offset_iterator (OffsetIterator it)
 

Detailed Description

Factory method to create coordinate iterators.

CuSpatial header-only API functions only accept input/output iterators. These factory make it easier to create iterators from data in various formats.

Function Documentation

◆ make_box_iterator()

template<typename FirstIter , typename SecondIter >
auto cuspatial::make_box_iterator ( FirstIter first,
SecondIter second )

Create an iterator to box data from two input iterators of vec_2d.

Interleaves box_min and box_max points from separate iterators into a single iterator of box.

Template Parameters
VectorTypecuSpatial vector type, must be vec_2d
FirstIterIterator of vec_2d. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
SecondIterIterator of vec_2d. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
Parameters
firstIterator to beginning of box::v1
secondIterator to beginning of box::v2
Returns
Iterator to box
Precondition
first and second must iterate the same vec_2d data type.

Definition at line 308 of file iterator_factory.cuh.

◆ make_box_output_iterator()

template<typename MinXIter , typename MinYIter , typename MaxXIter , typename MaxYIter >
auto cuspatial::make_box_output_iterator ( MinXIter min_x,
MinYIter min_y,
MaxXIter max_x,
MaxYIter max_y )

Create an output iterator to box data from multiple output iterators.

Creates an output iterator from separate coordinate iterators to which can be written interleaved x/y data for box vertices (2 per box). This allows using four separate arrays of output data with APIs that expect an iterator to structured box data.

Template Parameters
MinXIterIterator type to the x-coordinate of the first box vertex. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
MinYIterIterator type to the y-coordinate of the first box vertex. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
MaxXIterIterator type to the x-coordinate of the second box vertex. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
MaxYIterIterator type to the y-coordinate of the second box vertex. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
Parameters
min_xIterator to beginning of x data for first box vertices.
min_yIterator to beginning of y data for first box vertices.
max_xIterator to beginning of x data for second box vertices.
max_yIterator to beginning of y data for second box vertices.
Returns
Iterator to box
Precondition
Input iterators must iterate on the same data type.

Definition at line 348 of file iterator_factory.cuh.

◆ make_count_iterator_from_offset_iterator()

template<typename OffsetIterator >
auto cuspatial::make_count_iterator_from_offset_iterator ( OffsetIterator it)

Definition at line 429 of file iterator_factory.cuh.

◆ make_geometry_id_iterator() [1/2]

template<typename IndexT , typename GeometryIter , typename PartIter >
auto cuspatial::make_geometry_id_iterator ( GeometryIter geometry_offsets_begin,
GeometryIter geometry_offsets_end,
PartIter part_offsets_begin )

Create an input iterator that generates zero-based sequential geometry IDs for each element of a nested geometry based on the input geometry and part offset ranges.

This can be used for any two-level nested multigeometry offsets, e.g. multipolygons.

Example:

auto poly_offsets = std::vector<int>({0, 1, 3}); // poly 1 has 2 rings
auto ring_offsets = std::vector<int>({0, 4, 7, 10});
auto iter =
make_geometry_id_iterator<int>(poly_offsets.begin(), poly_offsets.end(), ring_offsets.begin());
auto ids = std::vector<int>(13);
std::copy_n(iter, 13, ids.begin());
// ids now contains [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2]
Template Parameters
GeometryIterThe offset iterator type. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
Parameters
offsets_beginBeginning of range of geometry offsets
offsets_endEnd of range of geometry offsets
part_offsets_beginBeginning of range of part (e.g. ring) offsets
Returns
An iterator over unique IDs for each element of each geometry defined by the offsets

Definition at line 415 of file iterator_factory.cuh.

◆ make_geometry_id_iterator() [2/2]

template<typename IndexT , typename GeometryIter >
auto cuspatial::make_geometry_id_iterator ( GeometryIter offsets_begin,
GeometryIter offsets_end )

Create an input iterator that generates zero-based sequential geometry IDs for each element based on the input offset range.

This can be used for any single-level geometry offsets, e.g. multipoints, multilinestrings, (multi)trajectories. And using custom iterators it can be used for nested types.

Example:

auto offsets = std::vector<int>({0, 3, 5, 9});
auto iter_first = make_geometry_id_iterator<int>(offsets.begin(), offsets.end());
auto ids = std::vector<int>(10);
std::copy_n(iter_first, 10, ids.begin()); // ids now contains [0, 0, 0, 1, 1, 2, 2, 2, 2, 3]
Template Parameters
GeometryIterThe offset iterator type. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
Parameters
offsets_beginBeginning of range of geometry offsets
offsets_endEnd of range of geometry offsets
Returns
An iterator over unique IDs for each element of each geometry defined by the offsets

Definition at line 380 of file iterator_factory.cuh.

◆ make_vec_2d_iterator() [1/2]

template<typename FirstIter , typename SecondIter >
auto cuspatial::make_vec_2d_iterator ( FirstIter first,
SecondIter second )

Create an iterator to vec_2d data from two input iterators.

Interleaves x and y coordinates from separate iterators into a single iterator to xy- coordinates.

Template Parameters
VectorTypecuSpatial vector type, must be vec_2d
FirstIterIterator type to the first component of vec_2d. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
SecondIterIterator type to the second component of vec_2d. Must meet the requirements of LegacyRandomAccessIterator and be device-accessible.
Parameters
firstIterator to beginning of vec_2d::x
secondIterator to beginning of vec_2d::y
Returns
Iterator to vec_2d
Precondition
first and second must iterate on same data type.

Definition at line 212 of file iterator_factory.cuh.

◆ make_vec_2d_iterator() [2/2]

template<typename Iter >
auto cuspatial::make_vec_2d_iterator ( Iter xy_begin)

Create an iterator to vec_2d data from a single iterator.

Creates a vec2d view from an iterator to the starting range of interleaved x-y coordinates.

Template Parameters

param d_points_begin

Returns

Definition at line 231 of file iterator_factory.cuh.

◆ make_vec_2d_output_iterator() [1/2]

template<typename FirstIter , typename SecondIter >
auto cuspatial::make_vec_2d_output_iterator ( FirstIter first,
SecondIter second )

Create an output iterator to vec_2d data from two output iterators.

Creates an output iterator from separate iterators to x and y data to which can be written interleaved x/y data. This allows using two separate arrays of output data with APIs that expect an iterator to structured data.

Template Parameters
VectorTypecuSpatial vector type, must be vec_2d
FirstIterIterator type to the first component of vec_2d. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
SecondIterIterator type to the second component of vec_2d. Must meet the requirements of LegacyRandomAccessIterator, be mutable and be device-accessible.
Parameters
firstIterator to beginning of x data.
secondIterator to beginning of y data.
Returns
Iterator to vec_2d
Precondition
first and second must iterate on same data type.

Definition at line 258 of file iterator_factory.cuh.

◆ make_vec_2d_output_iterator() [2/2]

template<typename Iter >
auto cuspatial::make_vec_2d_output_iterator ( Iter d_points_begin)

Create an output iterator to vec_2d data from an iterator to an interleaved array.

Template Parameters
Itertype of iterator to interleaved data. Must meet the requirements of [LegacyRandomAccessIterator][LinkLRAI], be mutable and be device-accessible.
Parameters
d_points_beginIterator to beginning of interleaved data.
Returns
Iterator to vec_2d

Definition at line 274 of file iterator_factory.cuh.