use goad::{
bins, multiproblem::MultiProblem, orientation::Euler, result::MuellerMatrix, settings,
zones::ZoneConfig,
};
use helpers::{compare_results, load_reference_mueller};
use num_complex::Complex32;
pub mod helpers;
const FRAC_TOL: f32 = 1e-4; const ABS_TOL: f32 = 1e4;
#[test]
fn fixed_hex_30_30_30() {
let mut settings = settings::load_default_config().unwrap();
settings.zones = vec![ZoneConfig::new(bins::Scheme::new_simple(19, 19))];
settings.orientation = goad::orientation::Orientation {
scheme: goad::orientation::Scheme::Discrete {
eulers: vec![Euler::new(30.0, 30.0, 30.0)],
},
euler_convention: goad::orientation::EulerConvention::ZYZ,
};
let mut multiproblem =
MultiProblem::new(None, Some(settings)).expect("Failed to create MultiProblem");
multiproblem.solve();
let full_zone = multiproblem
.result
.zones
.full_zone()
.expect("No full zone found");
let result = full_zone
.field_2d
.iter()
.map(|m| m.mueller_total.to_vec())
.collect::<Vec<Vec<f32>>>();
let reference = load_reference_mueller("fixed_hex_30_30_30_mueller_scatgrid").unwrap();
compare_results(result, reference, FRAC_TOL, ABS_TOL).unwrap();
}
#[test]
fn fixed_hex_30_20_20() {
let mut settings = settings::load_default_config().unwrap();
settings.zones = vec![ZoneConfig::new(bins::Scheme::new_simple(19, 19))];
settings.orientation = goad::orientation::Orientation {
scheme: goad::orientation::Scheme::Discrete {
eulers: vec![Euler::new(30.0, 20.0, 20.0)],
},
euler_convention: goad::orientation::EulerConvention::ZYZ,
};
settings.particle_refr_index = vec![Complex32::new(1.3117, 0.1)];
let mut multiproblem =
MultiProblem::new(None, Some(settings)).expect("Failed to create MultiProblem");
multiproblem.solve();
let full_zone = multiproblem
.result
.zones
.full_zone()
.expect("No full zone found");
let result = full_zone
.field_2d
.iter()
.map(|m| m.mueller_total.to_vec())
.collect::<Vec<Vec<f32>>>();
let reference = load_reference_mueller("fixed_hex_30_20_20_mueller_scatgrid").unwrap();
compare_results(result, reference, FRAC_TOL, ABS_TOL).unwrap();
}