summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/measurements.cpp40
-rw-r--r--src/measurements.hpp6
2 files changed, 41 insertions, 5 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp
index 0a5471e..576ab31 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -161,10 +161,10 @@ 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)
- : sc(2 * n), sC(2 * n), sn(2 * n), ss(2 * n), sm(2 * n), sl(2 * n), sb(n + 1), sd(3 * n), sD(3 * n), sf(3 * n), sa(3 * n),
+ : sc(2 * n), sC(2 * n), sn(2 * n), ss(2 * n), sm(2 * n), sl(2 * n), sb(n + 1), sB(n + 1), sd(3 * n), sD(3 * n), sf(3 * n), sa(3 * n),
sA(3 * n), se(3 * n), sE(3 * n), si(10000), sI(10000), sy(10000), sY(10000), sz(10000), sZ(10000), cc(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cC(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cn(pow(1+2*(unsigned)ceil(sqrt(n)), 2)),
cs(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cm(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cl(pow(1+2*(unsigned)ceil(sqrt(n)), 2)),
- cb(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), ca(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cA(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), ce(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cE(pow(1+2*(unsigned)ceil(sqrt(n)), 2)),
+ cb(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cB(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), ca(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cA(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), ce(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), cE(pow(1+2*(unsigned)ceil(sqrt(n)), 2)),
cq(pow(1+2*(unsigned)ceil(sqrt(n)), 2)), last_clusters(2 * n), last_clusters_v(2 * n) {
if (beta != 0.0) {
model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" +
@@ -181,6 +181,7 @@ ma::ma(unsigned n, double a, double beta, double weight)
Ns = 0;
Nn = 0;
Nb = 0;
+ NB = 0;
Na = 0;
NA = 0;
Nq = 0;
@@ -191,10 +192,10 @@ ma::ma(unsigned n, double a, double beta, double weight)
ma::ma(unsigned Lx, unsigned Ly, double beta, double weight)
: sc(Lx * Ly / 2), sC(Lx * Ly / 2), sn(Lx * Ly / 2), ss(Lx * Ly / 2), sm(Lx * Ly / 2), sl(Lx * Ly / 2),
- sb(Lx * Ly / 2 + 1), sd(Lx * Ly), sD(Lx * Ly), sf(Lx * Ly), sa(Lx * Ly), sA(Lx * Ly), se(Lx * Ly), sE(Lx * Ly), si(10000), sI(10000), sy(10000), sY(10000), sz(10000), sZ(10000),
+ sb(Lx * Ly / 2 + 1), sB(Lx * Ly / 2 + 1), sd(Lx * Ly), sD(Lx * Ly), sf(Lx * Ly), sa(Lx * Ly), sA(Lx * Ly), se(Lx * Ly), sE(Lx * Ly), si(10000), sI(10000), sy(10000), sY(10000), sz(10000), sZ(10000),
cc((Lx / 2 + 1) * (Ly / 2 + 1)), cC((Lx / 2 + 1) * (Ly / 2 + 1)), cn((Lx / 2 + 1) * (Ly / 2 + 1)),
cs((Lx / 2 + 1) * (Ly / 2 + 1)), cm((Lx / 2 + 1) * (Ly / 2 + 1)),
- cl((Lx / 2 + 1) * (Ly / 2 + 1)), cb((Lx / 2 + 1) * (Ly / 2 + 1)),
+ cl((Lx / 2 + 1) * (Ly / 2 + 1)), cb((Lx / 2 + 1) * (Ly / 2 + 1)), cB((Lx / 2 + 1) * (Ly / 2 + 1)),
ca((Lx / 2 + 1) * (Ly / 2 + 1)), cA((Lx / 2 + 1) * (Ly / 2 + 1)),
ce((Lx / 2 + 1) * (Ly / 2 + 1)), cE((Lx / 2 + 1) * (Ly / 2 + 1)),
cq((Lx / 2 + 1) * (Ly / 2 + 1)), last_clusters(Lx * Ly / 2), last_clusters_v(Lx * Ly / 2) {
@@ -214,6 +215,7 @@ ma::ma(unsigned Lx, unsigned Ly, double beta, double weight)
Ns = 0;
Nn = 0;
Nb = 0;
+ NB = 0;
Na = 0;
NA = 0;
Ne = 0;
@@ -229,6 +231,7 @@ ma::~ma() {
update_distribution_file("sm", sm, model_string);
update_distribution_file("sl", sl, model_string);
update_distribution_file("sb", sb, model_string);
+ update_distribution_file("sB", sB, model_string);
update_distribution_file("sd", sd, model_string);
update_distribution_file("sD", sD, model_string);
update_distribution_file("sf", sf, model_string);
@@ -249,6 +252,7 @@ ma::~ma() {
update_field_file("cs", Ns, cs, model_string);
update_field_file("cn", Nn, cn, model_string);
update_field_file("cb", Nb, cb, model_string);
+ update_field_file("cB", NB, cB, model_string);
update_field_file("ca", Na, ca, model_string);
update_field_file("cA", NA, cA, model_string);
update_field_file("ce", Ne, ce, model_string);
@@ -270,6 +274,7 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
long double c = net.thresholds[i] - logl(cur.currents[i]);
long double v = net.thresholds[i] - logl(cur.currents[i] * cur.conductivity[0]);
if (c > lc) {
+ last_backbone_c = net.backbone;
last_clusters = net.C;
lc = c;
moduliA.push_back(cur.conductivity[0]);
@@ -278,6 +283,7 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
avalanches.back().push_back(i);
}
if (v > lv) {
+ last_backbone_v = net.backbone;
last_clusters_v = net.C;
lv = v;
moduliE.push_back(cur.conductivity[0]);
@@ -365,7 +371,7 @@ void ma::post_fracture(network& n) {
std::vector<bool> vertex_in(n.G.vertices.size());
for (unsigned i = 0; i < n.G.edges.size(); i++) {
- if (!n.backbone[i]) {
+ if (!last_backbone_c[i]) {
vertex_in[n.G.edges[i].v[0]] = true;
vertex_in[n.G.edges[i].v[1]] = true;
}
@@ -386,6 +392,30 @@ void ma::post_fracture(network& n) {
autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cb, cb_co, crack.first);
Nb += bb_size;
+ std::vector<bool> vertex_in_v(n.G.vertices.size());
+
+ for (unsigned i = 0; i < n.G.edges.size(); i++) {
+ if (!last_backbone_v[i]) {
+ vertex_in_v[n.G.edges[i].v[0]] = true;
+ vertex_in_v[n.G.edges[i].v[1]] = true;
+ }
+ }
+
+ bb_size = 0;
+
+ std::list<graph::coordinate> cB_co;
+
+ for (unsigned i = 0; i < n.G.vertices.size(); i++) {
+ if (vertex_in_v[i]) {
+ bb_size++;
+ cB_co.push_back(n.G.vertices[i].r);
+ }
+ }
+
+ sB[bb_size]++;
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cB, cB_co, crack.first);
+ NB += bb_size;
+
auto av_it = avalanches.rbegin();
av_it++;
diff --git a/src/measurements.hpp b/src/measurements.hpp
index a4ed5d7..c780c3f 100644
--- a/src/measurements.hpp
+++ b/src/measurements.hpp
@@ -27,6 +27,7 @@ class ma : public hooks {
uint64_t Ns;
uint64_t Nn;
uint64_t Nb;
+ uint64_t NB;
uint64_t Na;
uint64_t Ne;
uint64_t NA;
@@ -41,6 +42,7 @@ class ma : public hooks {
std::vector<uint64_t> sm; // spanning cluster size distribution
std::vector<uint64_t> sl; // final avalanche size distribution
std::vector<uint64_t> sb; // final avalanche size distribution
+ std::vector<uint64_t> sB; // final avalanche size distribution
std::vector<uint64_t> sd; // final avalanche size distribution
std::vector<uint64_t> sD; // final avalanche size distribution
std::vector<uint64_t> sf; // final avalanche size distribution
@@ -63,6 +65,7 @@ class ma : public hooks {
std::vector<uint64_t> cm;
std::vector<uint64_t> cl;
std::vector<uint64_t> cb;
+ std::vector<uint64_t> cB;
std::vector<uint64_t> ca;
std::vector<uint64_t> ce;
std::vector<uint64_t> cA;
@@ -72,6 +75,9 @@ class ma : public hooks {
ClusterTree last_clusters;
ClusterTree last_clusters_v;
+ std::vector<bool> last_backbone_c;
+ std::vector<bool> last_backbone_v;
+
public:
long double lc;
long double lv;