[Yt-svn] yt: Fixing issues present when any component of the normal vecto...

hg at spacepope.org hg at spacepope.org
Mon Aug 2 07:24:43 PDT 2010


hg Repository: yt
details:   yt/rev/1831bbe4afd1
changeset: 1908:1831bbe4afd1
user:      Matthew Turk <matthewturk at gmail.com>
date:
Mon Aug 02 07:24:37 2010 -0700
description:
Fixing issues present when any component of the normal vector is 0.0.

diffstat:

 yt/_amr_utils/VolumeIntegrator.pyx |    6 +
 yt/amr_utils.c                     |  708 ++++++++++++++++++++++-------------------
 2 files changed, 389 insertions(+), 325 deletions(-)

diffs (truncated from 2258 to 300 lines):

diff -r f0960f4f6bed -r 1831bbe4afd1 yt/_amr_utils/VolumeIntegrator.pyx
--- a/yt/_amr_utils/VolumeIntegrator.pyx	Thu Jul 29 17:18:51 2010 -0700
+++ b/yt/_amr_utils/VolumeIntegrator.pyx	Mon Aug 02 07:24:37 2010 -0700
@@ -411,6 +411,12 @@
         for i in range(3):
             if (v_dir[i] < 0):
                 step[i] = -1
+            elif (v_dir[i] == 0):
+                step[i] = 1
+                tmax[i] = 1e60
+                iv_dir[i] = 1e60
+                tdelta[i] = 1e-60
+                continue
             else:
                 step[i] = 1
             x = (i+1) % 3
diff -r f0960f4f6bed -r 1831bbe4afd1 yt/amr_utils.c
--- a/yt/amr_utils.c	Thu Jul 29 17:18:51 2010 -0700
+++ b/yt/amr_utils.c	Mon Aug 02 07:24:37 2010 -0700
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.13.beta0 on Thu Jul 29 17:17:22 2010 */
+/* Generated by Cython 0.13.beta0 on Mon Aug  2 07:18:26 2010 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
@@ -480,7 +480,7 @@
   PyObject *grids;
 };
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":569
+/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575
  *         return 1
  * 
  * cdef class ProtoPrism:             # <<<<<<<<<<<<<<
@@ -513,7 +513,7 @@
   int refined_pos;
 };
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":537
+/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543
  *             tf.eval_transfer(dt, self.dvs, rgba, grad)
  * 
  * cdef class GridFace:             # <<<<<<<<<<<<<<
@@ -605,7 +605,7 @@
 };
 
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":537
+/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":543
  *             tf.eval_transfer(dt, self.dvs, rgba, grad)
  * 
  * cdef class GridFace:             # <<<<<<<<<<<<<<
@@ -633,7 +633,7 @@
 static struct __pyx_vtabstruct_2yt_9amr_utils_TransferFunctionProxy *__pyx_vtabptr_2yt_9amr_utils_TransferFunctionProxy;
 
 
-/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":569
+/* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":575
  *         return 1
  * 
  * cdef class ProtoPrism:             # <<<<<<<<<<<<<<
@@ -16440,7 +16440,7 @@
  *         for i in range(3):
  *             if (v_dir[i] < 0):             # <<<<<<<<<<<<<<
  *                 step[i] = -1
- *             else:
+ *             elif (v_dir[i] == 0):
  */
     __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) < 0.0);
     if (__pyx_t_2) {
@@ -16449,16 +16449,73 @@
  *         for i in range(3):
  *             if (v_dir[i] < 0):
  *                 step[i] = -1             # <<<<<<<<<<<<<<
- *             else:
+ *             elif (v_dir[i] == 0):
  *                 step[i] = 1
  */
       (__pyx_v_step[__pyx_v_i]) = -1;
       goto __pyx_L5;
     }
