summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-02 10:46:17 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-10-02 10:46:17 -0400
commit47a7c96d1848e3a3edbcfb17e645790d31c01a67 (patch)
treee45bf1cc6c57338cdd064acf0aa8e7a210d306fb /src
parent172d281943371a3aaa04a1a4d564731178e782e7 (diff)
downloadfuse_networks-47a7c96d1848e3a3edbcfb17e645790d31c01a67.tar.gz
fuse_networks-47a7c96d1848e3a3edbcfb17e645790d31c01a67.tar.bz2
fuse_networks-47a7c96d1848e3a3edbcfb17e645790d31c01a67.zip
cleaned up libraries and reduced number of binaries
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt15
-rw-r--r--src/animate_fracture.cpp72
-rw-r--r--src/animate_fracture_square.cpp81
-rw-r--r--src/fracture_elastic.cpp87
-rw-r--r--src/fracture_square.cpp87
-rw-r--r--src/measurements.cpp162
-rw-r--r--src/measurements.hpp2
7 files changed, 127 insertions, 379 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9a7ce20..0e4a10a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -15,22 +15,13 @@ add_library(sample sample.cpp)
target_link_libraries(sample frac)
add_executable(fracture fracture.cpp)
-target_link_libraries(fracture frac measurements fftw3 cholmod profiler GL GLU glut)
-
-add_executable(fracture_square fracture_square.cpp)
-target_link_libraries(fracture_square frac measurements fftw3 cholmod profiler GL GLU glut)
+target_link_libraries(fracture frac measurements cholmod)
add_executable(animate_fracture animate_fracture.cpp)
-target_link_libraries(animate_fracture frac animate fftw3 cholmod profiler GL GLU glut)
-
-add_executable(animate_fracture_square animate_fracture_square.cpp)
-target_link_libraries(animate_fracture_square frac animate fftw3 cholmod profiler GL GLU glut)
+target_link_libraries(animate_fracture frac animate cholmod GL GLU glut)
add_executable(sample_fracture sample_fracture.cpp)
target_link_libraries(sample_fracture frac sample cholmod)
-add_executable(sample_fracture_square sample_fracture_square.cpp)
-target_link_libraries(sample_fracture_square frac sample cholmod)
-
add_executable(percolation percolation.cpp)
-target_link_libraries(percolation frac perc_meas fftw3 cholmod profiler GL GLU glut)
+target_link_libraries(percolation frac perc_meas cholmod)
diff --git a/src/animate_fracture.cpp b/src/animate_fracture.cpp
index 2b5e55c..e8de8c1 100644
--- a/src/animate_fracture.cpp
+++ b/src/animate_fracture.cpp
@@ -15,39 +15,48 @@
#include <cstring>
#include <atomic>
-std::atomic<bool> quit(false); // signal flag
-
-void got_signal(int) {
- quit.store(true);
-}
-
int main(int argc, char* argv[]) {
- struct sigaction sa;
- memset( &sa, 0, sizeof(sa) );
- sa.sa_handler = got_signal;
- sigfillset(&sa.sa_mask);
- sigaction(SIGINT, &sa, NULL);
-
int opt;
unsigned N = 1;
- unsigned n = 16;
- double a = 16.0;
+ unsigned Lx = 16;
+ unsigned Ly = 16;
double beta = 0.5;
- while ((opt = getopt(argc, argv, "n:a:N:b:")) != -1) {
+ unsigned n = 128;
+ double a = 1.0;
+ bool use_aN = false;
+ double w = 0.5;
+
+ unsigned width = 800;
+
+ while ((opt = getopt(argc, argv, "N:X:Y:b:n:a:w:W:")) != -1) {
switch (opt) {
case 'N':
N = (unsigned)atof(optarg);
break;
+ case 'X':
+ Lx = atoi(optarg);
+ break;
+ case 'Y':
+ Ly = atoi(optarg);
+ break;
+ case 'b':
+ beta = atof(optarg);
+ break;
case 'n':
- n = atoi(optarg);
+ n = (unsigned)atof(optarg);
+ use_aN = true;
break;
case 'a':
a = atof(optarg);
+ use_aN = true;
break;
- case 'b':
- beta = atof(optarg);
+ case 'w':
+ w = atof(optarg);
+ break;
+ case 'W':
+ width = atoi(optarg);
break;
default:
exit(1);
@@ -57,19 +66,28 @@ int main(int argc, char* argv[]) {
cholmod_common c;
CHOL_F(start)(&c);
- animate meas(sqrt(2*n *a), sqrt( 2*n / a), 1000, argc, argv);
-
randutils::auto_seed_128 seeds;
std::mt19937 rng{seeds};
- for (unsigned trial = 0; trial < N; trial++) {
- graph G(n, a, rng);
- elastic_network elastic_network(G, &c);
- elastic_network.set_thresholds(beta, rng);
- elastic_network.fracture(meas);
+ if (use_aN) {
+ animate meas(sqrt(2*n *a), sqrt( 2*n / a), width, argc, argv);
- if (quit.load())
- break;
+ for (unsigned trial = 0; trial < N; trial++) {
+ graph G(n, a, rng);
+ elastic_network net(G, &c, w);
+ net.set_thresholds(beta, rng);
+ net.fracture(meas);
+ }
+ } else {
+ animate meas(Lx, Ly, width, argc, argv);
+ const graph G(Lx, Ly);
+ const elastic_network plain_net(G, &c, w);
+
+ for (unsigned trial = 0; trial < N; trial++) {
+ elastic_network net = plain_net;
+ net.set_thresholds(beta, rng);
+ net.fracture(meas);
+ }
}
CHOL_F(finish)(&c);
diff --git a/src/animate_fracture_square.cpp b/src/animate_fracture_square.cpp
deleted file mode 100644
index ad43254..0000000
--- a/src/animate_fracture_square.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-
-#include <random>
-#include <iostream>
-
-#include <cholmod.h>
-
-#include "randutils/randutils.hpp"
-
-#include <graph.hpp>
-#include <network.hpp>
-#include <hooks.hpp>
-#include "animate.hpp"
-
-#include <csignal>
-#include <cstring>
-#include <atomic>
-
-std::atomic<bool> quit(false); // signal flag
-
-void got_signal(int) {
- quit.store(true);
-}
-
-int main(int argc, char* argv[]) {
- struct sigaction sa;
- memset( &sa, 0, sizeof(sa) );
- sa.sa_handler = got_signal;
- sigfillset(&sa.sa_mask);
- sigaction(SIGINT, &sa, NULL);
-
- int opt;
-
- unsigned N = 1;
- unsigned Lx = 16;
- unsigned Ly = 16;
- double beta = 0.5;
-
- while ((opt = getopt(argc, argv, "X:Y:N:b:")) != -1) {
- switch (opt) {
- case 'N':
- N = (unsigned)atof(optarg);
- break;
- case 'X':
- Lx = atoi(optarg);
- break;
- case 'Y':
- Ly = atoi(optarg);
- break;
- case 'b':
- beta = atof(optarg);
- break;
- default:
- exit(1);
- }
- }
-
- cholmod_common c;
- CHOL_F(start)(&c);
-
- animate meas(Lx, Ly, 1000, argc, argv);
-
- randutils::auto_seed_128 seeds;
- std::mt19937 rng{seeds};
-
- graph G(Lx, Ly);
- elastic_network perm_network(G, &c);
-
- for (unsigned trial = 0; trial < N; trial++) {
- elastic_network tmp_network(perm_network);
- tmp_network.set_thresholds(beta, rng);
- tmp_network.fracture(meas);
-
- if (quit.load())
- break;
- }
-
- CHOL_F(finish)(&c);
-
- return 0;
-}
-
diff --git a/src/fracture_elastic.cpp b/src/fracture_elastic.cpp
deleted file mode 100644
index dec4a2c..0000000
--- a/src/fracture_elastic.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-#include <random>
-#include <iostream>
-
-#include <cholmod.h>
-
-#include "randutils/randutils.hpp"
-
-#include <graph.hpp>
-#include <network.hpp>
-#include <hooks.hpp>
-#include "measurements.hpp"
-
-#include <csignal>
-#include <cstring>
-#include <atomic>
-
-std::atomic<bool> quit(false); // signal flag
-
-void got_signal(int) {
- quit.store(true);
-}
-
-int main(int argc, char* argv[]) {
- struct sigaction sa;
- memset( &sa, 0, sizeof(sa) );
- sa.sa_handler = got_signal;
- sigfillset(&sa.sa_mask);
- sigaction(SIGINT, &sa, NULL);
-
- int opt;
-
- unsigned N = 1;
- unsigned Lx = 16;
- unsigned Ly = 16;
- double beta = 0.5;
-
- while ((opt = getopt(argc, argv, "N:X:Y:b:")) != -1) {
- switch (opt) {
- case 'N':
- N = (unsigned)atof(optarg);
- break;
- case 'X':
- Lx = atoi(optarg);
- break;
- case 'Y':
- Ly = atoi(optarg);
- break;
- case 'b':
- beta = atof(optarg);
- break;
- default:
- exit(1);
- }
- }
-
- cholmod_common c;
- CHOL_F(start)(&c);
-
- ma meas(Lx, Ly, 2*Lx, 2*Ly, beta);
- graph G(Lx, Ly);
- network perm_network(G, &c);
-
- randutils::auto_seed_128 seeds;
- std::mt19937 rng{seeds};
-
- for (unsigned trial = 0; trial < N; trial++) {
- while (true) {
- try {
- network tmp_network(perm_network);
- tmp_network.set_thresholds(beta, rng);
- tmp_network.fracture(meas);
- break;
- } catch (std::exception &e) {
- std::cout << e.what() << '\n';
- }
- }
-
- if (quit.load())
- break;
- }
-
- CHOL_F(finish)(&c);
-
- return 0;
-}
-
diff --git a/src/fracture_square.cpp b/src/fracture_square.cpp
deleted file mode 100644
index f73ed85..0000000
--- a/src/fracture_square.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-
-#include <random>
-#include <iostream>
-
-#include <cholmod.h>
-
-#include "randutils/randutils.hpp"
-
-#include <graph.hpp>
-#include <network.hpp>
-#include <hooks.hpp>
-#include "measurements.hpp"
-
-#include <csignal>
-#include <cstring>
-#include <atomic>
-
-std::atomic<bool> quit(false); // signal flag
-
-void got_signal(int) {
- quit.store(true);
-}
-
-int main(int argc, char* argv[]) {
- struct sigaction sa;
- memset( &sa, 0, sizeof(sa) );
- sa.sa_handler = got_signal;
- sigfillset(&sa.sa_mask);
- sigaction(SIGINT, &sa, NULL);
-
- int opt;
-
- unsigned N = 1;
- unsigned Lx = 16;
- unsigned Ly = 16;
- double beta = 0.5;
-
- while ((opt = getopt(argc, argv, "N:X:Y:b:")) != -1) {
- switch (opt) {
- case 'N':
- N = (unsigned)atof(optarg);
- break;
- case 'X':
- Lx = atoi(optarg);
- break;
- case 'Y':
- Ly = atoi(optarg);
- break;
- case 'b':
- beta = atof(optarg);
- break;
- default:
- exit(1);
- }
- }
-
- cholmod_common c;
- CHOL_F(start)(&c);
-
- ma meas(Lx, Ly, beta, 0.5);
- graph G(Lx, Ly);
- elastic_network perm_network(G, &c);
-
- randutils::auto_seed_128 seeds;
- std::mt19937 rng{seeds};
-
- for (unsigned trial = 0; trial < N; trial++) {
- while (true) {
- try {
- elastic_network tmp_network(perm_network);
- tmp_network.set_thresholds(beta, rng);
- tmp_network.fracture(meas);
- break;
- } catch (std::exception &e) {
- std::cout << e.what() << '\n';
- }
- }
-
- if (quit.load())
- break;
- }
-
- CHOL_F(finish)(&c);
-
- return 0;
-}
-
diff --git a/src/measurements.cpp b/src/measurements.cpp
index fd9c8a0..1a937be 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -1,18 +1,16 @@
#include "measurements.hpp"
-#include <iostream>
#include <cstdio>
+#include <iostream>
-class badcycleException: public std::exception
-{
- virtual const char* what() const throw()
- {
+class badcycleException : public std::exception {
+ virtual const char* what() const throw() {
return "Could not find a valid cycle on the broken system.";
}
} badcycleex;
-
-void update_distribution_file(std::string id, const std::vector<uint64_t>& data, std::string model_string) {
+void update_distribution_file(std::string id, const std::vector<uint64_t>& data,
+ std::string model_string) {
std::string filename = model_string + id + ".dat";
std::ifstream file(filename);
@@ -31,7 +29,7 @@ void update_distribution_file(std::string id, const std::vector<uint64_t>& data,
std::ofstream file_out(filename);
for (unsigned i = 0; i < data.size(); i++) {
- file_out <<std::fixed<< data_old[i] + data[i] << " ";
+ file_out << std::fixed << data_old[i] + data[i] << " ";
}
file_out.close();
@@ -59,11 +57,13 @@ void update_field_file(std::string id, const std::vector<T>& data, std::string m
file_out.close();
}
-
-fftw_complex* data_transform(unsigned Mx, unsigned My, fftw_plan forward_plan, double *fftw_forward_in, fftw_complex *fftw_forward_out) {
+/*
+fftw_complex* data_transform(unsigned Mx, unsigned My, fftw_plan forward_plan,
+double *fftw_forward_in, fftw_complex *fftw_forward_out) {
fftw_execute(forward_plan);
- fftw_complex* output = (fftw_complex*)malloc(Mx * (My / 2 + 1) * sizeof(fftw_complex));
+ fftw_complex* output = (fftw_complex*)malloc(Mx * (My / 2 + 1) *
+sizeof(fftw_complex));
for (unsigned i = 0; i < Mx * (My / 2 + 1); i++) {
output[i][0] = fftw_forward_out[i][0];
@@ -72,24 +72,31 @@ fftw_complex* data_transform(unsigned Mx, unsigned My, fftw_plan forward_plan, d
return output;
}
+*/
+/*
template <class T>
-void correlation(unsigned Mx, unsigned My, std::vector<std::vector<T>>& data, const fftw_complex* tx1, const fftw_complex* tx2, fftw_plan reverse_plan, fftw_complex *fftw_reverse_in, double *fftw_reverse_out) {
- for (unsigned i = 0; i < Mx * (My / 2 + 1); i++) {
- fftw_reverse_in[i][0] = tx1[i][0] * tx2[i][0] + tx1[i][1] * tx2[i][1];
- fftw_reverse_in[i][1] = tx1[i][0] * tx2[i][1] - tx1[i][1] * tx2[i][0];
+void correlation(unsigned Mx, unsigned My, std::vector<std::vector<T>>& data,
+const fftw_complex* tx1, const fftw_complex* tx2, fftw_plan reverse_plan,
+fftw_complex *fftw_reverse_in, double *fftw_reverse_out) { for (unsigned i = 0;
+i < Mx * (My / 2 + 1); i++) { fftw_reverse_in[i][0] = tx1[i][0] * tx2[i][0] +
+tx1[i][1] * tx2[i][1]; fftw_reverse_in[i][1] = tx1[i][0] * tx2[i][1] - tx1[i][1]
+* tx2[i][0];
}
fftw_execute(reverse_plan);
for (unsigned j = 0; j < data.size(); j++) {
for (unsigned i = 0; i < (Mx / 2 + 1) * (My / 2 + 1); i++) {
- data[j][i] += (T)pow(fftw_reverse_out[Mx * (i / (Mx / 2 + 1)) + i % (Mx / 2 + 1)] / (Mx * My), j + 1);
+ data[j][i] += (T)pow(fftw_reverse_out[Mx * (i / (Mx / 2 + 1)) + i % (Mx /
+2 + 1)] / (Mx * My), j + 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) {
+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) {
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);
@@ -107,9 +114,12 @@ void autocorrelation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vecto
}
}
-void correlation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vector<uint64_t>& data, const std::list<graph::coordinate>& pos1, const std::list<graph::coordinate>& pos2) {
+void correlation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vector<uint64_t>& data,
+ const std::list<graph::coordinate>& pos1,
+ const std::list<graph::coordinate>& pos2) {
for (std::list<graph::coordinate>::const_iterator it1 = pos1.begin(); it1 != pos1.end(); it1++) {
- for (std::list<graph::coordinate>::const_iterator it2 = pos2.begin(); it2 != pos2.end(); it2++) {
+ for (std::list<graph::coordinate>::const_iterator it2 = pos2.begin(); it2 != pos2.end();
+ it2++) {
double Δx_tmp = fabs(it1->x - it2->x);
double Δx = Δx_tmp < Lx / 2 ? Δx_tmp : Lx - Δx_tmp;
@@ -120,82 +130,58 @@ void correlation2(double Lx, double Ly, unsigned Mx, unsigned My, std::vector<ui
}
}
}
-
+/*
template <class T>
-void autocorrelation(unsigned Mx, unsigned My, std::vector<std::vector<T>>& out_data, fftw_plan forward_plan, double *fftw_forward_in, fftw_complex *fftw_forward_out, fftw_plan reverse_plan, fftw_complex *fftw_reverse_in, double *fftw_reverse_out) {
- fftw_execute(forward_plan);
+void autocorrelation(unsigned Mx, unsigned My, std::vector<std::vector<T>>&
+out_data, fftw_plan forward_plan, double *fftw_forward_in, fftw_complex
+*fftw_forward_out, fftw_plan reverse_plan, fftw_complex *fftw_reverse_in, double
+*fftw_reverse_out) { fftw_execute(forward_plan);
for (unsigned i = 0; i < My * (Mx / 2 + 1); i++) {
- fftw_reverse_in[i][0] = pow(fftw_forward_out[i][0], 2) + pow(fftw_forward_out[i][1], 2);
- fftw_reverse_in[i][1] = 0.0;
+ fftw_reverse_in[i][0] = pow(fftw_forward_out[i][0], 2) +
+pow(fftw_forward_out[i][1], 2); fftw_reverse_in[i][1] = 0.0;
}
fftw_execute(reverse_plan);
for (unsigned j = 0; j < out_data.size(); j++) {
for (unsigned i = 0; i < (Mx / 2 + 1) * (My / 2 + 1); i++) {
- out_data[j][i] += (T)pow(fftw_reverse_out[Mx * (i / (Mx / 2 + 1)) + i % (Mx / 2 + 1)] / (Mx * My), j + 1);
+ out_data[j][i] += (T)pow(fftw_reverse_out[Mx * (i / (Mx / 2 + 1)) + i %
+(Mx / 2 + 1)] / (Mx * My), j + 1);
}
}
}
+*/
unsigned edge_r_to_ind(graph::coordinate r, double Lx, double Ly, unsigned Mx, unsigned My) {
return floor((Mx * r.x) / Lx) + Mx * floor((My * r.y) / Ly);
}
-ma::ma(unsigned n, double a, double beta, double weight) :
- 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),
- 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))
-{
+ma::ma(unsigned n, double a, double beta, double weight)
+ : 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), 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)) {
if (beta != 0.0) {
- model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" + std::to_string(beta) + "_" + std::to_string(weight) + "_";
+ model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_" +
+ std::to_string(beta) + "_" + std::to_string(weight) + "_";
} else {
- model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_INF_" + std::to_string(weight) + "_";
+ model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_INF_" +
+ std::to_string(weight) + "_";
}
}
-ma::ma(unsigned Lx, unsigned Ly, double beta, double weight) :
- sn(Lx * Ly / 2),
- ss(Lx * Ly / 2),
- sm(Lx * Ly / 2),
- sl(Lx * Ly / 2),
- sb(Lx * Ly / 2 + 1),
- sd(Lx * Ly),
- sa(Lx * Ly),
- sA(Lx * Ly),
- si(10000),
- sI(10000),
- cn(Lx * Ly),
- cs(Lx * Ly),
- cm(Lx * Ly),
- cl(Lx * Ly),
- cb(Lx * Ly),
- ca(Lx * Ly),
- cA(Lx * Ly),
- cp(Lx * Ly),
- cq(Lx * Ly)
-{
+ma::ma(unsigned Lx, unsigned Ly, double beta, double weight)
+ : sn(Lx * Ly / 2), ss(Lx * Ly / 2), sm(Lx * Ly / 2), sl(Lx * Ly / 2), sb(Lx * Ly / 2 + 1),
+ sd(Lx * Ly), sa(Lx * Ly), sA(Lx * Ly), si(10000), sI(10000), cn(Lx * Ly), cs(Lx * Ly),
+ cm(Lx * Ly), cl(Lx * Ly), cb(Lx * Ly), ca(Lx * Ly), cA(Lx * Ly), cp(Lx * Ly), cq(Lx * Ly) {
if (beta != 0.0) {
- model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_" + std::to_string(weight) + "_";
+ model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" +
+ std::to_string(beta) + "_" + std::to_string(weight) + "_";
} else {
- model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_INF_" + std::to_string(weight) + "_";
+ model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_INF_" +
+ std::to_string(weight) + "_";
}
}
@@ -237,9 +223,11 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
}
for (unsigned j = 0; j < cur.currents.size(); j++) {
- if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 && (!net.backbone[j] || j == i)) {
+ if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 &&
+ (!net.backbone[j] || j == i)) {
si[(unsigned)(10000 * (logl(cur.currents[j]) + 100) / 100)]++;
- } else if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 && net.backbone[j] && j != i) {
+ } else if (logl(cur.currents[j]) >= -100 && logl(cur.currents[j]) < 0 && net.backbone[j] &&
+ j != i) {
sI[(unsigned)(10000 * (logl(cur.currents[j]) + 100) / 100)]++;
}
}
@@ -247,7 +235,7 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
num++;
}
-void ma::post_fracture(network &n) {
+void ma::post_fracture(network& n) {
auto crack = find_minimal_crack(n, avalanches.back().back());
std::list<graph::coordinate> cl_cs;
@@ -255,7 +243,8 @@ void ma::post_fracture(network &n) {
for (unsigned e : crack.second) {
cl_cs.push_back(n.G.dual_edges[e].r);
}
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cl.size()), 2 * sqrt(cl.size()), cl, cl_cs, crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cl.size()), 2 * sqrt(cl.size()), cl, cl_cs,
+ crack.first);
std::vector<std::list<graph::coordinate>> components(n.G.dual_vertices.size());
@@ -269,14 +258,18 @@ void ma::post_fracture(network &n) {
if (components[i].size() > 0) {
if (i != crack_component) {
sm[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cm.size()), 2 * sqrt(cm.size()), cm, components[i], crack.first);
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cp.size()), 2 * sqrt(cp.size()), cp, components[i], {0, 1});
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cm.size()), 2 * sqrt(cm.size()), cm,
+ components[i], crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cp.size()), 2 * sqrt(cp.size()), cp,
+ components[i], {0, 1});
} else {
ss[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cs.size()), 2 * sqrt(cs.size()), cs, components[i], crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cs.size()), 2 * sqrt(cs.size()), cs,
+ components[i], crack.first);
}
sn[components[i].size() - 1]++;
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cn.size()), 2 * sqrt(cn.size()), cn, components[i], crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cn.size()), 2 * sqrt(cn.size()), cn,
+ components[i], crack.first);
}
}
@@ -301,7 +294,8 @@ void ma::post_fracture(network &n) {
}
sb[bb_size]++;
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cb.size()), 2 * sqrt(cb.size()), cb, cb_co, crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cb.size()), 2 * sqrt(cb.size()), cb, cb_co,
+ crack.first);
auto av_it = avalanches.rbegin();
av_it++;
@@ -312,8 +306,9 @@ void ma::post_fracture(network &n) {
for (unsigned e : (*av_it)) {
ca_co.push_back(n.G.edges[e].r);
}
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(ca.size()), 2 * sqrt(ca.size()), ca, ca_co, crack.first);
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cq.size()), 2 * sqrt(cq.size()), cq, ca_co, {0,1});
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(ca.size()), 2 * sqrt(ca.size()), ca, ca_co,
+ crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cq.size()), 2 * sqrt(cq.size()), cq, ca_co, {0, 1});
av_it++;
}
@@ -322,7 +317,8 @@ void ma::post_fracture(network &n) {
for (unsigned e : avalanches.back()) {
cA_co.push_back(n.G.edges[e].r);
}
- autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cA.size()), 2 * sqrt(cA.size()), cA, cA_co, crack.first);
+ autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cA.size()), 2 * sqrt(cA.size()), cA, cA_co,
+ crack.first);
sd[num - 1]++;
}
diff --git a/src/measurements.hpp b/src/measurements.hpp
index 64cfce6..4fbd9fc 100644
--- a/src/measurements.hpp
+++ b/src/measurements.hpp
@@ -8,8 +8,6 @@
#include <iostream>
#include <array>
-#include <fftw3.h>
-
#include <hooks.hpp>
#include "analysis_tools.hpp"