summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-09 15:28:44 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-09 15:28:44 -0400
commite1167e6253da1c2d046573a6b5a49804983312c2 (patch)
tree44536a7d52bc0c9de53892a33c578d286bb8cfa1
parentfcc4b311e3e552cdbdec0e99f9d9da7a5e6d11c0 (diff)
downloadfuse_networks-e1167e6253da1c2d046573a6b5a49804983312c2.tar.gz
fuse_networks-e1167e6253da1c2d046573a6b5a49804983312c2.tar.bz2
fuse_networks-e1167e6253da1c2d046573a6b5a49804983312c2.zip
changes to the correlation function measurement---not compatible with previous versions
-rw-r--r--src/measurements.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp
index 9150696..ec40f0c 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -106,9 +106,9 @@ void autocorrelation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vecto
double Δy = Δy_tmp < Ly / 2 ? Δy_tmp : Ly - Δy_tmp;
if (count[0] % 2 == 0) {
- data[(unsigned)(Mx * (Δx / Lx)) + (Mx / 2) * (unsigned)(My * (Δy / Ly))]++;
+ data[(unsigned)((1 + 2 * (Mx / 2)) * (Δx / Lx)) + (Mx / 2 + 1) * (unsigned)((1 + 2 * (My / 2)) * (Δy / Ly))]++;
} else {
- data[(unsigned)(Mx * (Δy / Ly)) + (Mx / 2) * (unsigned)(My * (Δx / Lx))]++;
+ data[(unsigned)((1 + 2 * (Mx / 2)) * (Δy / Ly)) + (Mx / 2 + 1) * (unsigned)((1 + 2 * (My / 2)) * (Δx / Lx))]++;
}
}
}
@@ -159,10 +159,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), sn(2 * n), ss(2 * n), sm(2 * n), sl(2 * n), sb(n + 1), sd(3 * n), sa(3 * n),
- sA(3 * n), si(10000), sI(10000), cc(pow((unsigned)sqrt(n), 2)), cn(pow((unsigned)sqrt(n), 2)),
- cs(pow((unsigned)sqrt(n), 2)), cm(pow((unsigned)sqrt(n), 2)), cl(pow((unsigned)sqrt(n), 2)),
- cb(pow((unsigned)sqrt(n), 2)), ca(pow((unsigned)sqrt(n), 2)), cA(pow((unsigned)sqrt(n), 2)),
- cp(pow((unsigned)sqrt(n), 2)), cq(pow((unsigned)sqrt(n), 2)), last_clusters(2 * n) {
+ sA(3 * n), si(10000), sI(10000), cc(pow(1+(unsigned)sqrt(n), 2)), cn(pow(1+(unsigned)sqrt(n), 2)),
+ cs(pow(1+(unsigned)sqrt(n), 2)), cm(pow(1+(unsigned)sqrt(n), 2)), cl(pow(1+(unsigned)sqrt(n), 2)),
+ cb(pow(1+(unsigned)sqrt(n), 2)), ca(pow(1+(unsigned)sqrt(n), 2)), cA(pow(1+(unsigned)sqrt(n), 2)),
+ cp(pow(1+(unsigned)sqrt(n), 2)), cq(pow(1+(unsigned)sqrt(n), 2)), last_clusters(2 * n) {
if (beta != 0.0) {
model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" +
std::to_string(beta) + "_" + std::to_string(weight) + "_";
@@ -265,8 +265,8 @@ void ma::post_fracture(network& n) {
for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) {
if (crit_components[i].size() > 0) {
sc[crit_components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cc, crit_components[i], crack.first);
}
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cc, crit_components[i], crack.first);
}
std::vector<std::list<graph::coordinate>> components(n.G.dual_vertices.size());
@@ -278,18 +278,21 @@ void ma::post_fracture(network& n) {
unsigned crack_component = n.C.findroot(n.G.dual_edges[avalanches.back().back()].v[0]);
for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) {
- if (components[i].size() > 0) {
- if (i != crack_component) {
+ if (i != crack_component) {
+ if (components[i].size() > 0) {
sm[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cm, components[i], crack.first);
- autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cp, components[i], {0, 1});
- } else {
- ss[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cs, components[i], crack.first);
}
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cm, components[i], crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cp, components[i], {0, 1});
+ } else {
+ ss[components[i].size() - 1]++;
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cs, components[i], crack.first);
+ }
+
+ if (components[i].size() > 0) {
sn[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cn, components[i], crack.first);
}
+ autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cn, components[i], crack.first);
}
std::vector<bool> vertex_in(n.G.vertices.size());