blob: abf88cdaf39c7e9c7d4e1d6a075ab641d095d489 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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);
};
|