[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8
Sebastien Delaux
s.delaux at niwa.co.nz
Tue Nov 24 12:24:38 UTC 2009
The following commit has been merged in the upstream branch:
commit 9a3ecaa56a1a4934fa236eff626c47f8a41c36ad
Author: Sebastien Delaux <s.delaux at niwa.co.nz>
Date: Tue Jun 16 08:16:36 2009 +1000
Bug fix for dividing by zero in moving code
darcs-hash:20090615221636-118cf-c3720962d5ca412632ad5da1327476dc6e7943c6.gz
diff --git a/src/moving2.c b/src/moving2.c
index 4d93d8c..f2190c2 100644
--- a/src/moving2.c
+++ b/src/moving2.c
@@ -74,13 +74,16 @@ static int cell_is_corner (FttCell * cell)
gfs_solid_normal (neighbors.c[d1], &n1);
norm= sqrt(n1.x*n1.x+n1.y*n1.y);
- n1.x /= norm;
- n1.y /= norm;
+ if ( norm != 0.) {
+ n1.x /= norm;
+ n1.y /= norm;
+ }
gfs_solid_normal (neighbors.c[d2], &n2);
norm= sqrt(n2.x*n2.x+n2.y*n2.y);
- n2.x /= norm;
- n2.y /= norm;
-
+ if ( norm != 0.) {
+ n2.x /= norm;
+ n2.y /= norm;
+ }
if (d1/2 == d2/2)
return 0;
@@ -136,12 +139,15 @@ static int cell_was_corner (FttCell * cell, GfsVariable * old_solid_v, GfsVariab
(&n2.x)[c] = (SOLD2 (neighbors.c[d2], 2*c + 1) - SOLD2 (neighbors.c[d2], 2*c));
norm= sqrt(n1.x*n1.x+n1.y*n1.y);
- n1.x /= norm;
- n1.y /= norm;
+ if ( norm != 0.) {
+ n1.x /= norm;
+ n1.y /= norm;
+ }
norm= sqrt(n2.x*n2.x+n2.y*n2.y);
- n2.x /= norm;
- n2.y /= norm;
-
+ if ( norm != 0.) {
+ n2.x /= norm;
+ n2.y /= norm;
+ }
if (neighbors.c[d1] && neighbors.c[d2])
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list