use deep_causality_data_structures::{ArrayGrid, ArrayType, PointIndex};
pub const HEIGHT: usize = 5;
pub const WIDTH: usize = 5;
pub const DEPTH: usize = 5;
pub const TIME: usize = 5;
pub type AdjustmentData = ArrayGrid<i32, WIDTH, HEIGHT, DEPTH, TIME>;
pub fn get_1d_array_grid(val: i32) -> AdjustmentData {
let array_type = ArrayType::Array1D;
let ag: ArrayGrid<i32, WIDTH, HEIGHT, DEPTH, TIME> = ArrayGrid::new(array_type);
let p = PointIndex::new1d(0);
ag.set(p, val);
ag
}
pub const ARRAY_TYPES: [ArrayType; 4] = [
ArrayType::Array1D,
ArrayType::Array2D,
ArrayType::Array3D,
ArrayType::Array4D,
];
pub fn get_slots_array_grid<const N: usize>(
array_type: ArrayType,
values: [f64; N],
) -> ArrayGrid<f64, 4, 4, 4, 4> {
const {
assert!(
N <= 4,
"a 4×4×4×4 grid holds at most four positions along an axis"
)
};
let grid = ArrayGrid::new(array_type);
values.iter().enumerate().for_each(|(k, &value)| {
let position = match array_type {
ArrayType::Array1D => PointIndex::new1d(k),
ArrayType::Array2D => PointIndex::new2d(k, 0),
ArrayType::Array3D => PointIndex::new3d(0, 0, k),
ArrayType::Array4D => PointIndex::new4d(0, 0, k, 0),
};
grid.set(position, value);
});
grid
}