summaryrefslogtreecommitdiff
path: root/lib/include/network.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/include/network.hpp')
-rw-r--r--lib/include/network.hpp56
1 files changed, 34 insertions, 22 deletions
diff --git a/lib/include/network.hpp b/lib/include/network.hpp
index bf9015c..8748ea9 100644
--- a/lib/include/network.hpp
+++ b/lib/include/network.hpp
@@ -18,34 +18,46 @@
#define CURRENT_CUTOFF 1e-10
+class fuse_network;
+class elastic_network;
+class percolation_network;
+
class network {
- private:
- problem px;
- problem py;
- std::unordered_map<std::array<unsigned, 2>, bool> seen_pairs;
+ friend class fuse_network;
+ friend class elastic_network;
+ friend class percolation_network;
- void update_backbone(const std::vector<double>& c);
- void break_edge(unsigned, bool unbreak = false);
- void get_cycle_edges_helper(std::set<unsigned>&, std::set<unsigned>&, unsigned, unsigned) const;
- std::set<unsigned> get_cycle_edges(unsigned) const;
- std::array<unsigned, 2> find_cycle(const std::set<unsigned>&, unsigned, unsigned) const;
+ private:
+ problem px;
+ problem py;
+ std::unordered_map<std::array<unsigned, 2>, bool> seen_pairs;
+
+ void update_backbone(const std::vector<double>& c);
+ void break_edge(unsigned, bool unbreak = false);
+ void get_cycle_edges_helper(std::set<unsigned>&, std::set<unsigned>&, unsigned, unsigned) const;
+ std::set<unsigned> get_cycle_edges(unsigned) const;
+ bool find_cycle_helper(std::array<unsigned, 2>&, const std::set<unsigned>&, unsigned, unsigned, unsigned) const;
+ std::array<unsigned, 2> find_cycle(const std::set<unsigned>&, unsigned, unsigned) const;
+ void get_cluster_edges_helper(std::set<unsigned>&, unsigned) const;
+ std::set<unsigned> get_cluster_edges(unsigned) const;
+ void get_tie_flaps_helper(std::set<unsigned>&, unsigned, unsigned) const;
+ std::list<std::set<unsigned>> get_tie_flaps(unsigned) const;
public:
- const graph& G;
+ const graph& G;
- ClusterTree C;
+ ClusterTree C;
- std::vector<bool> fuses;
- std::vector<bool> backbone;
- std::vector<long double> thresholds;
+ std::vector<bool> fuses;
+ std::vector<bool> backbone;
+ std::vector<long double> thresholds;
- network(const graph&, cholmod_common*);
- network(const network&);
+ network(const graph&, cholmod_common*);
- void set_thresholds(double, std::mt19937&);
- void fracture(hooks&, bool one_axis = true);
+ void set_thresholds(double, std::mt19937&);
+ void fracture(hooks&, bool one_axis = true);
- virtual current_info get_current_info() const {current_info empty; return empty;};
+ virtual current_info get_current_info() {current_info empty; return empty;};
};
class fuse_network : public network {
@@ -56,7 +68,7 @@ class fuse_network : public network {
fuse_network(const graph&, cholmod_common*, double weight = 1.0);
fuse_network(const fuse_network&);
- current_info get_current_info() const override;
+ current_info get_current_info() override;
};
class elastic_network : public network {
@@ -67,7 +79,7 @@ class elastic_network : public network {
elastic_network(const graph&, cholmod_common*, double weight = 0.5);
elastic_network(const elastic_network&);
- current_info get_current_info() const override;
+ current_info get_current_info() override;
};
class percolation_network : public network {
@@ -75,6 +87,6 @@ class percolation_network : public network {
percolation_network(const graph&, cholmod_common*);
percolation_network(const percolation_network&);
- current_info get_current_info() const override;
+ current_info get_current_info() override;
};