use smallvec::SmallVec;
use crate::Tolerance;
pub type Point2 = (f64, f64);
pub type Points2 = SmallVec<[(f64, f64); 8]>;
#[non_exhaustive]
#[derive(Clone, Debug, PartialEq)]
pub struct IntegrationConfig2 {
pub tolerance: Tolerance,
pub max_iters: usize,
pub points: Points2,
}
impl Default for IntegrationConfig2 {
#[inline]
fn default() -> Self {
Self {
tolerance: Tolerance::default(),
max_iters: 50,
points: Points2::new(),
}
}
}
pub trait Integrand2 {
fn apply(&mut self, x: Point2) -> f64;
}
impl<F: FnMut(f64, f64) -> f64> Integrand2 for F {
#[inline]
fn apply(&mut self, x: Point2) -> f64 {
(*self)(x.0, x.1)
}
}