[Yt-svn] yt: Adding a volume object for volume rendering a single brick o...

hg at spacepope.org hg at spacepope.org
Tue Nov 16 14:53:35 PST 2010


hg Repository: yt
details:   yt/rev/1b7a519066fb
changeset: 3536:1b7a519066fb
user:      Matthew Turk <matthewturk at gmail.com>
date:
Tue Nov 16 13:45:54 2010 -0700
description:
Adding a volume object for volume rendering a single brick of user-defined data
with the familiar transfer function and camera objects.

diffstat:

 yt/utilities/_amr_utils/VolumeIntegrator.pyx          |   3 +++
 yt/utilities/definitions.py                           |   3 +--
 yt/visualization/volume_rendering/grid_partitioner.py |  19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diffs (69 lines):

diff -r f6dc5b4ba882 -r 1b7a519066fb yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Thu Nov 11 22:12:19 2010 -0800
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Tue Nov 16 13:45:54 2010 -0700
@@ -335,6 +335,7 @@
             tdata = data[i]
             self.data[i] = <np.float64_t *> tdata.data
 
+    @cython.cdivision(True)
     @cython.boundscheck(False)
     @cython.wraparound(False)
     def cast_plane(self, TransferFunctionProxy tf, VectorPlane vp):
@@ -396,6 +397,7 @@
                     if temp > extrema[3]: extrema[3] = temp
         #print extrema[0], extrema[1], extrema[2], extrema[3]
 
+    @cython.cdivision(True)
     @cython.boundscheck(False)
     @cython.wraparound(False)
     cdef int integrate_ray(self, np.float64_t v_pos[3],
@@ -507,6 +509,7 @@
             if enter_t > 1.0: break
         return hit
 
+    @cython.cdivision(True)
     @cython.boundscheck(False)
     @cython.wraparound(False)
     cdef void sample_values(self,
diff -r f6dc5b4ba882 -r 1b7a519066fb yt/utilities/definitions.py
--- a/yt/utilities/definitions.py	Thu Nov 11 22:12:19 2010 -0800
+++ b/yt/utilities/definitions.py	Tue Nov 16 13:45:54 2010 -0700
@@ -41,8 +41,7 @@
 x_names = ['y','x','x']
 y_names = ['z','z','y']
 
-# All the parameters we read from the parameter file, along with how to convert
-# them from a string
+# How many of each thing are in an Mpc
 mpc_conversion = {'mpc'   : 1e0,
                   'kpc'   : 1e3,
                   'pc'    : 1e6,
diff -r f6dc5b4ba882 -r 1b7a519066fb yt/visualization/volume_rendering/grid_partitioner.py
--- a/yt/visualization/volume_rendering/grid_partitioner.py	Thu Nov 11 22:12:19 2010 -0800
+++ b/yt/visualization/volume_rendering/grid_partitioner.py	Tue Nov 16 13:45:54 2010 -0700
@@ -182,6 +182,25 @@
     def reset_cast(self):
         pass
 
+class SingleBrickVolume(object):
+    bricks = None
+    def __init__(self, data_array):
+        self.bricks = [PartitionedGrid(-1, 1, 
+                       [data_array.astype("float64")],
+                       na.zeros(3, dtype='float64'),
+                       na.ones(3, dtype='float64'),
+                       na.array(data_array.shape, dtype='int64')-1)]
+        self.brick_dimensions = na.ones((1, 3), dtype='int64')*data_array.shape
+
+    def initialize_source(self):
+        pass
+
+    def traverse(self, back, front):
+        for b in self.bricks: yield b
+
+    def reset_cast(self):
+        pass
+
 class HomogenizedBrickCollection(DistributedObjectCollection):
     def __init__(self, source):
         # The idea here is that we have two sources -- the global_domain



More information about the yt-svn mailing list