[Yt-svn] yt: First attempt at infinite opacity.

hg at spacepope.org hg at spacepope.org
Wed Feb 2 20:21:10 PST 2011


hg Repository: yt
details:   yt/rev/01afdaebaaa2
changeset: 3711:01afdaebaaa2
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Feb 02 22:41:09 2011 -0500
description:
First attempt at infinite opacity.

diffstat:

 yt/utilities/_amr_utils/VolumeIntegrator.pyx |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (41 lines):

diff -r c506b3b5d5c3 -r 01afdaebaaa2 yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Wed Feb 02 21:17:11 2011 -0500
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Wed Feb 02 22:41:09 2011 -0500
@@ -126,15 +126,17 @@
 
 cdef np.float64_t FIT_get_value(FieldInterpolationTable *fit,
                             np.float64_t *dvs):
-    cdef np.float64_t bv, dy, dd, tf
+    cdef np.float64_t bv, dy, dd, tf, bp
     cdef int bin_id
     if fit.pass_through == 1: return dvs[fit.field_id]
     if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0
     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
     if bin_id < 0 or bin_id + 2 > fit.nbins: return 0.0
     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
+    bp = fit.values[bin_id + 1]
+    if bp < 0.0: return bp
     bv = fit.values[bin_id]
-    dy = fit.values[bin_id + 1] - bv
+    dy = bp - bv
     if fit.weight_field_id != -1:
         return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)
     return (bv + dd*dy*fit.idbin)
@@ -220,6 +222,7 @@
         # We have to do this after the interpolation
         for i in range(self.n_field_tables):
             fid = self.field_tables[i].weight_table_id
+            if self.istorage[fid] < 0.0: continue
             if fid != -1: self.istorage[i] *= self.istorage[fid]
         for i in range(6):
             trgba[i] = self.istorage[self.field_table_ids[i]]
@@ -236,6 +239,9 @@
             # This is the new way: alpha corresponds to opacity of a given
             # slice.  Previously it was ill-defined, but represented some
             # measure of emissivity.
+            if trgba[i+3] < 0.0:
+                rgba[i] = trgba[i]
+                continue
             ta = fmax((1.0 - dt*trgba[i+3]), 0.0)
             rgba[i  ] = dt*trgba[i  ] + ta * rgba[i  ]
             #rgba[i+3] = dt*trgba[i+3] + ta * rgba[i+3]



More information about the yt-svn mailing list