diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-09-04 13:43:57 -0400 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2019-09-04 13:43:57 -0400 |
commit | e817d415f02bae04881a5f0d3c1f1e313a892014 (patch) | |
tree | 307ad4bb719f56fb9bdc7798f0aab9e380e3f0e6 /src | |
parent | f18103d3ef037ab00004ef2095162b3802af58c2 (diff) | |
download | fuse_networks-e817d415f02bae04881a5f0d3c1f1e313a892014.tar.gz fuse_networks-e817d415f02bae04881a5f0d3c1f1e313a892014.tar.bz2 fuse_networks-e817d415f02bae04881a5f0d3c1f1e313a892014.zip |
reimplemented distance-from-pc measurements of the cluster size distributions
Diffstat (limited to 'src')
-rw-r--r-- | src/perc_meas.cpp | 21 | ||||
-rw-r--r-- | src/perc_meas.hpp | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/perc_meas.cpp b/src/perc_meas.cpp index 6ae637a..f0d7cbb 100644 --- a/src/perc_meas.cpp +++ b/src/perc_meas.cpp @@ -76,6 +76,7 @@ pm::pm(unsigned n, double a) : parent(2 * n), ds(&rank[0], &parent[0]), sn(3 * n), + sN(3 * n), ss(2 * n), sm(2 * n), sl(2 * n), @@ -86,6 +87,9 @@ pm::pm(unsigned n, double a) : for (std::vector<uint64_t> &x : sn) { x.resize(2 * n); } + for (std::vector<uint64_t> &x : sN) { + x.resize(2 * n); + } for (std::vector<uint64_t> &x : sb) { x.resize(n); } @@ -97,6 +101,7 @@ pm::pm(unsigned Lx, unsigned Ly) : parent(Lx * Ly / 2), ds(&rank[0], &parent[0]), sn(Lx * Ly), + sN(Lx * Ly), ss(Lx * Ly / 2), sm(Lx * Ly / 2), sl(Lx * Ly / 2), @@ -107,6 +112,9 @@ pm::pm(unsigned Lx, unsigned Ly) : for (std::vector<uint64_t> &x : sn) { x.resize(Lx * Ly / 2); } + for (std::vector<uint64_t> &x : sN) { + x.resize(Lx * Ly / 2); + } for (std::vector<uint64_t> &x : sb) { x.resize(Lx * Ly / 2); } @@ -114,6 +122,7 @@ pm::pm(unsigned Lx, unsigned Ly) : pm::~pm() { update_distribution_file("sn", sn, model_string); + update_distribution_file("sN", sN, model_string); update_distribution_file("ss", ss, model_string); update_distribution_file("sm", sm, model_string); update_distribution_file("sl", sl, model_string); @@ -126,6 +135,7 @@ void pm::pre_fracture(const network&) { initialize_incremental_components(G, ds); incremental_components(G, ds); r = 0; + sN_tmp.clear(); } void pm::bond_broken(const network& net, const current_info& cur, unsigned i) { @@ -135,6 +145,8 @@ void pm::bond_broken(const network& net, const current_info& cur, unsigned i) { boost::component_index<VertexIndex> components(parent.begin(), parent.end()); std::vector<unsigned> counts(components.size()); + sN_tmp.push_front({}); + BOOST_FOREACH(VertexIndex current_index, components) { unsigned comp_size = 0; BOOST_FOREACH(VertexIndex child_index, components[current_index]) { @@ -142,6 +154,7 @@ void pm::bond_broken(const network& net, const current_info& cur, unsigned i) { } sn[r][comp_size - 1]++; + sN_tmp.front().push_back(comp_size - 1); } std::vector<bool> vertex_in(net.G.vertices.size()); @@ -191,6 +204,14 @@ void pm::post_fracture(network &n) { } } + unsigned dr = 0; + for (std::list<unsigned> l : sN_tmp) { + for (unsigned size : l) { + sN[dr][size]++; + } + dr++; + } + sd[r - 1]++; } diff --git a/src/perc_meas.hpp b/src/perc_meas.hpp index e2357db..75ef61a 100644 --- a/src/perc_meas.hpp +++ b/src/perc_meas.hpp @@ -32,13 +32,14 @@ class pm : public hooks { // measurement storage std::vector<std::vector<uint64_t>> sn; // non-spanning cluster size distribution + std::vector<std::vector<uint64_t>> sN; // non-spanning cluster size distribution + std::list<std::list<unsigned>> sN_tmp; // non-spanning cluster size distribution std::vector<uint64_t> ss; // minimal spanning cluster size distribution std::vector<uint64_t> sm; // spanning cluster size distribution std::vector<uint64_t> sl; // final avalanche size distribution std::vector<std::vector<uint64_t>> sb; // final avalanche size distribution std::vector<uint64_t> sd; std::vector<uint64_t> sr; - std::vector<unsigned> sb_tmp; public: std::string model_string; |