diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-04-24 23:31:40 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-04-24 23:31:40 -0400 |
commit | cb1b2e6822bdd1d1644ff2dad2d6157858e105b0 (patch) | |
tree | 8f4cb4225d2856e87ff797d58466759dedd39882 /src/animate.cpp | |
parent | afe7000d6147cefd030413cb3d051c2a6260f608 (diff) | |
download | fuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.tar.gz fuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.tar.bz2 fuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.zip |
many changes to introduce two-component, elastic-like fracture
Diffstat (limited to 'src/animate.cpp')
-rw-r--r-- | src/animate.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/animate.cpp b/src/animate.cpp index 5bae15e..be0beef 100644 --- a/src/animate.cpp +++ b/src/animate.cpp @@ -1,5 +1,6 @@ #include "animate.hpp" +#include <iostream> animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *argv[]) : G(2 * (unsigned)ceil(Lx * Ly / 2)) { glutInit(&argc, argv); @@ -85,20 +86,41 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned i) } void animate::post_fracture(network &n) { + + std::list<unsigned> crack; +// unsigned crack_component = component[n.G.dual_edges[crack.front()].v[0]]; + unsigned crack_component = 10000; + + std::default_random_engine gen; + std::uniform_real_distribution<double> dis(0.0,1.0); + + bool cycle_present = true; + auto av_it = avalanches.rbegin(); + + while (cycle_present) { + for (unsigned e : *av_it) { + boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G); + n.fuses[e] = false; + } + + auto cracks = find_minimal_crack(G, n); + std::cout << cracks.size() << "\n"; + if (cracks.size() == 0) { + cycle_present = false; + } + + av_it++; + } + std::vector<unsigned> component(boost::num_vertices(G)); unsigned num = boost::connected_components(G, &component[0]); - std::list<unsigned> crack = find_minimal_crack(G, n); - unsigned crack_component = component[n.G.dual_edges[crack.front()].v[0]]; - std::vector<std::list<unsigned>> components(num); for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) { components[component[i]].push_back(i); } - std::default_random_engine gen; - std::uniform_real_distribution<double> dis(0.0,1.0); char key; while ((key = getchar()) != 'n') { |