diff options
Diffstat (limited to 'lib/include')
-rw-r--r-- | lib/include/graph.hpp | 1 | ||||
-rw-r--r-- | lib/include/network.hpp | 50 |
2 files changed, 41 insertions, 10 deletions
diff --git a/lib/include/graph.hpp b/lib/include/graph.hpp index 1714dc2..45cc478 100644 --- a/lib/include/graph.hpp +++ b/lib/include/graph.hpp @@ -8,6 +8,7 @@ #include <random> #include <list> #include <exception> +#include <algorithm> #include "array_hash.hpp" diff --git a/lib/include/network.hpp b/lib/include/network.hpp index f12c9c7..ba98086 100644 --- a/lib/include/network.hpp +++ b/lib/include/network.hpp @@ -26,25 +26,55 @@ #endif -class network { +class problem { private: - cholmod_dense *b; - cholmod_factor *factor; - cholmod_sparse *voltcurmat; - cholmod_common *c; + const graph& G; + cholmod_dense* b; + cholmod_factor* factor; + cholmod_sparse* voltcurmat; + cholmod_common* c; + unsigned axis; public: + problem(const graph&, unsigned axis, cholmod_common*); + problem(const graph&, unsigned axis, cholmod_sparse*, cholmod_common*); + problem(const problem&); + ~problem(); + current_info solve(std::vector<bool>& fuses); + void break_edge(unsigned, bool unbreak = false); +}; + +class network { + public: const graph& G; std::vector<bool> fuses; std::vector<long double> thresholds; - network(const graph&, cholmod_common*); - network(const network &other); - ~network(); + network(const graph&); + network(const network&); void set_thresholds(double, std::mt19937&); - void break_edge(unsigned, bool unbreak = false); - current_info get_current_info(); +}; + +class fuse_network : public network { + public: + problem ohm; + + fuse_network(const graph&, cholmod_common*); + void fracture(hooks&, double cutoff = 1e-13); + current_info get_current_info(); +}; + +class elastic_network : public network { + public: + problem hook_x; + problem hook_y; + + elastic_network(const graph&, cholmod_common*); + elastic_network(const elastic_network&); + + void fracture(hooks&, double weight = 0.5, double cutoff = 1e-13); + current_info get_current_info(); }; |