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

use crate::decomposition::Decomposition;

#[allow(clippy::module_name_repetitions)]
#[derive(Debug, Default)]
pub struct MonolithicDecomposition(());

#[contract_trait]
impl Backup for MonolithicDecomposition {
    unsafe fn backup_unchecked(&self) -> Self {
        Self(())
    }
}

#[contract_trait]
impl<M: MathsCore, H: Habitat<M>> Decomposition<M, H> for MonolithicDecomposition {
    fn get_subdomain(&self) -> Partition {
        Partition::monolithic()
    }

    fn map_location_to_subdomain_rank(&self, _location: &Location, _habitat: &H) -> u32 {
        0_u32
    }
}