From 386856afbb6ca347221c13cd606e25b204317929 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 14 Nov 2018 14:25:21 -0500 Subject: a lot of cleaning and simplification --- lib/include/current_info.hpp | 10 ++++++++++ lib/include/hooks.hpp | 4 +++- lib/include/network.hpp | 8 ++++---- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 lib/include/current_info.hpp (limited to 'lib/include') 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 + +typedef struct current_info { + double conductivity; + std::vector 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>&, 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 #include -#include "cholmod.h" +#include #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> currents(); + void break_edge(unsigned int, bool unbreak = false); + current_info get_current_info(); void fracture(hooks&, double cutoff = 1e-14); }; -- cgit v1.2.3-54-g00ecf