Drop _assemb suffixes from test assembly loaders

In the process, make the loader names more consistent.
This commit is contained in:
Aaron Fenyes 2025-08-05 13:51:30 -07:00
parent ef1a579ac0
commit e0230a6fde

View file

@ -26,7 +26,7 @@ use crate::{
// done more work on saving and loading assemblies, we should come back to this // done more work on saving and loading assemblies, we should come back to this
// code to see if it can be simplified // code to see if it can be simplified
fn load_gen_assemb(assembly: &Assembly) { fn load_general(assembly: &Assembly) {
let _ = assembly.try_insert_element( let _ = assembly.try_insert_element(
Sphere::new( Sphere::new(
String::from("gemini_a"), String::from("gemini_a"),
@ -77,7 +77,7 @@ fn load_gen_assemb(assembly: &Assembly) {
); );
} }
fn load_low_curv_assemb(assembly: &Assembly) { fn load_low_curvature(assembly: &Assembly) {
// create the spheres // create the spheres
let a = 0.75_f64.sqrt(); let a = 0.75_f64.sqrt();
let _ = assembly.try_insert_element( let _ = assembly.try_insert_element(
@ -196,7 +196,7 @@ fn load_low_curv_assemb(assembly: &Assembly) {
} }
} }
fn load_pointed_assemb(assembly: &Assembly) { fn load_pointed(assembly: &Assembly) {
let _ = assembly.try_insert_element( let _ = assembly.try_insert_element(
Point::new( Point::new(
format!("point_front"), format!("point_front"),
@ -246,7 +246,7 @@ fn load_pointed_assemb(assembly: &Assembly) {
// B-C " // B-C "
// C-C " // C-C "
// A-C -0.25 * φ^2 = -0.6545084971874737 // A-C -0.25 * φ^2 = -0.6545084971874737
fn load_tridim_icosahedron_assemb(assembly: &Assembly) { fn load_tridim_icosahedron(assembly: &Assembly) {
// create the vertices // create the vertices
const COLOR_A: ElementColor = [1.00_f32, 0.25_f32, 0.25_f32]; const COLOR_A: ElementColor = [1.00_f32, 0.25_f32, 0.25_f32];
const COLOR_B: ElementColor = [0.75_f32, 0.75_f32, 0.75_f32]; const COLOR_B: ElementColor = [0.75_f32, 0.75_f32, 0.75_f32];
@ -409,7 +409,7 @@ fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
// to finish describing the dodecahedral circle packing, set the inversive // to finish describing the dodecahedral circle packing, set the inversive
// distance regulators to -1. some of the regulators have already been set // distance regulators to -1. some of the regulators have already been set
fn load_dodeca_packing_assemb(assembly: &Assembly) { fn load_dodeca_packing(assembly: &Assembly) {
// add the substrate // add the substrate
let _ = assembly.try_insert_element( let _ = assembly.try_insert_element(
Sphere::new( Sphere::new(
@ -550,7 +550,7 @@ fn load_dodeca_packing_assemb(assembly: &Assembly) {
// the initial configuration of this test assembly deliberately violates the // the initial configuration of this test assembly deliberately violates the
// constraints, so loading the assembly will trigger a non-trivial realization // constraints, so loading the assembly will trigger a non-trivial realization
fn load_balanced_assemb(assembly: &Assembly) { fn load_balanced(assembly: &Assembly) {
// create the spheres // create the spheres
const R_OUTER: f64 = 10.0; const R_OUTER: f64 = 10.0;
const R_INNER: f64 = 4.0; const R_INNER: f64 = 4.0;
@ -611,7 +611,7 @@ fn load_balanced_assemb(assembly: &Assembly) {
// the initial configuration of this test assembly deliberately violates the // the initial configuration of this test assembly deliberately violates the
// constraints, so loading the assembly will trigger a non-trivial realization // constraints, so loading the assembly will trigger a non-trivial realization
fn load_off_center_assemb(assembly: &Assembly) { fn load_off_center(assembly: &Assembly) {
// create a point almost at the origin and a sphere centered on the origin // create a point almost at the origin and a sphere centered on the origin
let _ = assembly.try_insert_element( let _ = assembly.try_insert_element(
Point::new( Point::new(
@ -648,7 +648,7 @@ fn load_off_center_assemb(assembly: &Assembly) {
// sqrt(1/6) and sqrt(3/2), respectively. to measure those radii, set an // sqrt(1/6) and sqrt(3/2), respectively. to measure those radii, set an
// inversive distance of -1 between the insphere and each face, and then set an // inversive distance of -1 between the insphere and each face, and then set an
// inversive distance of 0 between the circumsphere and each vertex // inversive distance of 0 between the circumsphere and each vertex
fn load_radius_ratio_assemb(assembly: &Assembly) { fn load_radius_ratio(assembly: &Assembly) {
let index_range = 1..=4; let index_range = 1..=4;
// create the spheres // create the spheres
@ -789,7 +789,7 @@ fn load_radius_ratio_assemb(assembly: &Assembly) {
// conditions are exactly representable as floats, unlike the analogous numbers // conditions are exactly representable as floats, unlike the analogous numbers
// in the scaled-up problem. the inexact representations might break the // in the scaled-up problem. the inexact representations might break the
// symmetry that's getting the engine stuck // symmetry that's getting the engine stuck
fn load_irisawa_hexlet_assemb(assembly: &Assembly) { fn load_irisawa_hexlet(assembly: &Assembly) {
let index_range = 1..=6; let index_range = 1..=6;
let colors = [ let colors = [
[1.00_f32, 0.00_f32, 0.25_f32], [1.00_f32, 0.00_f32, 0.25_f32],
@ -909,15 +909,15 @@ pub fn TestAssemblyChooser() -> View {
// load assembly // load assembly
match name.as_str() { match name.as_str() {
"general" => load_gen_assemb(assembly), "general" => load_general(assembly),
"low-curv" => load_low_curv_assemb(assembly), "low-curvature" => load_low_curvature(assembly),
"pointed" => load_pointed_assemb(assembly), "pointed" => load_pointed(assembly),
"tridim-icosahedron" => load_tridim_icosahedron_assemb(assembly), "tridim-icosahedron" => load_tridim_icosahedron(assembly),
"dodeca-packing" => load_dodeca_packing_assemb(assembly), "dodeca-packing" => load_dodeca_packing(assembly),
"balanced" => load_balanced_assemb(assembly), "balanced" => load_balanced(assembly),
"off-center" => load_off_center_assemb(assembly), "off-center" => load_off_center(assembly),
"radius-ratio" => load_radius_ratio_assemb(assembly), "radius-ratio" => load_radius_ratio(assembly),
"irisawa-hexlet" => load_irisawa_hexlet_assemb(assembly), "irisawa-hexlet" => load_irisawa_hexlet(assembly),
_ => (), _ => (),
}; };
}); });
@ -927,7 +927,7 @@ pub fn TestAssemblyChooser() -> View {
view! { view! {
select(bind:value = assembly_name) { select(bind:value = assembly_name) {
option(value = "general") { "General" } option(value = "general") { "General" }
option(value = "low-curv") { "Low-curvature" } option(value = "low-curvature") { "Low-curvature" }
option(value = "pointed") { "Pointed" } option(value = "pointed") { "Pointed" }
option(value = "tridim-icosahedron") { "Tridiminished icosahedron" } option(value = "tridim-icosahedron") { "Tridiminished icosahedron" }
option(value = "dodeca-packing") { "Dodecahedral packing" } option(value = "dodeca-packing") { "Dodecahedral packing" }