[−][src]Struct broccoli::query::QueryBuilder
Builder for a query on a DinoTree.
Implementations
impl<'a, 'b: 'a, A: Axis, T: Aabb + Send + Sync> QueryBuilder<'a, 'b, A, T> where
T::Num: Send + Sync,
[src]
T::Num: Send + Sync,
pub fn query_par(
self,
func: impl Fn(PMut<'_, T>, PMut<'_, T>) + Clone + Send + Sync
)
[src]
self,
func: impl Fn(PMut<'_, T>, PMut<'_, T>) + Clone + Send + Sync
)
Perform the query in parallel
pub fn query_par_ext<B: Send + Sync>(
self,
split: impl Fn(&mut B) -> (B, B) + Send + Sync + Copy,
fold: impl Fn(&mut B, B, B) + Send + Sync + Copy,
collision: impl Fn(&mut B, PMut<'_, T>, PMut<'_, T>) + Send + Sync + Copy,
acc: B
) -> B where
T: Send + Sync,
T::Num: Send + Sync,
[src]
self,
split: impl Fn(&mut B) -> (B, B) + Send + Sync + Copy,
fold: impl Fn(&mut B, B, B) + Send + Sync + Copy,
collision: impl Fn(&mut B, PMut<'_, T>, PMut<'_, T>) + Send + Sync + Copy,
acc: B
) -> B where
T: Send + Sync,
T::Num: Send + Sync,
An extended version of find_colliding_pairs
. where the user can supply
callbacks to when new worker tasks are spawned and joined by rayon
.
Allows the user to potentially collect some aspect of every aabb collision in parallel.
Examples
use broccoli::{prelude::*,bbox,rect}; let mut bots = [bbox(rect(0,10,0,10),0u8),bbox(rect(5,15,5,15),1u8)]; let mut tree = broccoli::new(&mut bots); let intersections=tree.new_colfind_builder().query_par_ext( |_|(Vec::new(),Vec::new()), //Start a new thread |a,mut b,mut c|{a.append(&mut b);a.append(&mut c)}, //Combine two threads |v,a,b|v.push((*a.unpack_inner(),*b.unpack_inner())), //What to do for each intersection for a thread. Vec::new() //Starting thread ); assert_eq!(intersections.len(),1);
pub fn query_splitter_par<C: ColMulti<T = T> + Splitter + Send + Sync>(
self,
clos: C
) -> C
[src]
self,
clos: C
) -> C
Trait version of QueryBuilder::query_par_ext
.
The user has more control using this version of the query.
The splitter will split and add at every level.
The clos will split and add only at levels that are handled in parallel.
The leaf_start function will get called right before sequential processing.
The leaf end function will get called when the sequential processing finishes.
This can be useful if the use wants to create a list of colliding pair indicies, but still wants paralleism.
impl<'a, 'b: 'a, A: Axis, T: Aabb> QueryBuilder<'a, 'b, A, T>
[src]
#[must_use]pub fn new(
axis: A,
vistr: VistrMut<'a, NodeMut<'b, T>>
) -> QueryBuilder<'a, 'b, A, T>
[src]
axis: A,
vistr: VistrMut<'a, NodeMut<'b, T>>
) -> QueryBuilder<'a, 'b, A, T>
Create the builder.
#[must_use]pub fn with_switch_height(self, height: usize) -> Self
[src]
Choose a custom height at which to switch from parallel to sequential. If you end up building sequentially, this option is ignored.
pub fn query_seq(self, func: impl FnMut(PMut<'_, T>, PMut<'_, T>))
[src]
Perform the query sequentially.
pub fn query_with_splitter_seq(
self,
func: impl FnMut(PMut<'_, T>, PMut<'_, T>),
splitter: &mut impl Splitter
)
[src]
self,
func: impl FnMut(PMut<'_, T>, PMut<'_, T>),
splitter: &mut impl Splitter
)
Perform the query sequentially with a splitter.
Auto Trait Implementations
impl<'a, 'b, A, T> RefUnwindSafe for QueryBuilder<'a, 'b, A, T> where
A: RefUnwindSafe,
T: RefUnwindSafe,
<T as Aabb>::Num: RefUnwindSafe,
[src]
A: RefUnwindSafe,
T: RefUnwindSafe,
<T as Aabb>::Num: RefUnwindSafe,
impl<'a, 'b, A, T> Send for QueryBuilder<'a, 'b, A, T> where
T: Send,
<T as Aabb>::Num: Send,
[src]
T: Send,
<T as Aabb>::Num: Send,
impl<'a, 'b, A, T> Sync for QueryBuilder<'a, 'b, A, T> where
T: Sync,
<T as Aabb>::Num: Sync,
[src]
T: Sync,
<T as Aabb>::Num: Sync,
impl<'a, 'b, A, T> Unpin for QueryBuilder<'a, 'b, A, T> where
A: Unpin,
'b: 'a,
[src]
A: Unpin,
'b: 'a,
impl<'a, 'b, A, T> !UnwindSafe for QueryBuilder<'a, 'b, A, T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,