use super::empty_subgrid::EmptySubgridV1;
use super::import_only_subgrid::{ImportOnlySubgridV1, ImportOnlySubgridV2};
use super::lagrange_subgrid::{LagrangeSparseSubgridV1, LagrangeSubgridV1, LagrangeSubgridV2};
use super::ntuple_subgrid::NtupleSubgridV1;
use enum_dispatch::enum_dispatch;
use serde::Deserialize;
use std::borrow::Cow;
#[enum_dispatch(Subgrid)]
#[derive(Deserialize)]
pub enum SubgridEnum {
LagrangeSubgridV1,
NtupleSubgridV1,
LagrangeSparseSubgridV1,
LagrangeSubgridV2,
ImportOnlySubgridV1,
EmptySubgridV1,
ImportOnlySubgridV2,
}
#[derive(Deserialize, Clone)]
pub struct Mu2 {
pub ren: f64,
pub fac: f64,
}
#[enum_dispatch]
pub trait Subgrid {
fn indexed_iter(&self) -> SubgridIndexedIter<'_>;
fn is_empty(&self) -> bool;
fn mu2_grid(&self) -> Cow<'_, [Mu2]>;
fn x1_grid(&self) -> Cow<'_, [f64]>;
fn x2_grid(&self) -> Cow<'_, [f64]>;
}
pub type SubgridIndexedIter<'a> = Box<dyn Iterator<Item = ((usize, usize, usize), f64)> + 'a>;
#[derive(Deserialize)]
pub struct SubgridParams {
_q2_bins: usize,
_q2_max: f64,
_q2_min: f64,
_q2_order: usize,
_reweight: bool,
_x_bins: usize,
_x_max: f64,
_x_min: f64,
_x_order: usize,
}