From 117476f964c8700d16294e06bafc7e8491482620 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Sat, 15 Jun 2019 18:16:42 -0400 Subject: added maesurement of current histograms --- src/measurements.cpp | 13 +++++++++++-- src/measurements.hpp | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/measurements.cpp b/src/measurements.cpp index 969f487..0732d24 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -152,7 +152,8 @@ ma::ma(unsigned n, double a, double beta) : sd(3 * n), sc(2 * n), sa(3 * n), - sA(3 * n) + sA(3 * n), + si(10000) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_"; @@ -171,7 +172,8 @@ ma::ma(unsigned Lx, unsigned Ly, double beta) : sd(Lx * Ly), sc(Lx * Ly / 2), sa(Lx * Ly), - sA(Lx * Ly) + sA(Lx * Ly), + si(10000) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_"; @@ -190,6 +192,7 @@ ma::~ma() { 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); } void ma::pre_fracture(const network&) { @@ -208,6 +211,12 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { avalanches.back().push_back(i); } + for (unsigned j = 0; j < cur.currents.size(); j++) { + if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0) { + si[(unsigned)(10000 * (logl(cur.currents[j]) + 100) / 100)]++; + } + } + boost::add_edge(net.G.dual_edges[i].v[0], net.G.dual_edges[i].v[1], {i}, G); num++; } diff --git a/src/measurements.hpp b/src/measurements.hpp index 961ad7a..5b76e26 100644 --- a/src/measurements.hpp +++ b/src/measurements.hpp @@ -34,6 +34,8 @@ class ma : public hooks { std::vector sa; // non-final avalanche size distribution std::vector sA; // non-final avalanche size distribution + std::vector si; + public: long double lv; -- cgit v1.2.3-54-g00ecf