-    /*else*/ {
+
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":414
+ *             if (v_dir[i] < 0):
+ *                 step[i] = -1
+ *             elif (v_dir[i] == 0):             # <<<<<<<<<<<<<<
+ *                 step[i] = 1
+ *                 tmax[i] = 1e60
+ */
+    __pyx_t_2 = ((__pyx_v_v_dir[__pyx_v_i]) == 0.0);
+    if (__pyx_t_2) {
 
       /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":415
  *                 step[i] = -1
+ *             elif (v_dir[i] == 0):
+ *                 step[i] = 1             # <<<<<<<<<<<<<<
+ *                 tmax[i] = 1e60
+ *                 iv_dir[i] = 1e60
+ */
+      (__pyx_v_step[__pyx_v_i]) = 1;
+
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":416
+ *             elif (v_dir[i] == 0):
+ *                 step[i] = 1
+ *                 tmax[i] = 1e60             # <<<<<<<<<<<<<<
+ *                 iv_dir[i] = 1e60
+ *                 tdelta[i] = 1e-60
+ */
+      (__pyx_v_tmax[__pyx_v_i]) = 1e60;
+
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":417
+ *                 step[i] = 1
+ *                 tmax[i] = 1e60
+ *                 iv_dir[i] = 1e60             # <<<<<<<<<<<<<<
+ *                 tdelta[i] = 1e-60
+ *                 continue
+ */
+      (__pyx_v_iv_dir[__pyx_v_i]) = 1e60;
+
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":418
+ *                 tmax[i] = 1e60
+ *                 iv_dir[i] = 1e60
+ *                 tdelta[i] = 1e-60             # <<<<<<<<<<<<<<
+ *                 continue
+ *             else:
+ */
+      (__pyx_v_tdelta[__pyx_v_i]) = 1e-60;
+
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":419
+ *                 iv_dir[i] = 1e60
+ *                 tdelta[i] = 1e-60
+ *                 continue             # <<<<<<<<<<<<<<
+ *             else:
+ *                 step[i] = 1
+ */
+      goto __pyx_L3_continue;
+      goto __pyx_L5;
+    }
+    /*else*/ {
+
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":421
+ *                 continue
  *             else:
  *                 step[i] = 1             # <<<<<<<<<<<<<<
  *             x = (i+1) % 3
@@ -16468,7 +16525,7 @@
     }
     __pyx_L5:;
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":416
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":422
  *             else:
  *                 step[i] = 1
  *             x = (i+1) % 3             # <<<<<<<<<<<<<<
@@ -16477,7 +16534,7 @@
  */
     __pyx_v_x = __Pyx_mod_long((__pyx_v_i + 1), 3);
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":417
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":423
  *                 step[i] = 1
  *             x = (i+1) % 3
  *             y = (i+2) % 3             # <<<<<<<<<<<<<<
@@ -16486,7 +16543,7 @@
  */
     __pyx_v_y = __Pyx_mod_long((__pyx_v_i + 2), 3);
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":418
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":424
  *             x = (i+1) % 3
  *             y = (i+2) % 3
  *             iv_dir[i] = 1.0/v_dir[i]             # <<<<<<<<<<<<<<
@@ -16496,11 +16553,11 @@
     __pyx_t_3 = (__pyx_v_v_dir[__pyx_v_i]);
     if (unlikely(__pyx_t_3 == 0)) {
       PyErr_Format(PyExc_ZeroDivisionError, "float division");
-      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      {__pyx_filename = __pyx_f[2]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     }
     (__pyx_v_iv_dir[__pyx_v_i]) = (1.0 / __pyx_t_3);
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":419
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":425
  *             y = (i+2) % 3
  *             iv_dir[i] = 1.0/v_dir[i]
  *             tl = (self.left_edge[i] - v_pos[i])*iv_dir[i]             # <<<<<<<<<<<<<<
@@ -16509,7 +16566,7 @@
  */
     __pyx_v_tl = (((__pyx_v_self->left_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i]));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":420
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":426
  *             iv_dir[i] = 1.0/v_dir[i]
  *             tl = (self.left_edge[i] - v_pos[i])*iv_dir[i]
  *             temp_x = (v_pos[x] + tl*v_dir[x])             # <<<<<<<<<<<<<<
@@ -16518,7 +16575,7 @@
  */
     __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_x])));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":421
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":427
  *             tl = (self.left_edge[i] - v_pos[i])*iv_dir[i]
  *             temp_x = (v_pos[x] + tl*v_dir[x])
  *             temp_y = (v_pos[y] + tl*v_dir[y])             # <<<<<<<<<<<<<<
