summaryrefslogtreecommitdiff
path: root/src/measurements.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/measurements.cpp')
-rw-r--r--src/measurements.cpp70
1 files changed, 23 insertions, 47 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp
index c58fd84..96b4ccb 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -142,45 +142,55 @@ unsigned edge_r_to_ind(graph::coordinate r, double Lx, double Ly, unsigned Mx, u
return floor((Mx * r.x) / Lx) + Mx * floor((My * r.y) / Ly);
}
-ma::ma(unsigned n, double a, double beta) :
+ma::ma(unsigned n, double a, double beta, double weight, bool one) :
G(2 * n),
sn(2 * n),
ss(2 * n),
sm(2 * n),
sl(2 * n),
- sb(n),
+ sb(n + 1),
sd(3 * n),
- sc(2 * n),
sa(3 * n),
sA(3 * n),
si(10000),
sI(10000)
{
if (beta != 0.0) {
- model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_";
+ model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_" + std::to_string(weight) + "_";
} else {
- model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_INF_";
+ model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_INF_" + std::to_string(weight) + "_";
+ }
+
+ if (one) {
+ model_string = model_string + "o_";
+ } else {
+ model_string = model_string + "t_";
}
}
-ma::ma(unsigned Lx, unsigned Ly, double beta) :
+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),
sl(Lx * Ly / 2),
- sb(Lx * Ly / 2),
+ sb(Lx * Ly / 2 + 1),
sd(Lx * Ly),
- sc(Lx * Ly / 2),
sa(Lx * Ly),
sA(Lx * Ly),
si(10000),
sI(10000)
{
if (beta != 0.0) {
- model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_";
+ model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_" + std::to_string(weight) + "_";
} else {
- model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_INF_";
+ model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_INF_" + std::to_string(weight) + "_";
+ }
+
+ if (one) {
+ model_string = model_string + "o_";
+ } else {
+ model_string = model_string + "t_";
}
}
@@ -191,7 +201,6 @@ ma::~ma() {
update_distribution_file("sl", sl, model_string);
update_distribution_file("sb", sb, model_string);
update_distribution_file("sd", sd, model_string);
- update_distribution_file("sc", sc, model_string);
update_distribution_file("sa", sa, model_string);
update_distribution_file("sA", sA, model_string);
update_distribution_file("si", si, model_string);
@@ -260,43 +269,10 @@ void ma::post_fracture(network &n) {
sn[components[i].size() - 1]++;
}
- auto av_it = avalanches.rbegin();
-
- while (true) {
- for (unsigned e : *av_it) {
- boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G);
- n.break_edge(e, true);
- }
-
- auto cracks = find_minimal_crack(G, n);
-
- if (cracks.size() == 0) {
- break;
- }
-
- av_it++;
- }
-
- num = boost::connected_components(G, &component[0]);
-
- std::vector<std::list<graph::coordinate>> new_components(num);
-
- for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) {
- new_components[component[i]].push_back(n.G.dual_vertices[i].r);
- }
-
- for (unsigned i = 0; i < num; i++) {
- sc[new_components[i].size() - 1]++;
- }
-
- /*
- current_info ct = n.get_current_info();
-
-
std::vector<bool> vertex_in(n.G.vertices.size());
for (unsigned i = 0; i < n.G.edges.size(); i++) {
- if (ct.currents[i] > CURRENT_CUTOFF) {
+ if (!n.backbone[i]) {
vertex_in[n.G.edges[i].v[0]] = true;
vertex_in[n.G.edges[i].v[1]] = true;
}
@@ -308,9 +284,9 @@ void ma::post_fracture(network &n) {
if (vertex_in[i]) bb_size++;
}
- sb[bb_size - 1]++;
- */
+ sb[bb_size]++;
+ auto av_it = avalanches.rbegin();
av_it++;
while (av_it != avalanches.rend()) {