[Yt-svn] yt-commit r414 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Sat Apr 26 08:23:43 PDT 2008


Author: mturk
Date: Sat Apr 26 08:23:42 2008
New Revision: 414
URL: http://yt.spacepope.org/changeset/414

Log:
Important fix to the C code for the 2D profiler.  It was not guaranteed to work
on all architectures and layouts.  Now it should.



Modified:
   trunk/yt/lagos/PointCombine.c

Modified: trunk/yt/lagos/PointCombine.c
==============================================================================
--- trunk/yt/lagos/PointCombine.c	(original)
+++ trunk/yt/lagos/PointCombine.c	Sat Apr 26 08:23:42 2008
@@ -346,16 +346,16 @@
     goto _fail;
     }
 
-    npy_float64 wv;
+    npy_float64 wval, bval;
     int n;
 
     for(n=0; n<bins_x->dimensions[0]; n++) {
-      i = bins_x->data[n];
-      j = bins_y->data[n];
-      *(npy_float64*)PyArray_GETPTR2(wresult, i, j) += 
-        wsource->data[n];
-      *(npy_float64*)PyArray_GETPTR2(bresult, i, j) += 
-        wsource->data[n] * bsource->data[n];
+      i = *(npy_int64*)PyArray_GETPTR1(bins_x, n);
+      j = *(npy_int64*)PyArray_GETPTR1(bins_y, n);
+      bval = *(npy_float64*)PyArray_GETPTR1(bsource, n);
+      wval = *(npy_float64*)PyArray_GETPTR1(wsource, n);
+      *(npy_float64*)PyArray_GETPTR2(wresult, i, j) += wval;
+      *(npy_float64*)PyArray_GETPTR2(bresult, i, j) += wval*bval;
       *(npy_float64*)PyArray_GETPTR2(used, i, j) = 1.0;
     }
 



More information about the yt-svn mailing list