#pragma once #include #include #include #include #include #include #include "problem.hpp" #include "graph.hpp" #include "hooks.hpp" #include "current_info.hpp" #include "array_hash.hpp" #define CURRENT_CUTOFF 1e-11 class network { public: const graph& G; std::vector fuses; std::vector thresholds; network(const graph&); network(const network&); void set_thresholds(double, std::mt19937&); void fracture(hooks&, bool one_axis = false); virtual void break_edge(unsigned e, bool unbreak = false) {fuses[e] = !unbreak;}; 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; };