diff options
| -rw-r--r-- | src/measurements.cpp | 166 | ||||
| -rw-r--r-- | src/measurements.hpp | 15 | 
2 files changed, 3 insertions, 178 deletions
| diff --git a/src/measurements.cpp b/src/measurements.cpp index 23cfd06..ff217b2 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -125,21 +125,6 @@ ma::ma(double Lx, double Ly, unsigned Mx, unsigned My, double beta, unsigned Ncu    sl(3 * (unsigned)ceil(Lx * Ly / 2), 0),    sd(3 * (unsigned)ceil(Lx * Ly / 2), 0),    sD(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Sc(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Ss(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Sm(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Sa(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Sl(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Sd(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  SD(3 * (unsigned)ceil(Lx * Ly / 2), 0), -  Ccc(Ncum), -  Css(Ncum), -  Cmm(Ncum), -  Caa(Ncum), -  Cll(Ncum), -  Cdd(Ncum), -  CDD(Ncum), -  CsD(Ncum),    ccc(Ncum),    css(Ncum),    cmm(Ncum), @@ -153,14 +138,6 @@ ma::ma(double Lx, double Ly, unsigned Mx, unsigned My, double beta, unsigned Ncu    Nc = 0;    Na = 0;    for (unsigned i = 0; i < Ncum; i++) { -    Ccc[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    Css[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    Cmm[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    Caa[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    Cll[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    Cdd[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    CDD[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); -    CsD[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0);      ccc[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0);      css[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0);      cmm[i].resize((Mx / 2 + 1) * (My / 2 + 1), 0); @@ -203,23 +180,6 @@ ma::~ma() {    update_distribution_file("sd", sd, N, Lx, Ly, beta);    update_distribution_file("sD", sD, N, Lx, Ly, beta); -  update_distribution_file("Sc", Sc, Nc, Lx, Ly, beta); -  update_distribution_file("Ss", Ss, N, Lx, Ly, beta); -  update_distribution_file("Sm", Sm, N, Lx, Ly, beta); -  update_distribution_file("Sa", Sa, Na, Lx, Ly, beta); -  update_distribution_file("Sl", Sl, N, Lx, Ly, beta); -  update_distribution_file("Sd", Sd, N, Lx, Ly, beta); -  update_distribution_file("SD", SD, N, Lx, Ly, beta); - -  update_field_file("Ccc", Ccc, Nc, Lx, Ly, beta, Mx, My); -  update_field_file("Css", Css, N, Lx, Ly, beta, Mx, My); -  update_field_file("Cmm", Cmm, N, Lx, Ly, beta, Mx, My); -  update_field_file("Caa", Caa, Na, Lx, Ly, beta, Mx, My); -  update_field_file("Cll", Cll, N, Lx, Ly, beta, Mx, My); -  update_field_file("Cdd", Cdd, N, Lx, Ly, beta, Mx, My); -  update_field_file("CDD", CDD, N, Lx, Ly, beta, Mx, My); -  update_field_file("CsD", CsD, N, Lx, Ly, beta, Mx, My); -    update_field_file("ccc", ccc, Nc, Lx, Ly, beta, Mx, My);    update_field_file("css", css, N, Lx, Ly, beta, Mx, My);    update_field_file("cmm", cmm, N, Lx, Ly, beta, Mx, My); @@ -246,21 +206,6 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {      std::fill_n(fftw_forward_in, Mx * My, 0.0); -    unsigned avalanches_trunc = 0; - -    for (auto e : avalanches.back()) { -      unsigned ind = edge_r_to_ind(net.G.edges[e].r, Lx, Ly, Mx, My); -      if (fftw_forward_in[ind] == 0.0) { -        fftw_forward_in[ind] = 1.0; -        avalanches_trunc++; -      } -    } -    Sa[avalanches_trunc - 1]++; - -    autocorrelation(Mx, My, Caa, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - -    std::fill_n(fftw_forward_in, Mx * My, 0.0); -      for (auto e : avalanches.back()) {        unsigned ind = edge_r_to_ind(net.G.edges[e].r, Lx, Ly, Mx, My);        fftw_forward_in[ind] += 1.0; @@ -286,36 +231,13 @@ void ma::post_fracture(network &n) {    // crack surface correlations    std::fill_n(fftw_forward_in, Mx * My, 0.0); -  unsigned surface_size_trunc = 0; - -  for (auto edge : crack) { -    unsigned ind1 = edge_r_to_ind(n.G.dual_vertices[n.G.dual_edges[edge].v[0]].r, Lx, Ly, Mx, My); -    unsigned ind2 = edge_r_to_ind(n.G.dual_vertices[n.G.dual_edges[edge].v[1]].r, Lx, Ly, Mx, My); -    if (fftw_forward_in[ind1] == 0.0) { -      fftw_forward_in[ind1] = 1.0; -      surface_size_trunc++; -    } -    if (fftw_forward_in[ind2] == 0.0) { -      fftw_forward_in[ind2] = 1.0; -      surface_size_trunc++; -    } -  } -    ss[crack.size()]++; -  fftw_complex *Tss = data_transform(Mx, My, forward_plan, fftw_forward_in, fftw_forward_out); - -  correlation(Mx, My, Css, Tss, Tss, reverse_plan, fftw_reverse_in, fftw_reverse_out); - -  std::fill_n(fftw_forward_in, Mx * My, 0.0); -    for (auto edge : crack) {      fftw_forward_in[edge_r_to_ind(n.G.dual_vertices[n.G.dual_edges[edge].v[0]].r, Lx, Ly, Mx, My)] += 0.5;      fftw_forward_in[edge_r_to_ind(n.G.dual_vertices[n.G.dual_edges[edge].v[1]].r, Lx, Ly, Mx, My)] += 0.5;    } -  Ss[surface_size_trunc]++; -    fftw_complex *tss = data_transform(Mx, My, forward_plan, fftw_forward_in, fftw_forward_out);    correlation(Mx, My, css, tss, tss, reverse_plan, fftw_reverse_in, fftw_reverse_out); @@ -333,26 +255,10 @@ void ma::post_fracture(network &n) {    for (unsigned i = 0; i < num; i++) {      if (i != crack_component && components[i].size() > 0) { -      unsigned cluster_size_trunc = 0; -      for (auto it = components[i].begin(); it != components[i].end(); it++) { -        unsigned ind = edge_r_to_ind(n.G.dual_vertices[*it].r, Lx, Ly, Mx, My); -        if (fftw_forward_in[ind] == 0.0) { -          cluster_size_trunc++; -          fftw_forward_in[ind] = 1.0; -        } -      } - -      Sc[cluster_size_trunc - 1]++;        sc[components[i].size() - 1]++; - -      autocorrelation(Mx, My, Ccc, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out);        Nc++;        for (auto it = components[i].begin(); it != components[i].end(); it++) { -        fftw_forward_in[edge_r_to_ind(n.G.dual_vertices[*it].r, Lx, Ly, Mx, My)] = 0.0; -      } - -      for (auto it = components[i].begin(); it != components[i].end(); it++) {          unsigned ind = edge_r_to_ind(n.G.dual_vertices[*it].r, Lx, Ly, Mx, My);          fftw_forward_in[ind] += 1.0;        } @@ -369,20 +275,7 @@ void ma::post_fracture(network &n) {    // std::fill_n(fftw_forward_in, Mx * My, 0.0); we already reset in the last loop    sm[components[crack_component].size() - 1]++; -  unsigned spanning_cluster_trunc = 0; -  for (auto it = components[crack_component].begin(); it != components[crack_component].end(); it++) { -    unsigned ind = edge_r_to_ind(n.G.dual_vertices[*it].r, Lx, Ly, Mx, My); -    if (fftw_forward_in[ind] == 0.0) { -      fftw_forward_in[ind] = 1.0; -      spanning_cluster_trunc++; -    } -  } - -  autocorrelation(Mx, My, Cmm, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); -  std::fill_n(fftw_forward_in, Mx * My, 0.0); - -  Sm[spanning_cluster_trunc - 1]++;    for (auto it = components[crack_component].begin(); it != components[crack_component].end(); it++) {      fftw_forward_in[edge_r_to_ind(n.G.dual_vertices[*it].r, Lx, Ly, Mx, My)] += 1.0;    } @@ -393,38 +286,16 @@ void ma::post_fracture(network &n) {    std::fill_n(fftw_forward_in, Mx * My, 0.0);    unsigned final_broken = 0; -  unsigned final_trunc = 0;    for (unsigned i = 0; i < n.G.edges.size(); i++) {      if (n.fuses[i]) {         final_broken++; -      unsigned ind = edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My); -      if (fftw_forward_in[ind] == 0.0) { -        final_trunc++; -        fftw_forward_in[ind] = 1.0; -      } +      fftw_forward_in[edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My)] += 1.0;      }    } -  fftw_complex *TDD = data_transform(Mx, My, forward_plan, fftw_forward_in, fftw_forward_out); - -  SD[final_trunc]++;    sD[final_broken]++; -  correlation(Mx, My, CDD, TDD, TDD, reverse_plan, fftw_reverse_in, fftw_reverse_out); -  correlation(Mx, My, CsD, Tss, TDD, reverse_plan, fftw_reverse_in, fftw_reverse_out); - -  free(Tss); -  free(TDD); - -  std::fill_n(fftw_forward_in, Mx * My, 0.0); - -  for (unsigned i = 0; i < n.G.edges.size(); i++) { -    if (n.fuses[i]) {  -      fftw_forward_in[edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My)] += 1.0; -    } -  } -    fftw_complex *tDD = data_transform(Mx, My, forward_plan, fftw_forward_in, fftw_forward_out);    correlation(Mx, My, cDD, tDD, tDD, reverse_plan, fftw_reverse_in, fftw_reverse_out); @@ -437,24 +308,11 @@ void ma::post_fracture(network &n) {    // rewind the last avalanche    sl[avalanches.back().size() - 1]++; -  unsigned last_trunc = 0; -  for (auto e : avalanches.back()) { -    boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G); -    n.break_edge(e, true); -    unsigned ind = edge_r_to_ind(n.G.edges[e].r, Lx, Ly, Mx, My); -    if (fftw_forward_in[ind] == 0.0) { -      fftw_forward_in[ind] = 1.0; -      last_trunc++; -    } -  } -  Sl[last_trunc - 1]++; - -  autocorrelation(Mx, My, Cll, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - -  std::fill_n(fftw_forward_in, Mx * My, 0.0);    // rewind the last avalanche    for (auto e : avalanches.back()) { +    boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G); +    n.break_edge(e, true);      fftw_forward_in[edge_r_to_ind(n.G.edges[e].r, Lx, Ly, Mx, My)] += 1.0;    } @@ -465,24 +323,6 @@ void ma::post_fracture(network &n) {    std::fill_n(fftw_forward_in, Mx * My, 0.0); -  unsigned damage_trunc = 0; - -  for (unsigned i = 0; i < n.G.edges.size(); i++) { -    if (n.fuses[i]) {  -      total_broken++; -      unsigned ind = edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My); -      if (fftw_forward_in[ind] == 0.0) { -        fftw_forward_in[ind] = 1.0; -        damage_trunc++; -      } -    } -  } -  Sd[damage_trunc]++; - -  autocorrelation(Mx, My, Cdd, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out); - -  std::fill_n(fftw_forward_in, Mx * My, 0.0); -    for (unsigned i = 0; i < n.G.edges.size(); i++) {      if (n.fuses[i]) {         fftw_forward_in[edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My)] += 1.0; diff --git a/src/measurements.hpp b/src/measurements.hpp index c735163..e267064 100644 --- a/src/measurements.hpp +++ b/src/measurements.hpp @@ -42,21 +42,6 @@ class ma : public hooks {      std::vector<uint64_t> sl; // final avalanche size distribution      std::vector<uint64_t> sd; // pre-fracture damage distribution      std::vector<uint64_t> sD; // post-fracture damage distribution -    std::vector<uint64_t> Sc; // 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> Sa; // non-final avalanche size distribution -    std::vector<uint64_t> Sl; // final avalanche size distribution -    std::vector<uint64_t> Sd; // pre-fracture damage distribution -    std::vector<uint64_t> SD; // post-fracture damage distribution -    std::vector<std::vector<uint64_t>> Ccc; // cluster-cluster correlations -    std::vector<std::vector<uint64_t>> Css; // surface-surface correlations -    std::vector<std::vector<uint64_t>> Cmm; // surface-surface correlations -    std::vector<std::vector<uint64_t>> Caa; // avalanche-avalanche correlations -    std::vector<std::vector<uint64_t>> Cll; // damage-damage distribution -    std::vector<std::vector<uint64_t>> Cdd; // damage-damage distribution -    std::vector<std::vector<uint64_t>> CDD; // damage-damage distribution -    std::vector<std::vector<uint64_t>> CsD; // damage-damage distribution      std::vector<std::vector<uint64_t>> ccc; // cluster-cluster correlations      std::vector<std::vector<uint64_t>> css; // surface-surface correlations      std::vector<std::vector<uint64_t>> cmm; // surface-surface correlations | 
