#pragma once #include #include #include #include #include #include #include "graph.hpp" #include "hooks.hpp" #include "current_info.hpp" #include "array_hash.hpp" #ifdef FRACTURE_LONGINT #define CHOL_F(x) cholmod_l_##x #define CHOL_INT long int #else #define CHOL_F(x) cholmod_##x #define CHOL_INT int #endif class problem { private: 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& fuses); void break_edge(unsigned, bool unbreak = false); }; class network { public: const graph& G; std::vector fuses; std::vector thresholds; network(const graph&); network(const network&); void set_thresholds(double, std::mt19937&); }; 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(); };