<html><body>
<p>1 new commit in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/179a73a7e7f4/">https://bitbucket.org/yt_analysis/yt/commits/179a73a7e7f4/</a> Changeset:   179a73a7e7f4 Branch:      yt User:        ngoldbaum Date:        2016-04-05 22:43:02+00:00 Summary:     Merged in xarthisius/yt (pull request #2109)</p>
<p>[opt] Precompute distances between bins in FieldInterpolationTables Affected #:  2 files</p>
<p>diff -r 8445fdf5ae15434505312ef1616d910f1becb07b -r 179a73a7e7f479572d0b9039feee73f75360fd3d yt/utilities/lib/field_interpolation_tables.pxd --- a/yt/utilities/lib/field_interpolation_tables.pxd +++ b/yt/utilities/lib/field_interpolation_tables.pxd @@ -16,6 +16,7 @@</p>
<pre>cimport cython
cimport numpy as np
from yt.utilities.lib.fp_utils cimport imax, fmax, imin, fmin, iclip, fclip, fabs</pre>
<p>+from libc.stdlib cimport malloc</p>
<pre>DEF Nch = 4
</pre>
<p>@@ -26,6 +27,8 @@</p>
<pre>np.float64_t bounds[2]
np.float64_t dbin
np.float64_t idbin</pre>
<p>+    np.float64_t *d0 +    np.float64_t *dy</p>
<pre>int field_id
int weight_field_id
int weight_table_id</pre>
<p>@@ -41,12 +44,18 @@</p>
<pre>cdef inline void FIT_initialize_table(FieldInterpolationTable *fit, int nbins,
              np.float64_t *values, np.float64_t bounds1, np.float64_t bounds2,
              int field_id, int weight_field_id, int weight_table_id) nogil:</pre>
<p>+    cdef int i</p>
<pre>fit.bounds[0] = bounds1; fit.bounds[1] = bounds2
fit.nbins = nbins
fit.dbin = (fit.bounds[1] - fit.bounds[0])/(fit.nbins-1)
fit.idbin = 1.0/fit.dbin
# Better not pull this out from under us, yo
fit.values = values</pre>
<p>+    fit.d0 = <np.float64_t *> malloc(sizeof(np.float64_t) * nbins) +    fit.dy = <np.float64_t *> malloc(sizeof(np.float64_t) * nbins) +    for i in range(nbins-1): +        fit.d0[i] = fit.bounds[0] + i * fit.dbin +        fit.dy[i] = (fit.values[i + 1] – fit.values[i]) * fit.idbin</p>
<pre>fit.field_id = field_id
fit.weight_field_id = weight_field_id
fit.weight_table_id = weight_table_id</pre>
<p>@@ -56,18 +65,18 @@</p>
<pre>@cython.cdivision(True)
cdef inline np.float64_t FIT_get_value(FieldInterpolationTable *fit,
                                       np.float64_t dvs[6]) nogil:</pre>
<ul><li><p>cdef np.float64_t bv, dy, dd</p></li></ul>
<p>+    cdef np.float64_t dd, dout</p>
<pre>cdef int bin_id
if dvs[fit.field_id] >= fit.bounds[1] or dvs[fit.field_id] <= fit.bounds[0]: return 0.0
if not isnormal(dvs[fit.field_id]): return 0.0
bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
bin_id = iclip(bin_id, 0, fit.nbins-2)</pre>
<ul><li><p>dd = dvs[fit.field_id] – (fit.bounds[0] + bin_id * fit.dbin) # x – x0</p></li>
<li><p>bv = fit.values[bin_id]</p></li>
<li><p>dy = fit.values[bin_id + 1] – bv</p></li></ul>
<p>+ +    dd = dvs[fit.field_id] – fit.d0[bin_id] # x – x0 +    dout = fit.values[bin_id] + dd * fit.dy[bin_id]</p>
<pre>if fit.weight_field_id != -1:</pre>
<ul><li><p>return dvs[fit.weight_field_id] * (bv + dd*dy*fit.idbin)</p></li>
<li><p>return (bv + dd*dy*fit.idbin)</p></li></ul>
<p>+        dout *= dvs[fit.weight_field_id] +    return dout</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)</pre>
<p>diff -r 8445fdf5ae15434505312ef1616d910f1becb07b -r 179a73a7e7f479572d0b9039feee73f75360fd3d yt/utilities/lib/grid_traversal.pyx --- a/yt/utilities/lib/grid_traversal.pyx +++ b/yt/utilities/lib/grid_traversal.pyx @@ -844,9 +844,11 @@</p>
<pre>            self.sampler = volume_render_stars_sampler

    def __dealloc__(self):</pre>
<ul><li><p>return</p></li>
<li><p>#free(self.vra.fits)</p></li>
<li><p>#free(self.vra)</p></li></ul>
<p>+        for i in range(self.vra.n_fits): +            free(self.vra.fits[i].d0) +            free(self.vra.fits[i].dy) +        free(self.vra.fits) +        free(self.vra)</p>
<pre>cdef class LightSourceRenderSampler(ImageSampler):
    cdef VolumeRenderAccumulator *vra</pre>
<p>@@ -905,11 +907,13 @@</p>
<pre>        self.sampler = volume_render_gradient_sampler

    def __dealloc__(self):</pre>
<ul><li><p>return</p></li>
<li><p>#free(self.vra.fits)</p></li>
<li><p>#free(self.vra)</p></li>
<li><p>#free(self.light_dir)</p></li>
<li><p>#free(self.light_rgba)</p></li></ul>
<p>+        for i in range(self.vra.n_fits): +            free(self.vra.fits[i].d0) +            free(self.vra.fits[i].dy) +        free(self.vra.light_dir) +        free(self.vra.light_rgba) +        free(self.vra.fits) +        free(self.vra)</p>
<pre>@cython.boundscheck(False)</pre>
<p>Repository URL: <a href="https://bitbucket.org/yt_analysis/yt/">https://bitbucket.org/yt_analysis/yt/</a></p>
<p>—</p>
<p>This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.</p>

<img src="http://link.bitbucket.org/wf/open?upn=ll4ctv0L-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27Ao5tUEqr2SnzfG7T6qFKaWLWMRlQ6CwpJsbxV4abJv7Zq4yqQ0b1BxKMJpFyJgjPUR2ekeE-2FKwLNWInEkUymJ06jrzN0AyGxUtbQBm2gyGGwRg8Lnm5HW9f5qHMsYlb64WMtJkQkPj-2B9fuJePy4e5V2XMyPcqDRcy3zEjjIbJfLVD-2BW0tIpKInaOBsnT-2Fh2QQ-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>