1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use necsim_core::{
    cogs::{Backup, Habitat, MathsCore},
    landscape::Location,
};
use necsim_partitioning_core::partition::Partition;

pub mod equal;
pub mod modulo;
pub mod monolithic;
pub mod radial;

#[allow(clippy::inline_always, clippy::inline_fn_without_body)]
#[contract_trait]
pub trait Decomposition<M: MathsCore, H: Habitat<M>>: Backup + Sized + core::fmt::Debug {
    fn get_subdomain(&self) -> Partition;

    #[debug_requires(habitat.is_location_habitable(location), "location is habitable")]
    #[debug_ensures(
        ret < self.get_subdomain().size().get(),
        "subdomain rank is in range [0, self.get_subdomain().size())"
    )]
    fn map_location_to_subdomain_rank(&self, location: &Location, habitat: &H) -> u32;
}