summaryrefslogtreecommitdiff
path: root/lib/include
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-11-14 14:25:21 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-11-14 14:25:21 -0500
commit386856afbb6ca347221c13cd606e25b204317929 (patch)
tree601f24b5537330781fba01941488378fcae614e9 /lib/include
parent7984b8dbde1d44fc18b6026693c387d2d433872d (diff)
downloadfuse_networks-386856afbb6ca347221c13cd606e25b204317929.tar.gz
fuse_networks-386856afbb6ca347221c13cd606e25b204317929.tar.bz2
fuse_networks-386856afbb6ca347221c13cd606e25b204317929.zip
a lot of cleaning and simplification
Diffstat (limited to 'lib/include')
-rw-r--r--lib/include/current_info.hpp10
-rw-r--r--lib/include/hooks.hpp4
-rw-r--r--lib/include/network.hpp8
3 files changed, 17 insertions, 5 deletions
diff --git a/lib/include/current_info.hpp b/lib/include/current_info.hpp
new file mode 100644
index 0000000..90dd3c7
--- /dev/null
+++ b/lib/include/current_info.hpp
@@ -0,0 +1,10 @@
+
+#pragma once
+
+#include <vector>
+
+typedef struct current_info {
+ double conductivity;
+ std::vector<double> currents;
+} current_info;
+
diff --git a/lib/include/hooks.hpp b/lib/include/hooks.hpp
index 350f318..e617ac3 100644
--- a/lib/include/hooks.hpp
+++ b/lib/include/hooks.hpp
@@ -1,12 +1,14 @@
#pragma once
+#include "current_info.hpp"
+
class network;
class hooks {
public:
virtual void pre_fracture(const network&) {};
- virtual void bond_broken(const network&, const std::pair<double, std::vector<double>>&, unsigned int) {};
+ virtual void bond_broken(const network&, const current_info&, unsigned int) {};
virtual void post_fracture(network&) {}; // post fracture hook can be destructive
};
diff --git a/lib/include/network.hpp b/lib/include/network.hpp
index 5cbba0d..e6d67b9 100644
--- a/lib/include/network.hpp
+++ b/lib/include/network.hpp
@@ -6,10 +6,11 @@
#include <utility>
#include <random>
-#include "cholmod.h"
+#include <cholmod.h>
#include "graph.hpp"
#include "hooks.hpp"
+#include "current_info.hpp"
#ifdef FRACTURE_LONGINT
@@ -40,9 +41,8 @@ class network {
~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 break_edge(unsigned int, bool unbreak = false);
+ current_info get_current_info();
void fracture(hooks&, double cutoff = 1e-14);
};