Files
jyvikoandClaude Opus 5.5 d5bd74570f Rename the project to FieldCraft
Crates fieldcraft-*, binaries fieldcraft and fieldcraft-cli, the .fieldcraft file (format tag
fieldcraft/1, manifest fieldcraft.json), FIELDCRAFT_* environment variables, the MCP server
name, egui widget ids (fc_*), the app icon document FieldCraft.icon and its generated family,
docs and licences. No compatibility shim: no files of the earlier name exist.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
2026-10-13 23:51:40 -04:00

51 lines
1.6 KiB
Rust

//! Throughput of the Delaunay tetrahedralization on 1M random points and on a 100³ grid (every
//! cell cospherical). Ignored by default; run with
//! `cargo test --release -p fieldcraft-mesh --test delaunay_bench -- --ignored --nocapture`.
use std::time::Instant;
use fieldcraft_mesh::delaunay::Triangulation;
struct Rng(u64);
impl Rng {
fn next_u64(&mut self) -> u64 {
self.0 = self.0.wrapping_add(0x9E37_79B9_7F4A_7C15);
let mut z = self.0;
z = (z ^ (z >> 30)).wrapping_mul(0xBF58_476D_1CE4_E5B9);
z = (z ^ (z >> 27)).wrapping_mul(0x94D0_49BB_1331_11EB);
z ^ (z >> 31)
}
fn unit(&mut self) -> f64 {
(self.next_u64() >> 11) as f64 / (1u64 << 53) as f64
}
}
fn run(name: &str, points: &[[f64; 3]]) {
let start = Instant::now();
let tri = Triangulation::new(points).unwrap();
let build = start.elapsed().as_secs_f64();
let start = Instant::now();
tri.verify().unwrap();
let verify = start.elapsed().as_secs_f64();
let tets = tri.finite_tet_count();
println!(
"{name}: {} points -> {tets} tets in {build:.2} s ({:.0} points/s, {:.0} tets/s); verify {verify:.2} s",
points.len(),
points.len() as f64 / build,
tets as f64 / build
);
}
#[test]
#[ignore]
fn delaunay_throughput() {
let mut r = Rng(1);
let random: Vec<[f64; 3]> = (0..1_000_000).map(|_| [r.unit(), r.unit(), r.unit()]).collect();
run("random 1M", &random);
let n = 100;
let grid: Vec<[f64; 3]> = (0..n * n * n).map(|i| [(i % n) as f64, ((i / n) % n) as f64, (i / (n * n)) as f64]).collect();
run("grid 100^3", &grid);
}