Skip to content
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

Add multithreading support to Multi* geometries #1265

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions geo-types/src/geometry/multi_line_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@ mod test {
use super::*;
use crate::{line_string, wkt};

#[test]
urschrei marked this conversation as resolved.
Show resolved Hide resolved
fn test_multithreading_linestring() {
let multi: MultiLineString<i32> = wkt! {
MULTILINESTRING((0 0,2 0,1 2,0 0), (10 10,12 10,11 12,10 10))
};
let mut multimut: MultiLineString<i32> = wkt! {
MULTILINESTRING((0 0,2 0,1 2,0 0), (10 10,12 10,11 12,10 10))
};
let _ = multi.par_iter().for_each(|_p| ());
let _ = multimut.par_iter_mut().for_each(|_p| ());
let _ = &multi.into_par_iter().for_each(|_p| ());
let _ = &mut multimut.par_iter_mut().for_each(|_p| ());
}

#[test]
fn test_iter() {
let multi: MultiLineString<i32> = wkt! {
Expand Down
15 changes: 15 additions & 0 deletions geo-types/src/geometry/multi_polygon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ mod test {
}
}

#[test]
fn test_par_iter() {
let multi = MultiPolygon::new(vec![
polygon![(x: 0, y: 0), (x: 2, y: 0), (x: 1, y: 2), (x:0, y:0)],
polygon![(x: 10, y: 10), (x: 12, y: 10), (x: 11, y: 12), (x:10, y:10)],
]);
let mut multimut = MultiPolygon::new(vec![
polygon![(x: 0, y: 0), (x: 2, y: 0), (x: 1, y: 2), (x:0, y:0)],
polygon![(x: 10, y: 10), (x: 12, y: 10), (x: 11, y: 12), (x:10, y:10)],
]);
let _ = multi.par_iter().for_each(|_p| ());
let _ = &multimut.par_iter_mut().for_each(|_p| ());
let _ = &multi.into_par_iter().for_each(|_p| ());
let _ = &mut multimut.par_iter_mut().for_each(|_p| ());
}
#[test]
fn test_iter_mut() {
let mut multi = MultiPolygon::new(vec![
Expand Down
Loading