use crate::ParticleRefMut;
use std::fmt::Debug;
pub trait ParticleRefFrom {
type TSource: Unit;
fn divide_from<'a>(
source: &'a mut ParticleRefMut<'_, Self::TSource>,
) -> ParticleRefMut<'a, Self>
where
Self: Copy;
}
pub trait SetTo {
type TTarget: Unit;
fn set_to_ref_mut(&self, target: &mut ParticleRefMut<'_, Self::TTarget>);
}
pub trait Contextful {
type TContext: Copy;
fn set_context(&mut self, _context: Self::TContext) {}
fn set_iteration(&mut self, _iteration: usize, _max_iteration: usize) {}
}
pub trait FitCalc: Contextful + Sync {
type T: Unit;
const PAR_LEAF_SIZE: usize = usize::MAX;
fn calculate_fit(&self, position: Self::T) -> f64;
}
pub trait Unit: Copy + Default + Debug + Send + Sync + 'static {}
impl<T: Copy + Default + Debug + Send + Sync + 'static> Unit for T {}
pub trait Boundary: Contextful + Sync {
type T: Unit;
fn handle(&self, pos: Self::T) -> Self::T;
}
pub trait FieldwiseClamp {
fn clamp(&self, min: Self, max: Self) -> Self;
}