diff options
Diffstat (limited to 'lib/include/network.hpp')
-rw-r--r-- | lib/include/network.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/include/network.hpp b/lib/include/network.hpp new file mode 100644 index 0000000..abf88cd --- /dev/null +++ b/lib/include/network.hpp @@ -0,0 +1,48 @@ + +#pragma once + +#include <vector> +#include <functional> +#include <utility> +#include <random> + +#include "cholmod.h" + +#include "graph.hpp" +#include "hooks.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 network { + private: + cholmod_dense *b; + cholmod_factor *factor; + cholmod_sparse *voltcurmat; + cholmod_common *c; + + public: + const graph& G; + std::vector<bool> fuses; + std::vector<long double> thresholds; + + network(const graph&, cholmod_common*); + network(const network &other); + ~network(); + + void set_thresholds(double, std::mt19937&); + void break_edge(unsigned int); + void add_edge(unsigned int); + std::pair<double, std::vector<double>> currents(); + void fracture(hooks&, double cutoff = 1e-13); +}; + |