@@ -16527,7 +16584,7 @@
  */
     __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tl * (__pyx_v_v_dir[__pyx_v_y])));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":422
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":428
  *             temp_x = (v_pos[x] + tl*v_dir[x])
  *             temp_y = (v_pos[y] + tl*v_dir[y])
  *             if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \             # <<<<<<<<<<<<<<
@@ -16539,7 +16596,7 @@
       __pyx_t_4 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x]));
       if (__pyx_t_4) {
 
-        /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":423
+        /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":429
  *             temp_y = (v_pos[y] + tl*v_dir[y])
  *             if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \
  *                self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \             # <<<<<<<<<<<<<<
@@ -16551,7 +16608,7 @@
           __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y]));
           if (__pyx_t_6) {
 
-            /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":424
+            /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":430
  *             if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \
  *                self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \
  *                0.0 <= tl and tl < intersect_t:             # <<<<<<<<<<<<<<
@@ -16583,7 +16640,7 @@
     }
     if (__pyx_t_4) {
 
-      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":425
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":431
  *                self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \
  *                0.0 <= tl and tl < intersect_t:
  *                 direction = i             # <<<<<<<<<<<<<<
@@ -16592,7 +16649,7 @@
  */
       __pyx_v_direction = __pyx_v_i;
 
-      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":426
+      /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":432
  *                0.0 <= tl and tl < intersect_t:
  *                 direction = i
  *                 intersect_t = tl             # <<<<<<<<<<<<<<
@@ -16604,7 +16661,7 @@
     }
     __pyx_L6:;
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":427
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":433
  *                 direction = i
  *                 intersect_t = tl
  *             tr = (self.right_edge[i] - v_pos[i])*iv_dir[i]             # <<<<<<<<<<<<<<
@@ -16613,7 +16670,7 @@
  */
     __pyx_v_tr = (((__pyx_v_self->right_edge[__pyx_v_i]) - (__pyx_v_v_pos[__pyx_v_i])) * (__pyx_v_iv_dir[__pyx_v_i]));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":428
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":434
  *                 intersect_t = tl
  *             tr = (self.right_edge[i] - v_pos[i])*iv_dir[i]
  *             temp_x = (v_pos[x] + tr*v_dir[x])             # <<<<<<<<<<<<<<
@@ -16622,7 +16679,7 @@
  */
     __pyx_v_temp_x = ((__pyx_v_v_pos[__pyx_v_x]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_x])));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":429
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":435
  *             tr = (self.right_edge[i] - v_pos[i])*iv_dir[i]
  *             temp_x = (v_pos[x] + tr*v_dir[x])
  *             temp_y = (v_pos[y] + tr*v_dir[y])             # <<<<<<<<<<<<<<
@@ -16631,7 +16688,7 @@
  */
     __pyx_v_temp_y = ((__pyx_v_v_pos[__pyx_v_y]) + (__pyx_v_tr * (__pyx_v_v_dir[__pyx_v_y])));
 
-    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":430
+    /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":436
  *             temp_x = (v_pos[x] + tr*v_dir[x])
  *             temp_y = (v_pos[y] + tr*v_dir[y])
  *             if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \             # <<<<<<<<<<<<<<
@@ -16643,7 +16700,7 @@
       __pyx_t_2 = (__pyx_v_temp_x <= (__pyx_v_self->right_edge[__pyx_v_x]));
       if (__pyx_t_2) {
 
-        /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":431
+        /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":437
  *             temp_y = (v_pos[y] + tr*v_dir[y])
  *             if self.left_edge[x] <= temp_x and temp_x <= self.right_edge[x] and \
  *                self.left_edge[y] <= temp_y and temp_y <= self.right_edge[y] and \             # <<<<<<<<<<<<<<
@@ -16655,7 +16712,7 @@
           __pyx_t_6 = (__pyx_v_temp_y <= (__pyx_v_self->right_edge[__pyx_v_y]));
           if (__pyx_t_6) {
 
-            /* "/Users/matthewturk/yt/yt/yt/_amr_utils/VolumeIntegrator.pyx":432



More information about the yt-svn mailing list