summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-09-23 23:19:13 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-09-23 23:19:13 -0400
commit3f7f20f21f583ca2de566bea08a87eac4b17ad29 (patch)
treeea55b8f42f797653ed2bac21ad0bf57bf95068f5 /src
parent9e3726c6c7762f6292333f85117546acc01f5568 (diff)
downloadfuse_networks-3f7f20f21f583ca2de566bea08a87eac4b17ad29.tar.gz
fuse_networks-3f7f20f21f583ca2de566bea08a87eac4b17ad29.tar.bz2
fuse_networks-3f7f20f21f583ca2de566bea08a87eac4b17ad29.zip
successfully implemented the backbone trimming with homespun graph algorithms, measurements have mostly been disabled and need to be migrated
Diffstat (limited to 'src')
-rw-r--r--src/analysis_tools.cpp2
-rw-r--r--src/analysis_tools.hpp4
-rw-r--r--src/animate.cpp9
-rw-r--r--src/animate.hpp1
-rw-r--r--src/animate_fracture_square.cpp2
-rw-r--r--src/measurements.cpp13
-rw-r--r--src/measurements.hpp2
7 files changed, 13 insertions, 20 deletions
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<T> &l1, const std::list<T> &l2) {
return l1.size() < l2.size();
}
+/*
bool trivial(boost::detail::edge_desc_impl<boost::undirected_tag,unsigned long>) {
return true;
}
@@ -120,4 +121,5 @@ std::list<std::pair<std::array<unsigned, 2>, std::list<unsigned>>> 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<class T>
bool is_shorter(const std::list<T> &, const std::list<T> &);
-bool trivial(boost::detail::edge_desc_impl<boost::undirected_tag,unsigned long>);
+//bool trivial(boost::detail::edge_desc_impl<boost::undirected_tag,unsigned long>);
-std::list<std::pair<std::array<unsigned, 2>, std::list<unsigned>>> find_minimal_crack(const Graph &, const network &);
+//std::list<std::pair<std::array<unsigned, 2>, std::list<unsigned>>> 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 <iostream>
-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<long double>::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<long double>::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<unsigned> 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<std::list<graph::coordinate>> 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