diff options
-rw-r--r-- | src/measurements.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp index ec40f0c..8613c27 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -96,7 +96,7 @@ tx1[i][1] * tx2[i][1]; fftw_reverse_in[i][1] = tx1[i][0] * tx2[i][1] - tx1[i][1] */ void autocorrelation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vector<uint64_t>& data, - const std::list<graph::coordinate>& pos, std::array<unsigned, 2> count) { + const std::list<graph::coordinate>& pos, std::array<unsigned, 2> count, bool debug = false) { for (std::list<graph::coordinate>::const_iterator it1 = pos.begin(); it1 != pos.end(); it1++) { for (std::list<graph::coordinate>::const_iterator it2 = it1; it2 != pos.end(); it2++) { double Δx_tmp = fabs(it1->x - it2->x); @@ -105,6 +105,12 @@ void autocorrelation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vecto double Δy_tmp = fabs(it1->y - it2->y); double Δy = Δy_tmp < Ly / 2 ? Δy_tmp : Ly - Δy_tmp; + if (debug) { + if (Δx > 0 || Δy > 0) { + std::cout << Δx << " " << Δy << "\n"; + } + } + if (count[0] % 2 == 0) { data[(unsigned)((1 + 2 * (Mx / 2)) * (Δx / Lx)) + (Mx / 2 + 1) * (unsigned)((1 + 2 * (My / 2)) * (Δy / Ly))]++; } else { @@ -283,7 +289,7 @@ void ma::post_fracture(network& n) { 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}); + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cp, components[i], {0, 1}, true); } else { ss[components[i].size() - 1]++; autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cs, components[i], crack.first); |