From 9ed2a4441f1cecc9b86abdd0162e6ac78e70ca40 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <pedro.gonnet@durham.ac.uk>
Date: Fri, 23 Aug 2013 09:58:54 +0000
Subject: [PATCH] add check for unsymmetric weights.

Former-commit-id: 186f3da57f8948e0784ae1686f19f1a2bb34e14e
---
 src/engine.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/engine.c b/src/engine.c
index 36b0e481f3..6c07f784f0 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -100,7 +100,7 @@ void engine_repartition ( struct engine *e ) {
     float sid_scale[13] = { 0.1897 , 0.4025 , 0.1897 , 0.4025 , 0.5788 , 0.4025 ,
                             0.1897 , 0.4025 , 0.1897 , 0.4025 , 0.5788 , 0.4025 , 
                             0.5788 };
-    float wscale = 0.001;
+    float wscale = 0.0001;
     
     /* Clear the repartition flag. */
     e->forcerepart = 0;
@@ -226,6 +226,15 @@ void engine_repartition ( struct engine *e ) {
     /* As of here, only one node needs to compute the partition. */
     if ( nodeID == 0 ) {
     
+        /* Check that the edge weights are fully symmetric. */
+        for ( cid = 0 ; cid < nr_cells ; cid++ )
+            for ( k = 0 ; k < 26 ; k++ ) {
+                cjd = inds[ cid*26 + k ];
+                for ( j = 26*cjd ; inds[j] != cid ; j++ );
+                if ( weights_e[ cid*26+k ] != weights_e[ j ] )
+                    error( "Unsymmetric edge weights detected (%i vs %i)." , weights_e[ cid*26+k ] , weights_e[ j ] );
+                }
+    
         /* Allocate and fill the connection array. */
         idx_t *offsets;
         if ( ( offsets = (idx_t *)malloc( sizeof(idx_t) * (nr_cells + 1) ) ) == NULL )
-- 
GitLab