~mht/cra

36bae91293d651cc31d7715cfb1f42411ff915f7 — Martin Hafskjold Thoresen 7 months ago 2277c12
Add test tet file, and flush out some easy bugs
4 files changed, 19 insertions(+), 4 deletions(-)

A cra/data/tet.boundary
M cra/src/main.rs
M cra/src/output.rs
M cra/src/persistence.rs
A cra/data/tet.boundary => cra/data/tet.boundary +12 -0
@@ 0,0 1,12 @@
4
 1  2
 1  3
 1  4
 2  3
 2  4
 3  4
 5  6 8
 5  7 9
 6  7 10
 8  9 10
11 12 13 14

M cra/src/main.rs => cra/src/main.rs +2 -1
@@ 14,7 14,8 @@ use persistence::{compute_alpha_values_2d, reduce, Persistence, Simplex};

// consts
const R_CUTOFF: f64 = 250.0;
const MAX_DIM: usize = 3;
// TODO: remove this
const MAX_DIM: usize = 10;

/// All the statistics we want to measure for performance reasoning.
#[derive(Debug)]

M cra/src/output.rs => cra/src/output.rs +1 -1
@@ 668,7 668,7 @@ pub fn graphviz<W: Write>(
        if std.simplex_with_low[i].is_some() {
            let s = std.simplex_with_low[i].as_ref().unwrap();
            let e = exh.simplex_with_low[i].as_ref().unwrap();
            assert_eq!(std.j_stored_at[i], exh.j_stored_at[i]);
            assert_eq!(s.j, e.j);
            if s.faces.len() == 2 {
                writeln!(w, "  {} -> {} [color=\"red\"]", s.faces[1], s.faces[0])?;
                writeln!(w, "  {} -> {} [color=\"green\"]", e.faces[1], e.faces[0])?;

M cra/src/persistence.rs => cra/src/persistence.rs +4 -2
@@ 238,10 238,12 @@ fn simplex_reduce(this: &mut Simplex, other: &Simplex) {
    }

    if fastpath {
        // fast path
        this.faces.reserve(num_inds);
        this.faces.clear();
        this.faces.copy_from_slice(buf);
        for &n in &buf[..buffer_i] {
            this.faces.push(n);
        }

    } else {
        std::mem::swap(&mut this.faces, &mut slow_vec);
    }