summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analysis_tools.cpp24
-rw-r--r--src/analysis_tools.hpp4
-rw-r--r--src/animate.cpp26
-rw-r--r--src/animate.hpp6
-rw-r--r--src/animate_fracture.cpp6
-rw-r--r--src/animate_fracture_square.cpp6
-rw-r--r--src/fracture.cpp6
-rw-r--r--src/fracture_square.cpp6
-rw-r--r--src/measurements.cpp70
-rw-r--r--src/measurements.hpp12
10 files changed, 83 insertions, 83 deletions
diff --git a/src/analysis_tools.cpp b/src/analysis_tools.cpp
index 34e4ea0..778e713 100644
--- a/src/analysis_tools.cpp
+++ b/src/analysis_tools.cpp
@@ -10,16 +10,16 @@ bool trivial(boost::detail::edge_desc_impl<boost::undirected_tag,unsigned long>)
return true;
}
-std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) {
+std::list<unsigned> find_minimal_crack(const Graph& G, const network& n) {
Graph Gtmp(n.G.vertices.size());
- std::list<unsigned int> removed_edges;
+ std::list<unsigned> removed_edges;
class add_tree_edges : public boost::default_dfs_visitor {
public:
Graph& G;
- std::list<unsigned int>& E;
+ std::list<unsigned>& E;
- add_tree_edges(Graph& G, std::list<unsigned int>& E) : G(G), E(E) {}
+ add_tree_edges(Graph& G, std::list<unsigned>& E) : G(G), E(E) {}
void tree_edge(boost::graph_traits<Graph>::edge_descriptor e, const Graph& g) {
boost::add_edge(boost::source(e, g), boost::target(e, g), g[e], G);
@@ -37,11 +37,11 @@ std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) {
class find_cycle : public boost::default_dfs_visitor {
public:
- std::list<unsigned int>& E;
- unsigned int end;
+ std::list<unsigned>& E;
+ unsigned end;
struct done{};
- find_cycle(std::list<unsigned int>& E, unsigned int end) : E(E), end(end) {}
+ find_cycle(std::list<unsigned>& E, unsigned end) : E(E), end(end) {}
void discover_vertex(boost::graph_traits<Graph>::vertex_descriptor v, const Graph& g) {
if (v == end) {
@@ -58,10 +58,10 @@ std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) {
}
};
- std::list<std::list<unsigned int>> cycles;
+ std::list<std::list<unsigned>> cycles;
for (auto edge : removed_edges) {
- std::list<unsigned int> cycle = {edge};
+ std::list<unsigned> cycle = {edge};
find_cycle vis(cycle, n.G.dual_edges[edge].v[1]);
std::vector<boost::default_color_type> new_color_map(boost::num_vertices(Gtmp));
try {
@@ -85,8 +85,8 @@ std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) {
for (auto it1 = bool_cycles.begin(); it1 != std::prev(bool_cycles.end()); it1++) {
for (auto it2 = std::next(it1); it2 != bool_cycles.end(); it2++) {
std::valarray<uint8_t> new_bool_cycle = (*it1) ^ (*it2);
- std::list<unsigned int> new_cycle;
- unsigned int pos = 0;
+ std::list<unsigned> new_cycle;
+ unsigned pos = 0;
for (uint8_t included : new_bool_cycle) {
if (included) {
new_cycle.push_back(pos);
@@ -99,7 +99,7 @@ std::list<unsigned int> find_minimal_crack(const Graph& G, const network& n) {
// find the cycle representing the crack by counting boundary crossings
for (auto cycle : cycles) {
- std::array<unsigned int, 2> crossing_count{0,0};
+ std::array<unsigned, 2> crossing_count{0,0};
for (auto edge : cycle) {
if (n.G.dual_edges[edge].crossings[0]) {
diff --git a/src/analysis_tools.hpp b/src/analysis_tools.hpp
index 34ed967..4f3f285 100644
--- a/src/analysis_tools.hpp
+++ b/src/analysis_tools.hpp
@@ -14,7 +14,7 @@
#include <network.hpp>
struct EdgeProperties {
- unsigned int index;
+ unsigned index;
};
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS, boost::no_property, EdgeProperties> Graph;
@@ -25,5 +25,5 @@ bool is_shorter(const std::list<T> &, const std::list<T> &);
bool trivial(boost::detail::edge_desc_impl<boost::undirected_tag,unsigned long>);
-std::list<unsigned int> find_minimal_crack(const Graph &, const network &);
+std::list<unsigned> find_minimal_crack(const Graph &, const network &);
diff --git a/src/animate.cpp b/src/animate.cpp
index 4f10e0a..5bae15e 100644
--- a/src/animate.cpp
+++ b/src/animate.cpp
@@ -1,10 +1,10 @@
#include "animate.hpp"
-animate::animate(double Lx, double Ly, unsigned int window_size, int argc, char *argv[]) : G(2 * (unsigned int)ceil(Lx * Ly / 2)) {
+animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *argv[]) : G(2 * (unsigned)ceil(Lx * Ly / 2)) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize((unsigned int)(Lx / Ly * window_size), window_size);
+ glutInitWindowSize((unsigned)(Lx / Ly * window_size), window_size);
glutCreateWindow("wolff");
glClearColor(0.0,0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
@@ -21,7 +21,7 @@ void animate::pre_fracture(const network &n) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3f(0.0f, 0.0f, 0.0f);
- for (unsigned int i = 0; i < n.G.edges.size(); i++) {
+ for (unsigned i = 0; i < n.G.edges.size(); i++) {
graph::coordinate r1 = n.G.vertices[n.G.edges[i].v[0]].r;
graph::coordinate r2 = n.G.vertices[n.G.edges[i].v[1]].r;
@@ -47,7 +47,7 @@ void animate::pre_fracture(const network &n) {
glFlush();
}
-void animate::bond_broken(const network& n, const current_info& cur, unsigned int i) {
+void animate::bond_broken(const network& n, const current_info& cur, unsigned i) {
long double c = logl(cur.conductivity / fabs(cur.currents[i])) + n.thresholds[i];
if (c > lv && avalanches.back().size() > 0) {
lv = c;
@@ -85,15 +85,15 @@ void animate::bond_broken(const network& n, const current_info& cur, unsigned in
}
void animate::post_fracture(network &n) {
- std::vector<unsigned int> component(boost::num_vertices(G));
- unsigned int num = boost::connected_components(G, &component[0]);
+ std::vector<unsigned> component(boost::num_vertices(G));
+ unsigned num = boost::connected_components(G, &component[0]);
- std::list<unsigned int> crack = find_minimal_crack(G, n);
- unsigned int crack_component = component[n.G.dual_edges[crack.front()].v[0]];
+ std::list<unsigned> crack = find_minimal_crack(G, n);
+ unsigned crack_component = component[n.G.dual_edges[crack.front()].v[0]];
- std::vector<std::list<unsigned int>> components(num);
+ std::vector<std::list<unsigned>> components(num);
- for (unsigned int i = 0; i < n.G.dual_vertices.size(); i++) {
+ for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) {
components[component[i]].push_back(i);
}
@@ -106,7 +106,7 @@ void animate::post_fracture(network &n) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glColor3f(0.0f, 0.0f, 0.0f);
- for (unsigned int i = 0; i < n.G.edges.size(); i++) {
+ for (unsigned i = 0; i < n.G.edges.size(); i++) {
if (!n.fuses[i]) {
graph::coordinate r1 = n.G.vertices[n.G.edges[i].v[0]].r;
graph::coordinate r2 = n.G.vertices[n.G.edges[i].v[1]].r;
@@ -151,7 +151,7 @@ void animate::post_fracture(network &n) {
break;
case 'c' :
- for (unsigned int i = 0; i < num; i++) {
+ for (unsigned i = 0; i < num; i++) {
if (i == crack_component) {
glColor3d(1.0, 0.0, 0.0);
} else {
@@ -170,7 +170,7 @@ void animate::post_fracture(network &n) {
break;
case 'C' :
- for (unsigned int i = 0; i < num; i++) {
+ for (unsigned i = 0; i < num; i++) {
if (components[i].size() > 1) {
if (i == crack_component) {
glColor3d(1.0, 0.0, 0.0);
diff --git a/src/animate.hpp b/src/animate.hpp
index 423eba7..fcb89fc 100644
--- a/src/animate.hpp
+++ b/src/animate.hpp
@@ -12,11 +12,11 @@ class animate : public hooks {
Graph G;
public:
long double lv;
- std::list<std::list<unsigned int>> avalanches;
+ std::list<std::list<unsigned>> avalanches;
- animate(double Lx, double Ly, unsigned int window_size, int argc, char *argv[]);
+ animate(double Lx, double Ly, unsigned window_size, int argc, char *argv[]);
void pre_fracture(const network &) override;
- void bond_broken(const network& net, const current_info& cur, unsigned int i) override;
+ void bond_broken(const network& net, const current_info& cur, unsigned i) override;
void post_fracture(network &n) override;
};
diff --git a/src/animate_fracture.cpp b/src/animate_fracture.cpp
index 9ae79cc..2d64072 100644
--- a/src/animate_fracture.cpp
+++ b/src/animate_fracture.cpp
@@ -30,7 +30,7 @@ int main(int argc, char* argv[]) {
int opt;
- unsigned int N = 1;
+ unsigned N = 1;
double Lx = 16.0;
double Ly = 16.0;
double beta = 0.5;
@@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
while ((opt = getopt(argc, argv, "X:Y:N:b:")) != -1) {
switch (opt) {
case 'N':
- N = (unsigned int)atof(optarg);
+ N = (unsigned)atof(optarg);
break;
case 'X':
Lx = atof(optarg);
@@ -62,7 +62,7 @@ int main(int argc, char* argv[]) {
randutils::auto_seed_128 seeds;
std::mt19937 rng{seeds};
- for (unsigned int trial = 0; trial < N; trial++) {
+ for (unsigned trial = 0; trial < N; trial++) {
graph G(Lx, Ly, rng);
network network(G, &c);
network.set_thresholds(beta, rng);
diff --git a/src/animate_fracture_square.cpp b/src/animate_fracture_square.cpp
index 512486f..d2efde9 100644
--- a/src/animate_fracture_square.cpp
+++ b/src/animate_fracture_square.cpp
@@ -30,7 +30,7 @@ int main(int argc, char* argv[]) {
int opt;
- unsigned int N = 1;
+ unsigned N = 1;
unsigned Lx = 16;
unsigned Ly = 16;
double beta = 0.5;
@@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
while ((opt = getopt(argc, argv, "X:Y:N:b:")) != -1) {
switch (opt) {
case 'N':
- N = (unsigned int)atof(optarg);
+ N = (unsigned)atof(optarg);
break;
case 'X':
Lx = atoi(optarg);
@@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
graph G(Lx, Ly);
network perm_network(G, &c);
- for (unsigned int trial = 0; trial < N; trial++) {
+ for (unsigned trial = 0; trial < N; trial++) {
network tmp_network(perm_network);
tmp_network.set_thresholds(beta, rng);
tmp_network.fracture(meas);
diff --git a/src/fracture.cpp b/src/fracture.cpp
index e260e14..6712ac3 100644
--- a/src/fracture.cpp
+++ b/src/fracture.cpp
@@ -30,7 +30,7 @@ int main(int argc, char* argv[]) {
int opt;
- unsigned int N = 1;
+ unsigned N = 1;
double Lx = 16;
double Ly = 16;
double beta = 0.5;
@@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
while ((opt = getopt(argc, argv, "N:X:Y:b:")) != -1) {
switch (opt) {
case 'N':
- N = (unsigned int)atof(optarg);
+ N = (unsigned)atof(optarg);
break;
case 'X':
Lx = atof(optarg);
@@ -62,7 +62,7 @@ int main(int argc, char* argv[]) {
randutils::auto_seed_128 seeds;
std::mt19937 rng{seeds};
- for (unsigned int trial = 0; trial < N; trial++) {
+ for (unsigned trial = 0; trial < N; trial++) {
while (true) {
try {
graph G(Lx, Ly, rng);
diff --git a/src/fracture_square.cpp b/src/fracture_square.cpp
index 03b0113..47d7d67 100644
--- a/src/fracture_square.cpp
+++ b/src/fracture_square.cpp
@@ -30,7 +30,7 @@ int main(int argc, char* argv[]) {
int opt;
- unsigned int N = 1;
+ unsigned N = 1;
unsigned Lx = 16;
unsigned Ly = 16;
double beta = 0.5;
@@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
while ((opt = getopt(argc, argv, "N:X:Y:b:")) != -1) {
switch (opt) {
case 'N':
- N = (unsigned int)atof(optarg);
+ N = (unsigned)atof(optarg);
break;
case 'X':
Lx = atoi(optarg);
@@ -64,7 +64,7 @@ int main(int argc, char* argv[]) {
randutils::auto_seed_128 seeds;
std::mt19937 rng{seeds};
- for (unsigned int trial = 0; trial < N; trial++) {
+ for (unsigned trial = 0; trial < N; trial++) {
while (true) {
try {
network tmp_network(perm_network);
diff --git a/src/measurements.cpp b/src/measurements.cpp
index ffff06d..17fbdee 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -2,7 +2,7 @@
#include "measurements.hpp"
#include <iostream>
-void update_distribution_file(std::string id, const std::vector<uint64_t>& data, unsigned int N, double Lx, double Ly, double beta) {
+void update_distribution_file(std::string id, const std::vector<uint64_t>& data, unsigned N, double Lx, double Ly, double beta) {
std::string filename = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_" + id + ".dat";
std::ifstream file(filename);
@@ -11,7 +11,7 @@ void update_distribution_file(std::string id, const std::vector<uint64_t>& data,
if (file.is_open()) {
file >> N_old;
- for (unsigned int i = 0; i < data.size(); i++) {
+ for (unsigned i = 0; i < data.size(); i++) {
uint64_t num;
file >> num;
data_old[i] = num;
@@ -23,7 +23,7 @@ void update_distribution_file(std::string id, const std::vector<uint64_t>& data,
std::ofstream file_out(filename);
file_out <<std::fixed<< N_old + N << "\n";
- for (unsigned int i = 0; i < data.size(); i++) {
+ for (unsigned i = 0; i < data.size(); i++) {
file_out <<std::fixed<< data_old[i] + data[i] << " ";
}
@@ -31,7 +31,7 @@ void update_distribution_file(std::string id, const std::vector<uint64_t>& data,
}
template <class T>
-void update_field_file(std::string id, const std::vector<T>& data, unsigned int N, double Lx, double Ly, double beta, unsigned int Mx, unsigned int My) {
+void update_field_file(std::string id, const std::vector<T>& data, unsigned N, double Lx, double Ly, double beta, unsigned Mx, unsigned My) {
std::string filename = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_" + id + "_" + std::to_string(Mx) + "_" + std::to_string(My) + ".dat";
std::ifstream file(filename);
@@ -44,7 +44,7 @@ void update_field_file(std::string id, const std::vector<T>& data, unsigned int
if (file.is_open()) {
file >> N_old;
for (unsigned j = 0; j < data.size(); j++) {
- for (unsigned int i = 0; i < data[j].size(); i++) {
+ for (unsigned i = 0; i < data[j].size(); i++) {
file >> data_old[j][i];
}
}
@@ -55,7 +55,7 @@ void update_field_file(std::string id, const std::vector<T>& data, unsigned int
file_out <<std::fixed<< N_old + N << "\n";
for (unsigned j = 0; j < data.size(); j++) {
- for (unsigned int i = 0; i < data[j].size(); i++) {
+ for (unsigned i = 0; i < data[j].size(); i++) {
file_out << data_old[j][i] + data[j][i] << " ";
}
file_out << "\n";
@@ -65,8 +65,8 @@ void update_field_file(std::string id, const std::vector<T>& data, unsigned int
}
template <class T>
-std::vector<fftw_complex> data_transform(unsigned int Mx, unsigned int My, const std::vector<T>& data, fftw_plan forward_plan, double *fftw_forward_in, fftw_complex *fftw_forward_out) {
- for (unsigned int i = 0; i < Mx * My; i++) {
+std::vector<fftw_complex> data_transform(unsigned Mx, unsigned My, const std::vector<T>& data, fftw_plan forward_plan, double *fftw_forward_in, fftw_complex *fftw_forward_out) {
+ for (unsigned i = 0; i < Mx * My; i++) {
fftw_forward_in[i] = (double)data[i];
}
@@ -74,7 +74,7 @@ std::vector<fftw_complex> data_transform(unsigned int Mx, unsigned int My, const
std::vector<fftw_complex> output(Mx * (My / 2 + 1));
- for (unsigned int i = 0; i < Mx * (My / 2 + 1); i++) {
+ for (unsigned i = 0; i < Mx * (My / 2 + 1); i++) {
output[i][0] = fftw_forward_out[i][0];
output[i][1] = fftw_forward_out[i][1];
}
@@ -83,24 +83,24 @@ std::vector<fftw_complex> data_transform(unsigned int Mx, unsigned int My, const
}
template <class T>
-void correlation(unsigned int Mx, unsigned int My, std::vector<T>& data, const std::vector<fftw_complex>& tx1, const std::vector<fftw_complex>& tx2, fftw_plan reverse_plan, fftw_complex *fftw_reverse_in, double *fftw_reverse_out) {
- for (unsigned int i = 0; i < Mx * (My / 2 + 1); i++) {
+void correlation(unsigned Mx, unsigned My, std::vector<T>& data, const std::vector<fftw_complex>& tx1, const std::vector<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 int i = 0; i < (Mx / 2 + 1) * (My / 2 + 1); i++) {
+ for (unsigned i = 0; i < (Mx / 2 + 1) * (My / 2 + 1); i++) {
data[i] += (T)(fftw_reverse_out[Mx * (i / (Mx / 2 + 1)) + i % (Mx / 2 + 1)] / (Mx * My));
}
}
template <class T>
-void autocorrelation(unsigned int Mx, unsigned int 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) {
+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 int i = 0; i < My * (Mx / 2 + 1); i++) {
+ 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;
}
@@ -108,23 +108,23 @@ void autocorrelation(unsigned int Mx, unsigned int My, std::vector<std::vector<T
fftw_execute(reverse_plan);
for (unsigned j = 0; j < out_data.size(); j++) {
- for (unsigned int i = 0; i < (Mx / 2 + 1) * (My / 2 + 1); i++) {
+ 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);
}
}
}
-unsigned int edge_r_to_ind(graph::coordinate r, double Lx, double Ly, unsigned int Mx, unsigned int My) {
+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(double Lx, double Ly, unsigned int Mx, unsigned int My, double beta, unsigned Ncum) :
- Lx(Lx), Ly(Ly), Mx(Mx), My(My), beta(beta), G(2 * (unsigned int)ceil(Lx * Ly / 2)),
- sc(2 * (unsigned int)ceil(Lx * Ly / 2), 0),
- sa(2 * (unsigned int)ceil(Lx * Ly / 2), 0),
- sC(2 * (unsigned int)ceil(Lx * Ly / 2), 0),
- sA(2 * (unsigned int)ceil(Lx * Ly / 2), 0),
- sd(3 * (unsigned int)ceil(Lx * Ly / 2), 0),
+ma::ma(double Lx, double Ly, unsigned Mx, unsigned My, double beta, unsigned Ncum) :
+ Lx(Lx), Ly(Ly), Mx(Mx), My(My), beta(beta), G(2 * (unsigned)ceil(Lx * Ly / 2)),
+ sc(2 * (unsigned)ceil(Lx * Ly / 2), 0),
+ sa(2 * (unsigned)ceil(Lx * Ly / 2), 0),
+ sC(2 * (unsigned)ceil(Lx * Ly / 2), 0),
+ sA(2 * (unsigned)ceil(Lx * Ly / 2), 0),
+ sd(3 * (unsigned)ceil(Lx * Ly / 2), 0),
Ccc(Ncum),
Css(Ncum),
Cmm(Ncum),
@@ -195,7 +195,7 @@ void ma::pre_fracture(const network&) {
boost::remove_edge_if(trivial, G);
}
-void ma::bond_broken(const network& net, const current_info& cur, unsigned int i) {
+void ma::bond_broken(const network& net, const current_info& cur, unsigned i) {
long double c = logl(cur.conductivity / fabs(cur.currents[i])) + net.thresholds[i];
if (c > lv && avalanches.back().size() > 0) {
sa[avalanches.back().size() - 1]++;
@@ -221,10 +221,10 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned int i
}
void ma::post_fracture(network &n) {
- std::vector<unsigned int> component(boost::num_vertices(G));
- unsigned int num = boost::connected_components(G, &component[0]);
+ std::vector<unsigned> component(boost::num_vertices(G));
+ unsigned num = boost::connected_components(G, &component[0]);
- std::list<unsigned int> crack = find_minimal_crack(G, n);
+ std::list<unsigned> crack = find_minimal_crack(G, n);
// crack surface correlations
std::fill_n(fftw_forward_in, Mx * My, 0.0);
@@ -236,17 +236,17 @@ void ma::post_fracture(network &n) {
autocorrelation(Mx, My, Css, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out);
- unsigned int crack_component = component[n.G.dual_edges[crack.front()].v[0]];
+ unsigned crack_component = component[n.G.dual_edges[crack.front()].v[0]];
- std::vector<std::list<unsigned int>> components(num);
+ std::vector<std::list<unsigned>> components(num);
- for (unsigned int i = 0; i < n.G.dual_vertices.size(); i++) {
+ for (unsigned i = 0; i < n.G.dual_vertices.size(); i++) {
components[component[i]].push_back(i);
}
// non-spanning clusters
std::fill_n(fftw_forward_in, Mx * My, 0.0);
- for (unsigned int i = 0; i < num; i++) {
+ for (unsigned i = 0; i < num; i++) {
if (i != crack_component && components[i].size() > 0) {
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)] += 1.0;
@@ -275,7 +275,7 @@ void ma::post_fracture(network &n) {
autocorrelation(Mx, My, Cmm, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out);
- std::function<bool(unsigned int)> inCrack = [&](unsigned int i) -> bool {
+ std::function<bool(unsigned)> inCrack = [&](unsigned i) -> bool {
return component[n.G.dual_edges[i].v[0]] == crack_component;
};
@@ -303,11 +303,11 @@ void ma::post_fracture(network &n) {
autocorrelation(Mx, My, Cll, forward_plan, fftw_forward_in, fftw_forward_out, reverse_plan, fftw_reverse_in, fftw_reverse_out);
// damage size distribution
- unsigned int total_broken = 0;
+ unsigned total_broken = 0;
std::fill_n(fftw_forward_in, Mx * My, 0.0);
- for (unsigned int i = 0; i < n.G.edges.size(); i++) {
+ for (unsigned i = 0; i < n.G.edges.size(); i++) {
if (n.fuses[i]) {
total_broken++;
fftw_forward_in[edge_r_to_ind(n.G.edges[i].r, Lx, Ly, Mx, My)] += 1.0;
@@ -322,7 +322,7 @@ void ma::post_fracture(network &n) {
unsigned ii = avalanches.back().front();
long double c = logl(cur.conductivity / fabs(cur.currents[ii])) + n.thresholds[ii];
- for (unsigned int i = 0; i < n.G.edges.size(); i++) {
+ for (unsigned i = 0; i < n.G.edges.size(); i++) {
double x;
if (!n.fuses[i]) {
stress_file << std::scientific << fabs(cur.currents[i]) << " ";
diff --git a/src/measurements.hpp b/src/measurements.hpp
index aa41fd1..ba52720 100644
--- a/src/measurements.hpp
+++ b/src/measurements.hpp
@@ -25,11 +25,11 @@ class ma : public hooks {
double *fftw_reverse_out;
fftw_plan forward_plan;
fftw_plan reverse_plan;
- unsigned int N;
+ unsigned N;
double Lx;
double Ly;
- unsigned int Mx;
- unsigned int My;
+ unsigned Mx;
+ unsigned My;
double beta;
Graph G;
// std::ofstream stress_file;
@@ -57,13 +57,13 @@ class ma : public hooks {
long double lv;
- std::list<std::list<unsigned int>> avalanches;
+ std::list<std::list<unsigned>> avalanches;
- ma(double Lx, double Ly, unsigned int Mx, unsigned int My, double beta, unsigned Ncum);
+ ma(double Lx, double Ly, unsigned Mx, unsigned My, double beta, unsigned Ncum);
~ma();
void pre_fracture(const network &) override;
- void bond_broken(const network& net, const current_info& cur, unsigned int i) override;
+ void bond_broken(const network& net, const current_info& cur, unsigned i) override;
void post_fracture(network &n) override;
};