summaryrefslogtreecommitdiff
path: root/lib/include
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-24 23:31:40 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-24 23:31:40 -0400
commitcb1b2e6822bdd1d1644ff2dad2d6157858e105b0 (patch)
tree8f4cb4225d2856e87ff797d58466759dedd39882 /lib/include
parentafe7000d6147cefd030413cb3d051c2a6260f608 (diff)
downloadfuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.tar.gz
fuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.tar.bz2
fuse_networks-cb1b2e6822bdd1d1644ff2dad2d6157858e105b0.zip
many changes to introduce two-component, elastic-like fracture
Diffstat (limited to 'lib/include')
-rw-r--r--lib/include/graph.hpp1
-rw-r--r--lib/include/network.hpp50
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();
};