summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-06-29 23:54:37 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-06-29 23:54:37 -0400
commit492419f0ae1b32c1d4bc60997ca8eb7daba22182 (patch)
tree9b6d60d10cf7f3ae22cbb8cf2f4d233b71eff501 /lib
parent948f90b6493da83d10e18f30b0fbb8e937e29c0b (diff)
downloadfuse_networks-492419f0ae1b32c1d4bc60997ca8eb7daba22182.tar.gz
fuse_networks-492419f0ae1b32c1d4bc60997ca8eb7daba22182.tar.bz2
fuse_networks-492419f0ae1b32c1d4bc60997ca8eb7daba22182.zip
more fixes, and updating the interface
Diffstat (limited to 'lib')
-rw-r--r--lib/src/network.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/src/network.cpp b/lib/src/network.cpp
index dcc5e0e..ed23d45 100644
--- a/lib/src/network.cpp
+++ b/lib/src/network.cpp
@@ -90,6 +90,9 @@ void network::fracture(hooks& m, bool one_axis) {
}
void network::update_backbone(const std::vector<double>& c) {
+
+ bool done_x = px.sol.conductivity[0] < 1.0 / G.edges.size();
+ bool done_y = py.sol.conductivity[1] < 1.0 / G.edges.size();
class get_cycle_edges : public boost::default_dfs_visitor {
public:
std::set<unsigned> tE;
@@ -191,7 +194,7 @@ void network::update_backbone(const std::vector<double>& c) {
other_cycles.push_back(tcycle);
}
- if (std::any_of(other_cycles.begin(), other_cycles.end(), [](std::array<unsigned, 2> c){return c[0] % 2 == 0 && c[1] % 2 == 0;})) {
+ if (std::any_of(other_cycles.begin(), other_cycles.end(), [done_x, done_y](std::array<unsigned, 2> c){return (c[0] % 2 == 0 && c[1] % 2 == 0) || ((c[0] % 2 == 0 && done_x) || (c[1] % 2 == 0 && done_y));})) {
seen_pairs[{G.edges[i].v[0], G.edges[i].v[1]}] = true;
backbone[i] = true;
boost::remove_edge(G.edges[i].v[0], G.edges[i].v[1], bG);
@@ -304,6 +307,8 @@ void network::update_backbone(const std::vector<double>& c) {
bool any_intervening_e_1 = false;
bool any_intervening2 = false;
bool any_intervening_e_2 = false;
+ unsigned ie1 = 0;
+ unsigned ie2 = 0;
for (unsigned k = il + 1; k < ig; k++) {
if (!boost::same_component(G.vertices[v].nd[i], G.vertices[v].nd[k], ds)) {
@@ -320,33 +325,24 @@ void network::update_backbone(const std::vector<double>& c) {
if (any_intervening2 && !any_intervening1) {
for (unsigned k = il + 1; k <= ig; k++) {
if (!backbone[G.vertices[v].ne[k]]) {
- any_intervening_e_1 = true;
- break;
+ ie1++;
}
}
}
if (any_intervening1 && !any_intervening2) {
for (unsigned k = ig + 1; k%G.vertices[v].nd.size() != il + 1; k++) {
if (!backbone[G.vertices[v].ne[k%G.vertices[v].nd.size()]]) {
- any_intervening_e_2 = true;
- break;
+ ie2++;
}
}
}
- if ((any_intervening1 && any_intervening2) || (any_intervening1 && any_intervening_e_2) || (any_intervening2 && any_intervening_e_1)) {
+ if ((any_intervening1 && any_intervening2) || (any_intervening1 && ie2 > 1) || (any_intervening2 && ie1 > 1)) {
found_pair = true;
p1 = il;
p2 = ig;
d1 = G.vertices[v].nd[il];
d2 = G.vertices[v].nd[ig];
- break;
- }
- }
- }
- }
- }
- if (found_pair) {
std::list<unsigned> cedges = {};
get_cycle_edges vis(cedges);
std::vector<boost::default_color_type> cm1(G.dual_vertices.size());
@@ -390,7 +386,7 @@ void network::update_backbone(const std::vector<double>& c) {
other_cycles.push_back(tcycle);
}
- if (std::any_of(other_cycles.begin(), other_cycles.end(), [](std::array<unsigned, 2> c){return c[0] % 2 == 0 && c[1] % 2 == 0;})) {
+ if (std::any_of(other_cycles.begin(), other_cycles.end(), [done_x, done_y](std::array<unsigned, 2> c){return ((c[0] % 2 == 0 && c[1] % 2 == 0) || (c[0] % 2 == 0 && done_x)) || (c[1] % 2 == 0 && done_y);})) {
seen_pairs[{d1, d2}] = true;
std::set<unsigned> left_edges = {};
@@ -456,6 +452,10 @@ void network::update_backbone(const std::vector<double>& c) {
}
}
}
+ }
+ }
+ }
+ }
}
void network::break_edge(unsigned e, bool unbreak) {