From 3f7f20f21f583ca2de566bea08a87eac4b17ad29 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 23 Sep 2019 23:19:13 -0400 Subject: successfully implemented the backbone trimming with homespun graph algorithms, measurements have mostly been disabled and need to be migrated --- src/analysis_tools.cpp | 2 ++ src/analysis_tools.hpp | 4 ++-- src/animate.cpp | 9 ++++++--- src/animate.hpp | 1 - src/animate_fracture_square.cpp | 2 +- src/measurements.cpp | 13 ++----------- src/measurements.hpp | 2 -- 7 files changed, 13 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/analysis_tools.cpp b/src/analysis_tools.cpp index 2ef74c6..5f180ee 100644 --- a/src/analysis_tools.cpp +++ b/src/analysis_tools.cpp @@ -6,6 +6,7 @@ bool is_shorter(const std::list &l1, const std::list &l2) { return l1.size() < l2.size(); } +/* bool trivial(boost::detail::edge_desc_impl) { return true; } @@ -120,4 +121,5 @@ std::list, std::list>> find_minimal_ return output; } +*/ diff --git a/src/analysis_tools.hpp b/src/analysis_tools.hpp index c3bffa2..2a4c5d2 100644 --- a/src/analysis_tools.hpp +++ b/src/analysis_tools.hpp @@ -11,7 +11,7 @@ template bool is_shorter(const std::list &, const std::list &); -bool trivial(boost::detail::edge_desc_impl); +//bool trivial(boost::detail::edge_desc_impl); -std::list, std::list>> find_minimal_crack(const Graph &, const network &); +//std::list, std::list>> find_minimal_crack(const Graph &, const network &); diff --git a/src/animate.cpp b/src/animate.cpp index a7b6173..6c844d2 100644 --- a/src/animate.cpp +++ b/src/animate.cpp @@ -2,7 +2,7 @@ #include "animate.hpp" #include -animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *argv[]) : G(2 * (unsigned)ceil(Lx * Ly / 2)) { +animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *argv[]) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize((unsigned)(Lx / Ly * window_size), window_size); @@ -16,7 +16,6 @@ animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *arg void animate::pre_fracture(const network &n) { lv = std::numeric_limits::lowest(); avalanches = {}; - boost::remove_edge_if(trivial, G); seen_guy = false; glClearColor(1.0f, 1.0f, 1.0f, 1.0f ); @@ -59,7 +58,6 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned i) avalanches.back().push_back(i); } - boost::add_edge(n.G.dual_edges[i].v[0], n.G.dual_edges[i].v[1], {i}, G); glClearColor(1.0f, 1.0f, 1.0f, 1.0f ); glClear(GL_COLOR_BUFFER_BIT); @@ -110,6 +108,11 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned i) draw = true; } + if (cur.currents[j] > 1e-9 && n.backbone[j]) { + weird = true; + } + + if (draw) { graph::coordinate r1 = n.G.vertices[n.G.edges[j].v[0]].r; graph::coordinate r2 = n.G.vertices[n.G.edges[j].v[1]].r; diff --git a/src/animate.hpp b/src/animate.hpp index 865b3bd..d14d755 100644 --- a/src/animate.hpp +++ b/src/animate.hpp @@ -9,7 +9,6 @@ class animate : public hooks { private: - Graph G; bool seen_guy; public: long double lv; diff --git a/src/animate_fracture_square.cpp b/src/animate_fracture_square.cpp index bc4c3a2..12de7da 100644 --- a/src/animate_fracture_square.cpp +++ b/src/animate_fracture_square.cpp @@ -68,7 +68,7 @@ int main(int argc, char* argv[]) { for (unsigned trial = 0; trial < N; trial++) { elastic_network tmp_network(perm_network); tmp_network.set_thresholds(beta, rng); - tmp_network.fracture(meas, false); + tmp_network.fracture(meas, true); if (quit.load()) break; diff --git a/src/measurements.cpp b/src/measurements.cpp index 984b80c..3004d7e 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -144,7 +144,6 @@ unsigned edge_r_to_ind(graph::coordinate r, double Lx, double Ly, unsigned Mx, u } ma::ma(unsigned n, double a, double beta, double weight, bool one) : - G(2 * n), sn(2 * n), ss(2 * n), sm(2 * n), @@ -179,7 +178,6 @@ ma::ma(unsigned n, double a, double beta, double weight, bool one) : } ma::ma(unsigned Lx, unsigned Ly, double beta, double weight, bool one) : - G(Lx * Ly / 2), sn(Lx * Ly / 2), ss(Lx * Ly / 2), sm(Lx * Ly / 2), @@ -228,7 +226,6 @@ ma::~ma() { void ma::pre_fracture(const network&) { lv = std::numeric_limits::lowest(); - boost::remove_edge_if(trivial, G); avalanches = {}; num = 0; } @@ -250,14 +247,11 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { } } - boost::add_edge(net.G.dual_edges[i].v[0], net.G.dual_edges[i].v[1], {i}, G); num++; } void ma::post_fracture(network &n) { - auto post_cracks = find_minimal_crack(G, n); - std::vector component(boost::num_vertices(G)); - unsigned num = boost::connected_components(G, &component[0]); +/* auto post_cracks = find_minimal_crack(G, n); if (post_cracks.size() > 2 || post_cracks.size() == 0) { throw badcycleex; } @@ -271,10 +265,6 @@ void ma::post_fracture(network &n) { autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cl.size()), 2 * sqrt(cl.size()), cl, cl_cs, c.first); } - unsigned crack_component = component[n.G.dual_edges[post_cracks.front().second.front()].v[0]]; - - std::vector> components(num); - for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) { components[component[i]].push_back(n.G.dual_vertices[i].r); } @@ -336,6 +326,7 @@ void ma::post_fracture(network &n) { } autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cA.size()), 2 * sqrt(cA.size()), cA, cA_co, post_cracks.front().first); +*/ sd[num - 1]++; } diff --git a/src/measurements.hpp b/src/measurements.hpp index b22c327..879f511 100644 --- a/src/measurements.hpp +++ b/src/measurements.hpp @@ -19,8 +19,6 @@ class ma : public hooks { // - interface for turning on and off specific measurements // private: - Graph G; - unsigned num; // measurement storage -- cgit v1.2.3-54-g00ecf