summaryrefslogtreecommitdiff
path: root/src/cracking_ini.c
diff options
context:
space:
mode:
authorpants <jaron@kent-dobias.com>2016-09-02 15:24:34 -0400
committerpants <jaron@kent-dobias.com>2016-09-02 15:24:34 -0400
commitfd14c5e39d962be94a1f68b0d4cacb7a4aa9c3e7 (patch)
tree9abbaf23c1a57985b90110ef33a5ed3455ab6b5a /src/cracking_ini.c
parent7ff906b9cd27a44472b40e78e5d595ea41df1482 (diff)
downloadfuse_networks-fd14c5e39d962be94a1f68b0d4cacb7a4aa9c3e7.tar.gz
fuse_networks-fd14c5e39d962be94a1f68b0d4cacb7a4aa9c3e7.tar.bz2
fuse_networks-fd14c5e39d962be94a1f68b0d4cacb7a4aa9c3e7.zip
embedded systems with crack fully supported
Diffstat (limited to 'src/cracking_ini.c')
-rw-r--r--src/cracking_ini.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cracking_ini.c b/src/cracking_ini.c
index 9ab4a9d..988af5b 100644
--- a/src/cracking_ini.c
+++ b/src/cracking_ini.c
@@ -31,6 +31,30 @@ double *gen_fuse_thres(unsigned int num_edges, double *edge_coords, double beta,
return fuse_thres;
}
+void gen_voro_crack(finst *instance, double crack_len, cholmod_common *c) {
+ for (uint_t i = 0; i < instance->network->num_edges; i++) {
+ uint_t v1, v2;
+ double v1x, v1y, v2x, v2y, dx, dy;
+
+ v1 = instance->network->edges_to_verts[2 * i];
+ v2 = instance->network->edges_to_verts[2 * i + 1];
+
+ v1x = instance->network->vert_coords[2 * v1];
+ v1y = instance->network->vert_coords[2 * v1 + 1];
+ v2x = instance->network->vert_coords[2 * v2];
+ v2y = instance->network->vert_coords[2 * v2 + 1];
+
+ dx = v1x - v2x;
+ dy = v1y - v2y;
+
+ if (((v1y > 0.5 && v2y < 0.5) || (v1y < 0.5 && v2y > 0.5)) && fabs(dy) < 0.5) {
+ if (v1x + dx / dy * (v1y - 0.5) <= crack_len) {
+ break_edge(instance, i, c);
+ }
+ }
+ }
+}
+
bool gen_crack(finst *instance, double crack_len, double crack_width,
cholmod_common *c) {
assert(instance != NULL);