summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/measurements.cpp36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/measurements.cpp b/src/measurements.cpp
index 1159fd6..578c70a 100644
--- a/src/measurements.cpp
+++ b/src/measurements.cpp
@@ -243,23 +243,17 @@ void ma::post_fracture(network &n) {
class find_cycle : public boost::default_dfs_visitor {
public:
unsigned int end;
- std::list<unsigned int>& V;
std::list<unsigned int>& E;
struct done{};
- find_cycle(std::list<unsigned int>& V, std::list<unsigned int>& E, unsigned int end) : V(V), E(E), end(end) {}
+ find_cycle(std::list<unsigned int>& E, unsigned int end) : E(E), end(end) {}
void discover_vertex(boost::graph_traits<Graph>::vertex_descriptor v, const Graph& g) {
- V.push_back(v);
if (v == end) {
throw done{};
}
}
- void finish_vertex(boost::graph_traits<Graph>::vertex_descriptor v, const Graph& g) {
- V.remove(v);
- }
-
void examine_edge(boost::graph_traits<Graph>::edge_descriptor e, const Graph& g) {
E.push_back(g[e].index);
}
@@ -269,23 +263,11 @@ void ma::post_fracture(network &n) {
}
};
- if (removed_edges.size() == 0) {
- std::pair<double, std::vector<double>> currents = n.currents();
- std::cout << currents.first << "\n";
- for (unsigned int i = 0; i < L; i++) {
- for (unsigned int j = 0; j < L; j++) {
- std::cout << n.fuses[i * L + j] << " ";
- }
- std::cout << "\n";
- }
- }
-
std::list<std::list<unsigned int>> cycles;
for (auto edge : removed_edges) {
std::list<unsigned int> cycle = {edge};
- std::list<unsigned int> vcycle = {};
- find_cycle vis(vcycle, cycle, n.G.dual_edges[edge][1]);
+ find_cycle vis(cycle, n.G.dual_edges[edge][1]);
std::vector<boost::default_color_type> new_color_map(boost::num_vertices(Gtmp));
try {
boost::depth_first_visit(Gtmp, n.G.dual_edges[edge][0], vis, boost::make_iterator_property_map(new_color_map.begin(), boost::get(boost::vertex_index, Gtmp), new_color_map[0]));
@@ -344,12 +326,6 @@ void ma::post_fracture(network &n) {
crack = cycles.front();
}
- for (auto edge : crack) {
- std::cout << edge << " ";
- }
- std::cout << "\n";
-// std::cout << max_size << " " << boost::num_edges(Gtmp) << " " << removed_edges.size() << "\n";
-
for (unsigned int be = 0; be < log2(L); be++) {
unsigned int bin = pow(2, be);
@@ -374,12 +350,8 @@ void ma::post_fracture(network &n) {
// crack surface correlations
std::vector<double> crack_damage(pow(L, 2), 0.0);
- double damage_tot = 0;
- for (unsigned int i = 0; i < pow(L, 2); i++) {
- if (!n.fuses[i] && max_i == component[n.G.dual_edges[i][0]]) {
- damage_tot++;
- crack_damage[i] = 1.0;
- }
+ for (auto edge : crack) {
+ crack_damage[edge] = 1.0;
}
std::vector<fftw_complex> t_crack_damage = data_transform(L, crack_damage, forward_plan, fftw_forward_in, fftw_forward_out);