<html><body>
<p>7 new commits in yt:</p>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/01863f3b866c/">https://bitbucket.org/yt_analysis/yt/commits/01863f3b866c/</a> Changeset: 01863f3b866c Branch: yt User: atmyers Date: 2016-03-28 18:34:33+00:00 Summary: use fused_types to avoid duplicating vector operations for float and double Affected #: 1 file</p>
<p>diff -r be993079427c300e09b4b6430e3c8d90af0c3500 -r 01863f3b866c435bc0a0a79cb62decf4ac5ec7df yt/utilities/lib/vec3_ops.pxd --- a/yt/utilities/lib/vec3_ops.pxd +++ b/yt/utilities/lib/vec3_ops.pxd @@ -3,20 +3,26 @@</p>
<pre>cimport numpy as np
from libc.math cimport sqrt
</pre>
<p>-@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True) -cdef inline np.float64_t dot(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3]) nogil:</p></li>
<li><p>return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]</p></li></ul>
<p>+ +ctypedef fused Real: + np.float32_t + np.float64_t</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void cross(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline Real dot(const Real[3] a, + const Real[3] b) nogil: + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + + +@cython.boundscheck(False) +@cython.wraparound(False) +@cython.cdivision(True) +cdef inline void cross(const Real[3] a, + const Real[3] b, + Real c[3]) nogil:</p>
<pre>c[0] = a[1]*b[2] - a[2]*b[1]
c[1] = a[2]*b[0] - a[0]*b[2]
c[2] = a[0]*b[1] - a[1]*b[0]</pre>
<p>@@ -25,26 +31,28 @@</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void subtract(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline void subtract(const Real[3] a, + const Real[3] b, + Real c[3]) nogil:</p>
<pre> c[0] = a[0] - b[0]
c[1] = a[1] - b[1]
c[2] = a[2] - b[2]
</pre>
<p>+</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void fma(const np.float64_t f,</p>
<ul><li><p>const np.float64_t a[3],</p></li>
<li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline void fma(const Real f, + const Real[3] a, + const Real[3] b, + Real[3] c) nogil:</p>
<pre> c[0] = f * a[0] + b[0]
c[1] = f * a[1] + b[1]
c[2] = f * a[2] + b[2]
</pre>
<p>+</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline np.float64_t L2_norm(const np.float64_t a[3]) nogil: +cdef inline Real L2_norm(const Real[3] a) nogil:</p>
<pre>return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/7b64013cf225/">https://bitbucket.org/yt_analysis/yt/commits/7b64013cf225/</a> Changeset: 7b64013cf225 Branch: yt User: atmyers Date: 2016-03-28 18:35:08+00:00 Summary: add another vec3 op for computing the distance. Affected #: 1 file</p>
<p>diff -r 01863f3b866c435bc0a0a79cb62decf4ac5ec7df -r 7b64013cf2256b46c5816fed3177bd00e7723967 yt/utilities/lib/vec3_ops.pxd --- a/yt/utilities/lib/vec3_ops.pxd +++ b/yt/utilities/lib/vec3_ops.pxd @@ -42,6 +42,14 @@</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>+cdef inline Real distance(const Real[3] a, + const Real[3] b) nogil: + return sqrt((a[0] – b[0])**2 + (a[1] – b[1])**2 +(a[2] – b[2])**2) + + +@cython.boundscheck(False) +@cython.wraparound(False) +@cython.cdivision(True)</p>
<pre>cdef inline void fma(const Real f,
const Real[3] a,
const Real[3] b,</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/944afa850bfa/">https://bitbucket.org/yt_analysis/yt/commits/944afa850bfa/</a> Changeset: 944afa850bfa Branch: yt User: atmyers Date: 2016-03-28 18:35:44+00:00 Summary: use the vec3 operations in mesh_intersection Affected #: 1 file</p>
<p>diff -r 7b64013cf2256b46c5816fed3177bd00e7723967 -r 944afa850bfaba406dcc0afe865182121e13b6b5 yt/utilities/lib/mesh_intersection.pyx --- a/yt/utilities/lib/mesh_intersection.pyx +++ b/yt/utilities/lib/mesh_intersection.pyx @@ -21,6 +21,7 @@</p>
<pre>cimport cython
from libc.math cimport fabs, fmin, fmax, sqrt
from yt.utilities.lib.mesh_samplers cimport sample_hex20</pre>
<p>+from vec3_ops cimport dot, subtract, cross, distance</p>
<pre>@cython.boundscheck(False)</pre>
<p>@@ -80,30 +81,6 @@</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef float dot(const float* a,</p>
<ul><li><p>const float* b,</p></li>
<li><p>size_t N) nogil:</p></li>
<li><p>cdef int i</p></li>
<li><p>cdef float rv = 0.0</p></li>
<li><p>for i in range(N):</p></li>
<li><p>rv += a[i]*b[i]</p></li>
<li><p>return rv</p></li></ul>
<p>– – -@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True) -cdef void cross(const float* a,</p>
<ul><li><p>const float* b,</p></li>
<li><p>float* c) nogil:</p></li>
<li><p>c[0] = a[1]*b[2] – a[2]*b[1]</p></li>
<li><p>c[1] = a[2]*b[0] – a[0]*b[2]</p></li>
<li><p>c[2] = a[0]*b[1] – a[1]*b[0]</p></li></ul>
<p>– – -@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True)</p>
<pre>cdef void patchBoundsFunc(Patch* patches,
size_t item,
rtcg.RTCBounds* bounds_o) nogil:</pre>
<p>@@ -146,7 +123,7 @@</p>
<pre># first we compute the two planes that define the ray.
cdef float[3] n, N1, N2</pre>
<ul><li><p>cdef float A = dot(ray.dir, ray.dir, 3)</p></li></ul>
<p>+ cdef float A = dot(ray.dir, ray.dir)</p>
<pre> for i in range(3):
n[i] = ray.dir[i] / A
</pre>
<p>@@ -160,16 +137,16 @@</p>
<pre> N1[2] =-n[1]
cross(N1, n, N2)
</pre>
<ul><li><p>cdef float d1 = -dot(N1, ray.org, 3)</p></li>
<li><p>cdef float d2 = -dot(N2, ray.org, 3)</p></li></ul>
<p>+ cdef float d1 = -dot(N1, ray.org) + cdef float d2 = -dot(N2, ray.org)</p>
<pre># the initial guess is set to zero
cdef float u = 0.0
cdef float v = 0.0
cdef float[3] S
patchSurfaceFunc(patch, u, v, S)</pre>
<ul><li><p>cdef float fu = dot(N1, S, 3) + d1</p></li>
<li><p>cdef float fv = dot(N2, S, 3) + d2</p></li></ul>
<p>+ cdef float fu = dot(N1, S) + d1 + cdef float fv = dot(N2, S) + d2</p>
<pre>cdef float err = fmax(fabs(fu), fabs(fv))
# begin Newton interation</pre>
<p>@@ -183,10 +160,10 @@</p>
<pre># compute the Jacobian
patchSurfaceDerivU(patch, u, v, Su)
patchSurfaceDerivV(patch, u, v, Sv)</pre>
<ul><li><p>J11 = dot(N1, Su, 3)</p></li>
<li><p>J12 = dot(N1, Sv, 3)</p></li>
<li><p>J21 = dot(N2, Su, 3)</p></li>
<li><p>J22 = dot(N2, Sv, 3)</p></li></ul>
<p>+ J11 = dot(N1, Su) + J12 = dot(N1, Sv) + J21 = dot(N2, Su) + J22 = dot(N2, Sv)</p>
<pre>det = (J11*J22 - J12*J21)
# update the u, v values</pre>
<p>@@ -194,17 +171,14 @@</p>
<pre>v -= (-J21*fu + J11*fv) / det
patchSurfaceFunc(patch, u, v, S)</pre>
<ul><li><p>fu = dot(N1, S, 3) + d1</p></li>
<li><p>fv = dot(N2, S, 3) + d2</p></li></ul>
<p>+ fu = dot(N1, S) + d1 + fv = dot(N2, S) + d2</p>
<pre> err = fmax(fabs(fu), fabs(fv))
iterations += 1
# t is the distance along the ray to this hit</pre>
<ul><li><p>cdef float t = 0.0</p></li>
<li><p>for i in range(3):</p></li>
<li><p>t += (S[i] – ray.org[i])**2</p></li>
<li><p>t = sqrt(t)</p></li></ul>
<p>+ cdef float t = distance(S, ray.org)</p>
<pre># only count this is it's the closest hit
if (t < ray.tnear or t > ray.Ng[0]):</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/97e38434c77b/">https://bitbucket.org/yt_analysis/yt/commits/97e38434c77b/</a> Changeset: 97e38434c77b Branch: yt User: atmyers Date: 2016-03-28 18:36:06+00:00 Summary: also use the vec3 ops in pixelization routines Affected #: 1 file</p>
<p>diff -r 944afa850bfaba406dcc0afe865182121e13b6b5 -r 97e38434c77ba51dbc882bdcaeccb91bd0cf6524 yt/utilities/lib/pixelization_routines.pyx --- a/yt/utilities/lib/pixelization_routines.pyx +++ b/yt/utilities/lib/pixelization_routines.pyx @@ -20,6 +20,7 @@</p>
<pre>from yt.utilities.lib.fp_utils cimport fmin, fmax, i64min, i64max, imin, imax, fabs
from yt.utilities.exceptions import YTPixelizeError, \
YTElementTypeNotRecognized</pre>
<p>+from vec3_ops cimport dot, cross, subtract</p>
<pre>from yt.utilities.lib.element_mappings cimport \
ElementSampler, \
P1Sampler3D, \</pre>
<p>@@ -502,17 +503,11 @@</p>
<pre>vi2a = faces[n][1][0]
vi2b = faces[n][1][1]
# Shared vertex is vi1a and vi2a</pre>
<ul><li><p>for i in range(3):</p></li>
<li><p>vec1[i] = vertices[vi1b][i] – vertices[vi1a][i]</p></li>
<li><p>vec2[i] = vertices[vi2b][i] – vertices[vi2a][i]</p></li>
<li><p>npoint[i] = point[i] – vertices[vi1b][i]</p></li>
<li><p># Now the cross product of vec1 x vec2</p></li>
<li><p>cp_vec[0] = vec1[1] * vec2[2] – vec1[2] * vec2[1]</p></li>
<li><p>cp_vec[1] = vec1[2] * vec2[0] – vec1[0] * vec2[2]</p></li>
<li><p>cp_vec[2] = vec1[0] * vec2[1] – vec1[1] * vec2[0]</p></li>
<li><p>dp = 0.0</p></li>
<li><p>for j in range(3):</p></li>
<li><p>dp += cp_vec[j] * npoint[j]</p></li></ul>
<p>+ subtract(vertices[vi1b], vertices[vi1a], vec1) + subtract(vertices[vi2b], vertices[vi2a], vec2) + subtract(point, vertices[vi1b], npoint) + cross(vec1, vec2, cp_vec) + dp = dot(cp_vec, npoint)</p>
<pre> if match == 0:
if dp < 0:
signs[n] = -1</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/90bd9a19d81d/">https://bitbucket.org/yt_analysis/yt/commits/90bd9a19d81d/</a> Changeset: 90bd9a19d81d Branch: yt User: atmyers Date: 2016-03-28 19:18:20+00:00 Summary: can actually just use the built-in fused type cython.floating instead of making my own Real type Affected #: 1 file</p>
<p>diff -r 97e38434c77ba51dbc882bdcaeccb91bd0cf6524 -r 90bd9a19d81d11fd3139e23bb683cbdd382e6f80 yt/utilities/lib/vec3_ops.pxd --- a/yt/utilities/lib/vec3_ops.pxd +++ b/yt/utilities/lib/vec3_ops.pxd @@ -1,66 +1,62 @@</p>
<pre>cimport cython</pre>
<p>+cimport cython.floating</p>
<pre>import numpy as np
cimport numpy as np
from libc.math cimport sqrt
</pre>
<p>-ctypedef fused Real:</p>
<ul><li><p>np.float32_t</p></li>
<li><p>np.float64_t</p></li></ul>
<p>+@cython.boundscheck(False) +@cython.wraparound(False) +@cython.cdivision(True) +cdef inline cython.floating dot(const cython.floating[3] a, + const cython.floating[3] b) nogil: + return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline Real dot(const Real[3] a,</p>
<ul><li><p>const Real[3] b) nogil:</p></li>
<li><p>return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]</p></li></ul>
<p>+cdef inline void cross(const cython.floating[3] a, + const cython.floating[3] b, + cython.floating c[3]) nogil: + c[0] = a[1]*b[2] – a[2]*b[1] + c[1] = a[2]*b[0] – a[0]*b[2] + c[2] = a[0]*b[1] – a[1]*b[0]</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void cross(const Real[3] a,</p>
<ul><li><p>const Real[3] b,</p></li>
<li><p>Real c[3]) nogil:</p></li>
<li><p>c[0] = a[1]*b[2] – a[2]*b[1]</p></li>
<li><p>c[1] = a[2]*b[0] – a[0]*b[2]</p></li>
<li><p>c[2] = a[0]*b[1] – a[1]*b[0]</p></li></ul>
<p>+cdef inline void subtract(const cython.floating[3] a, + const cython.floating[3] b, + cython.floating c[3]) nogil: + c[0] = a[0] – b[0] + c[1] = a[1] – b[1] + c[2] = a[2] – b[2]</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void subtract(const Real[3] a,</p>
<ul><li><p>const Real[3] b,</p></li>
<li><p>Real c[3]) nogil:</p></li>
<li><p>c[0] = a[0] – b[0]</p></li>
<li><p>c[1] = a[1] – b[1]</p></li>
<li><p>c[2] = a[2] – b[2]</p></li></ul>
<p>+cdef inline cython.floating distance(const cython.floating[3] a, + const cython.floating[3] b) nogil: + return sqrt((a[0] – b[0])**2 + (a[1] – b[1])**2 +(a[2] – b[2])**2)</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline Real distance(const Real[3] a,</p>
<ul><li><p>const Real[3] b) nogil:</p></li>
<li><p>return sqrt((a[0] – b[0])**2 + (a[1] – b[1])**2 +(a[2] – b[2])**2)</p></li></ul>
<p>+cdef inline void fma(const cython.floating f, + const cython.floating[3] a, + const cython.floating[3] b, + cython.floating[3] c) nogil: + c[0] = f * a[0] + b[0] + c[1] = f * a[1] + b[1] + c[2] = f * a[2] + b[2]</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void fma(const Real f,</p>
<ul><li><p>const Real[3] a,</p></li>
<li><p>const Real[3] b,</p></li>
<li><p>Real[3] c) nogil:</p></li>
<li><p>c[0] = f * a[0] + b[0]</p></li>
<li><p>c[1] = f * a[1] + b[1]</p></li>
<li><p>c[2] = f * a[2] + b[2]</p></li></ul>
<p>– – -@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True) -cdef inline Real L2_norm(const Real[3] a) nogil: +cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:</p>
<pre>return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/647083f43a91/">https://bitbucket.org/yt_analysis/yt/commits/647083f43a91/</a> Changeset: 647083f43a91 Branch: yt User: atmyers Date: 2016-03-28 19:54:19+00:00 Summary: remove the now-unused import of numpy Affected #: 1 file</p>
<p>diff -r 90bd9a19d81d11fd3139e23bb683cbdd382e6f80 -r 647083f43a91b7dcc9e51b9220a64de4197abc1e yt/utilities/lib/vec3_ops.pxd --- a/yt/utilities/lib/vec3_ops.pxd +++ b/yt/utilities/lib/vec3_ops.pxd @@ -1,7 +1,5 @@</p>
<pre>cimport cython
cimport cython.floating</pre>
<p>-import numpy as np -cimport numpy as np</p>
<pre>from libc.math cimport sqrt
</pre>
<p><a href="https://bitbucket.org/yt_analysis/yt/commits/47bf935396cb/">https://bitbucket.org/yt_analysis/yt/commits/47bf935396cb/</a> Changeset: 47bf935396cb Branch: yt User: ngoldbaum Date: 2016-04-06 18:25:44+00:00 Summary: Merged in atmyers/yt (pull request #2091)</p>
<p>Use Cython fused types to avoid duplicating functions for float and double. Affected #: 3 files</p>
<p>diff -r 0157f4cbca3c05129132f83fb1a8ad9d61084b8d -r 47bf935396cbd394791ae4c838d48f3e3a453c92 yt/utilities/lib/mesh_intersection.pyx --- a/yt/utilities/lib/mesh_intersection.pyx +++ b/yt/utilities/lib/mesh_intersection.pyx @@ -21,6 +21,7 @@</p>
<pre>cimport cython
from libc.math cimport fabs, fmin, fmax, sqrt
from yt.utilities.lib.mesh_samplers cimport sample_hex20</pre>
<p>+from vec3_ops cimport dot, subtract, cross, distance</p>
<pre>@cython.boundscheck(False)</pre>
<p>@@ -80,30 +81,6 @@</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef float dot(const float* a,</p>
<ul><li><p>const float* b,</p></li>
<li><p>size_t N) nogil:</p></li>
<li><p>cdef int i</p></li>
<li><p>cdef float rv = 0.0</p></li>
<li><p>for i in range(N):</p></li>
<li><p>rv += a[i]*b[i]</p></li>
<li><p>return rv</p></li></ul>
<p>– – -@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True) -cdef void cross(const float* a,</p>
<ul><li><p>const float* b,</p></li>
<li><p>float* c) nogil:</p></li>
<li><p>c[0] = a[1]*b[2] – a[2]*b[1]</p></li>
<li><p>c[1] = a[2]*b[0] – a[0]*b[2]</p></li>
<li><p>c[2] = a[0]*b[1] – a[1]*b[0]</p></li></ul>
<p>– – -@cython.boundscheck(False) -@cython.wraparound(False) -@cython.cdivision(True)</p>
<pre>cdef void patchBoundsFunc(Patch* patches,
size_t item,
rtcg.RTCBounds* bounds_o) nogil:</pre>
<p>@@ -146,7 +123,7 @@</p>
<pre># first we compute the two planes that define the ray.
cdef float[3] n, N1, N2</pre>
<ul><li><p>cdef float A = dot(ray.dir, ray.dir, 3)</p></li></ul>
<p>+ cdef float A = dot(ray.dir, ray.dir)</p>
<pre> for i in range(3):
n[i] = ray.dir[i] / A
</pre>
<p>@@ -160,16 +137,16 @@</p>
<pre> N1[2] =-n[1]
cross(N1, n, N2)
</pre>
<ul><li><p>cdef float d1 = -dot(N1, ray.org, 3)</p></li>
<li><p>cdef float d2 = -dot(N2, ray.org, 3)</p></li></ul>
<p>+ cdef float d1 = -dot(N1, ray.org) + cdef float d2 = -dot(N2, ray.org)</p>
<pre># the initial guess is set to zero
cdef float u = 0.0
cdef float v = 0.0
cdef float[3] S
patchSurfaceFunc(patch, u, v, S)</pre>
<ul><li><p>cdef float fu = dot(N1, S, 3) + d1</p></li>
<li><p>cdef float fv = dot(N2, S, 3) + d2</p></li></ul>
<p>+ cdef float fu = dot(N1, S) + d1 + cdef float fv = dot(N2, S) + d2</p>
<pre>cdef float err = fmax(fabs(fu), fabs(fv))
# begin Newton interation</pre>
<p>@@ -183,10 +160,10 @@</p>
<pre># compute the Jacobian
patchSurfaceDerivU(patch, u, v, Su)
patchSurfaceDerivV(patch, u, v, Sv)</pre>
<ul><li><p>J11 = dot(N1, Su, 3)</p></li>
<li><p>J12 = dot(N1, Sv, 3)</p></li>
<li><p>J21 = dot(N2, Su, 3)</p></li>
<li><p>J22 = dot(N2, Sv, 3)</p></li></ul>
<p>+ J11 = dot(N1, Su) + J12 = dot(N1, Sv) + J21 = dot(N2, Su) + J22 = dot(N2, Sv)</p>
<pre>det = (J11*J22 - J12*J21)
# update the u, v values</pre>
<p>@@ -194,17 +171,14 @@</p>
<pre>v -= (-J21*fu + J11*fv) / det
patchSurfaceFunc(patch, u, v, S)</pre>
<ul><li><p>fu = dot(N1, S, 3) + d1</p></li>
<li><p>fv = dot(N2, S, 3) + d2</p></li></ul>
<p>+ fu = dot(N1, S) + d1 + fv = dot(N2, S) + d2</p>
<pre> err = fmax(fabs(fu), fabs(fv))
iterations += 1
# t is the distance along the ray to this hit</pre>
<ul><li><p>cdef float t = 0.0</p></li>
<li><p>for i in range(3):</p></li>
<li><p>t += (S[i] – ray.org[i])**2</p></li>
<li><p>t = sqrt(t)</p></li></ul>
<p>+ cdef float t = distance(S, ray.org)</p>
<pre># only count this is it's the closest hit
if (t < ray.tnear or t > ray.Ng[0]):</pre>
<p>diff -r 0157f4cbca3c05129132f83fb1a8ad9d61084b8d -r 47bf935396cbd394791ae4c838d48f3e3a453c92 yt/utilities/lib/pixelization_routines.pyx --- a/yt/utilities/lib/pixelization_routines.pyx +++ b/yt/utilities/lib/pixelization_routines.pyx @@ -20,6 +20,7 @@</p>
<pre>from yt.utilities.lib.fp_utils cimport fmin, fmax, i64min, i64max, imin, imax, fabs
from yt.utilities.exceptions import YTPixelizeError, \
YTElementTypeNotRecognized</pre>
<p>+from vec3_ops cimport dot, cross, subtract</p>
<pre>from yt.utilities.lib.element_mappings cimport \
ElementSampler, \
P1Sampler3D, \</pre>
<p>@@ -520,17 +521,11 @@</p>
<pre>vi2a = faces[n][1][0]
vi2b = faces[n][1][1]
# Shared vertex is vi1a and vi2a</pre>
<ul><li><p>for i in range(3):</p></li>
<li><p>vec1[i] = vertices[vi1b][i] – vertices[vi1a][i]</p></li>
<li><p>vec2[i] = vertices[vi2b][i] – vertices[vi2a][i]</p></li>
<li><p>npoint[i] = point[i] – vertices[vi1b][i]</p></li>
<li><p># Now the cross product of vec1 x vec2</p></li>
<li><p>cp_vec[0] = vec1[1] * vec2[2] – vec1[2] * vec2[1]</p></li>
<li><p>cp_vec[1] = vec1[2] * vec2[0] – vec1[0] * vec2[2]</p></li>
<li><p>cp_vec[2] = vec1[0] * vec2[1] – vec1[1] * vec2[0]</p></li>
<li><p>dp = 0.0</p></li>
<li><p>for j in range(3):</p></li>
<li><p>dp += cp_vec[j] * npoint[j]</p></li></ul>
<p>+ subtract(vertices[vi1b], vertices[vi1a], vec1) + subtract(vertices[vi2b], vertices[vi2a], vec2) + subtract(point, vertices[vi1b], npoint) + cross(vec1, vec2, cp_vec) + dp = dot(cp_vec, npoint)</p>
<pre> if match == 0:
if dp < 0:
signs[n] = -1</pre>
<p>diff -r 0157f4cbca3c05129132f83fb1a8ad9d61084b8d -r 47bf935396cbd394791ae4c838d48f3e3a453c92 yt/utilities/lib/vec3_ops.pxd --- a/yt/utilities/lib/vec3_ops.pxd +++ b/yt/utilities/lib/vec3_ops.pxd @@ -1,22 +1,22 @@</p>
<pre>cimport cython</pre>
<p>-import numpy as np -cimport numpy as np +cimport cython.floating</p>
<pre>from libc.math cimport sqrt
</pre>
<p>+</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline np.float64_t dot(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3]) nogil:</p></li></ul>
<p>+cdef inline cython.floating dot(const cython.floating[3] a, + const cython.floating[3] b) nogil:</p>
<pre> return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void cross(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline void cross(const cython.floating[3] a, + const cython.floating[3] b, + cython.floating c[3]) nogil:</p>
<pre>c[0] = a[1]*b[2] - a[2]*b[1]
c[1] = a[2]*b[0] - a[0]*b[2]
c[2] = a[0]*b[1] - a[1]*b[0]</pre>
<p>@@ -25,26 +25,36 @@</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void subtract(const np.float64_t a[3],</p>
<ul><li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline void subtract(const cython.floating[3] a, + const cython.floating[3] b, + cython.floating c[3]) nogil:</p>
<pre> c[0] = a[0] - b[0]
c[1] = a[1] - b[1]
c[2] = a[2] - b[2]
</pre>
<p>+</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline void fma(const np.float64_t f,</p>
<ul><li><p>const np.float64_t a[3],</p></li>
<li><p>const np.float64_t b[3],</p></li>
<li><p>np.float64_t c[3]) nogil:</p></li></ul>
<p>+cdef inline cython.floating distance(const cython.floating[3] a, + const cython.floating[3] b) nogil: + return sqrt((a[0] – b[0])**2 + (a[1] – b[1])**2 +(a[2] – b[2])**2) + + +@cython.boundscheck(False) +@cython.wraparound(False) +@cython.cdivision(True) +cdef inline void fma(const cython.floating f, + const cython.floating[3] a, + const cython.floating[3] b, + cython.floating[3] c) nogil:</p>
<pre> c[0] = f * a[0] + b[0]
c[1] = f * a[1] + b[1]
c[2] = f * a[2] + b[2]
</pre>
<p>+</p>
<pre>@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)</pre>
<p>-cdef inline np.float64_t L2_norm(const np.float64_t a[3]) nogil: +cdef inline cython.floating L2_norm(const cython.floating[3] a) nogil:</p>
<pre>return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])</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-2ByeRZFC1LslHcg6aJmnQ70VruLbmeLQr27AJJ-2FWtYGDZMozvzCetz4g9gnTEMfr5ldVlpQdgkfG7PGJyI7r-2F9Pr5cszShVL6fiQP3aVbnUEg7QENf11NjOQ55l-2BJkS7kf0Veq73oXDcxMnTie79jAQ0rXwwYND-2BHqZ3TX96udbE0h134bQ0yGd88Cr42QtIii-2BbtbeGq0tyH1DnkKZTD9VwkucbowE1-2F8IA-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>