From e856feba484dc5617891d2c09d5af28f87d462a5 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 2 Oct 2019 11:30:49 -0400 Subject: don't remake the square lattice every time --- src/fracture.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/fracture.cpp b/src/fracture.cpp index b82abca..96cdac3 100644 --- a/src/fracture.cpp +++ b/src/fracture.cpp @@ -98,13 +98,15 @@ int main(int argc, char* argv[]) { } else { ma meas(Lx, Ly, beta, w); + const graph G(Lx, Ly); + const elastic_network fuse_network(G, &c, w); + for (unsigned trial = 0; trial < N; trial++) { while (true) { try { - graph G(Lx, Ly); - elastic_network fuse_network(G, &c, w); - fuse_network.set_thresholds(beta, rng); - fuse_network.fracture(meas); + elastic_network net = fuse_network; + net.set_thresholds(beta, rng); + net.fracture(meas); break; } catch (std::exception &e) { std::cout << e.what() << '\n'; -- cgit v1.2.3-54-g00ecf