From 948f90b6493da83d10e18f30b0fbb8e937e29c0b Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 24 Jun 2019 21:41:34 -0400 Subject: mostly implemented the ability to find dead bonds using topological properties --- lib/include/graph.hpp | 2 ++ lib/include/network.hpp | 46 +++++++++++++++++++++++++++++++++------------- lib/include/problem.hpp | 4 +++- 3 files changed, 38 insertions(+), 14 deletions(-) (limited to 'lib/include') diff --git a/lib/include/graph.hpp b/lib/include/graph.hpp index 45cc478..0452339 100644 --- a/lib/include/graph.hpp +++ b/lib/include/graph.hpp @@ -21,6 +21,8 @@ class graph { typedef struct vertex { coordinate r; + std::vector nd; + std::vector ne; std::vector polygon; } vertex; diff --git a/lib/include/network.hpp b/lib/include/network.hpp index 544f828..8211cfc 100644 --- a/lib/include/network.hpp +++ b/lib/include/network.hpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "problem.hpp" #include "graph.hpp" @@ -16,60 +17,79 @@ #define CURRENT_CUTOFF 1e-10 +#include +#include +#include +#include +#include +#include +#include +#include + +struct EdgeProperties { + unsigned index; +}; + +typedef boost::adjacency_list Graph; +typedef boost::graph_traits::vertex_descriptor Vertex; +typedef boost::graph_traits::vertices_size_type VertexIndex; + class network { public: const graph& G; + + Graph bG; + Graph dG; + std::vector rank; + std::vector parent; + boost::disjoint_sets ds; + std::unordered_map, bool> seen_pairs; + std::vector fuses; + std::vector backbone; std::vector thresholds; - network(const graph&); + problem px; + problem py; + + network(const graph&, cholmod_common*); network(const network&); void set_thresholds(double, std::mt19937&); void fracture(hooks&, bool one_axis = false); + void update_backbone(const std::vector& c); - virtual void break_edge(unsigned e, bool unbreak = false) {fuses[e] = !unbreak;}; + void break_edge(unsigned, bool unbreak = false); virtual current_info get_current_info() {current_info empty; return empty;}; }; class fuse_network : public network { private: double weight; - problem ohm_x; - problem ohm_y; public: fuse_network(const graph&, cholmod_common*, double weight = 1.0); fuse_network(const fuse_network&); - void break_edge(unsigned, bool unbreak = false) override; current_info get_current_info() override; }; class elastic_network : public network { private: double weight; - problem hook_x; - problem hook_y; public: elastic_network(const graph&, cholmod_common*, double weight = 0.5); elastic_network(const elastic_network&); - void break_edge(unsigned, bool unbreak = false) override; current_info get_current_info() override; }; class percolation_network : public network { - private: - problem px; - problem py; - public: percolation_network(const graph&, cholmod_common*); percolation_network(const percolation_network&); - void break_edge(unsigned, bool unbreak = false) override; current_info get_current_info() override; }; diff --git a/lib/include/problem.hpp b/lib/include/problem.hpp index c2c9e09..740751d 100644 --- a/lib/include/problem.hpp +++ b/lib/include/problem.hpp @@ -28,11 +28,13 @@ class problem { cholmod_common* c; public: + current_info sol; + problem(const graph&, unsigned, cholmod_common*); problem(const graph&, unsigned, cholmod_sparse*, cholmod_common*); problem(const problem&); ~problem(); - current_info solve(std::vector& fuses); + void solve(std::vector& fuses); void break_edge(unsigned, bool unbreak = false); }; -- cgit v1.2.3-70-g09d2