summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-02 11:30:49 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-02 11:30:49 -0400
commite856feba484dc5617891d2c09d5af28f87d462a5 (patch)
treea8fd33a13064795e05e95ae995752db582af38a6
parentea1fabde9c6522209bf88b722b64a4bce1248cec (diff)
downloadfuse_networks-e856feba484dc5617891d2c09d5af28f87d462a5.tar.gz
fuse_networks-e856feba484dc5617891d2c09d5af28f87d462a5.tar.bz2
fuse_networks-e856feba484dc5617891d2c09d5af28f87d462a5.zip
don't remake the square lattice every time
-rw-r--r--src/fracture.cpp10
1 files 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';