[yt-svn] commit/yt: MatthewTurk: Merged in jzuhone/yt-windows (pull request #2196)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu May 26 06:14:47 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/2af65e3224d6/
Changeset:   2af65e3224d6
Branch:      yt
User:        MatthewTurk
Date:        2016-05-26 13:14:39+00:00
Summary:     Merged in jzuhone/yt-windows (pull request #2196)

Appveyor CI for yt, getting Windows tests to pass
Affected #:  6 files

diff -r f18feeb0dd6163476732e6a4d85447b8c117a0d1 -r 2af65e3224d6ad7d4f6c50566410d1a30cd797dc appveyor.yml
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,38 @@
+# AppVeyor.com is a Continuous Integration service to build and run tests under
+# Windows
+
+environment:
+
+  global:
+      PYTHON: "C:\\Miniconda-x64"
+
+  matrix:
+
+      - PYTHON_VERSION: "2.7"
+
+      - PYTHON_VERSION: "3.5"
+
+
+platform:
+    -x64
+
+install:
+    - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
+
+    # Install the build and runtime dependencies of the project.
+    # Create a conda environment
+    - "conda create -q --yes -n test python=%PYTHON_VERSION%"
+    - "activate test"
+
+    # Check that we have the expected version of Python
+    - "python --version"
+
+    # Install specified version of numpy and dependencies
+    - "conda install -q --yes numpy nose setuptools ipython Cython sympy h5py matplotlib"
+    - "python setup.py develop"
+
+# Not a .NET project
+build: false
+
+test_script:
+  - "nosetests -e test_all_fields ."

diff -r f18feeb0dd6163476732e6a4d85447b8c117a0d1 -r 2af65e3224d6ad7d4f6c50566410d1a30cd797dc yt/geometry/grid_visitors.pxd
--- a/yt/geometry/grid_visitors.pxd
+++ b/yt/geometry/grid_visitors.pxd
@@ -17,36 +17,36 @@
 cimport numpy as np
 
 cdef struct GridTreeNode:
-    int num_children
-    int level
+    np.int32_t num_children
+    np.int32_t level
     np.int64_t index
     np.float64_t left_edge[3]
     np.float64_t right_edge[3]
     GridTreeNode **children
     np.int64_t start_index[3]
-    int dims[3]
+    np.int32_t dims[3]
     np.float64_t dds[3]
 
 cdef struct GridTreeNodePadded:
-    int num_children
-    int level
-    long int index
-    double left_edge_x
-    double left_edge_y
-    double left_edge_z
-    double right_edge_x
-    double right_edge_y
-    double right_edge_z
-    long int children_pointers
-    long int start_index_x
-    long int start_index_y
-    long int start_index_z
-    int dims_x
-    int dims_y
-    int dims_z
-    double dds_x
-    double dds_y
-    double dds_z
+    np.int32_t num_children
+    np.int32_t level
+    np.int64_t index
+    np.float64_t left_edge_x
+    np.float64_t left_edge_y
+    np.float64_t left_edge_z
+    np.float64_t right_edge_x
+    np.float64_t right_edge_y
+    np.float64_t right_edge_z
+    np.int64_t children_pointers
+    np.int64_t start_index_x
+    np.int64_t start_index_y
+    np.int64_t start_index_z
+    np.int32_t dims_x
+    np.int32_t dims_y
+    np.int32_t dims_z
+    np.float64_t dds_x
+    np.float64_t dds_y
+    np.float64_t dds_z
 
 cdef struct GridVisitorData:
     GridTreeNode *grid

diff -r f18feeb0dd6163476732e6a4d85447b8c117a0d1 -r 2af65e3224d6ad7d4f6c50566410d1a30cd797dc yt/utilities/lib/bounding_volume_hierarchy.pyx
--- a/yt/utilities/lib/bounding_volume_hierarchy.pyx
+++ b/yt/utilities/lib/bounding_volume_hierarchy.pyx
@@ -4,6 +4,8 @@
 from libc.math cimport fabs
 from libc.stdlib cimport malloc, free
 from cython.parallel import parallel, prange
+from grid_traversal cimport ImageSampler, \
+    ImageContainer
 
 from yt.utilities.lib.primitives cimport \
     BBox, \
@@ -371,3 +373,58 @@
     
     cdef int N = origins.shape[0]
     cast_rays(&image[0], &origins[0, 0], &direction[0], N, bvh)
+
+cdef class BVHMeshSampler(ImageSampler):
+
+    @cython.boundscheck(False)
+    @cython.wraparound(False)
+    @cython.cdivision(True)
+    def __call__(self,
+                 BVH bvh,
+                 int num_threads = 0):
+        '''
+
+        This function is supposed to cast the rays and return the
+        image.
+
+        '''
+
+        cdef int vi, vj, i, j
+        cdef ImageContainer *im = self.image
+        cdef np.float64_t *v_pos
+        cdef np.float64_t *v_dir
+        cdef np.int64_t nx, ny, size
+        cdef np.float64_t width[3]
+        for i in range(3):
+            width[i] = self.width[i]
+        cdef np.ndarray[np.float64_t, ndim=1] data
+        cdef np.ndarray[np.int64_t, ndim=1] used
+        nx = im.nv[0]
+        ny = im.nv[1]
+        size = nx * ny
+        cdef Ray* ray
+        with nogil, parallel():
+            ray = <Ray *> malloc(sizeof(Ray))
+            v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
+            v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
+            for j in prange(size):
+                vj = j % ny
+                vi = (j - vj) / ny
+                vj = vj
+                self.vector_function(im, vi, vj, width, v_dir, v_pos)
+                for i in range(3):
+                    ray.origin[i] = v_pos[i]
+                    ray.direction[i] = v_dir[i]
+                    ray.inv_dir[i] = 1.0 / v_dir[i]
+                ray.t_far = 1e37
+                ray.t_near = 0.0
+                ray.data_val = 0
+                ray.elem_id = -1
+                bvh.intersect(ray)
+                im.image[vi, vj, 0] = ray.data_val
+                im.image_used[vi, vj] = ray.elem_id
+                im.mesh_lines[vi, vj] = ray.near_boundary
+                im.zbuffer[vi, vj] = ray.t_far
+            free(v_pos)
+            free(v_dir)
+            free(ray)

diff -r f18feeb0dd6163476732e6a4d85447b8c117a0d1 -r 2af65e3224d6ad7d4f6c50566410d1a30cd797dc yt/utilities/lib/mesh_traversal.pyx
--- a/yt/utilities/lib/mesh_traversal.pyx
+++ b/yt/utilities/lib/mesh_traversal.pyx
@@ -98,59 +98,3 @@
             im.zbuffer[vi, vj] = ray.tfar
         free(v_pos)
         free(v_dir)
-
-
-cdef class BVHMeshSampler(ImageSampler):
-
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
-    def __call__(self, 
-                 BVH bvh,
-                 int num_threads = 0):
-        '''
-
-        This function is supposed to cast the rays and return the
-        image.
-
-        '''
-
-        cdef int vi, vj, i, j
-        cdef ImageContainer *im = self.image
-        cdef np.float64_t *v_pos
-        cdef np.float64_t *v_dir
-        cdef np.int64_t nx, ny, size
-        cdef np.float64_t width[3]
-        for i in range(3):
-            width[i] = self.width[i]
-        cdef np.ndarray[np.float64_t, ndim=1] data
-        cdef np.ndarray[np.int64_t, ndim=1] used
-        nx = im.nv[0]
-        ny = im.nv[1]
-        size = nx * ny
-        cdef Ray* ray
-        with nogil, parallel():
-            ray = <Ray *> malloc(sizeof(Ray))
-            v_pos = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
-            v_dir = <np.float64_t *> malloc(3 * sizeof(np.float64_t))
-            for j in prange(size):
-                vj = j % ny
-                vi = (j - vj) / ny
-                vj = vj
-                self.vector_function(im, vi, vj, width, v_dir, v_pos)
-                for i in range(3):
-                    ray.origin[i] = v_pos[i]
-                    ray.direction[i] = v_dir[i]
-                    ray.inv_dir[i] = 1.0 / v_dir[i]
-                ray.t_far = 1e37
-                ray.t_near = 0.0
-                ray.data_val = 0
-                ray.elem_id = -1
-                bvh.intersect(ray)
-                im.image[vi, vj, 0] = ray.data_val
-                im.image_used[vi, vj] = ray.elem_id
-                im.mesh_lines[vi, vj] = ray.near_boundary
-                im.zbuffer[vi, vj] = ray.t_far
-            free(v_pos)
-            free(v_dir)
-            free(ray)

diff -r f18feeb0dd6163476732e6a4d85447b8c117a0d1 -r 2af65e3224d6ad7d4f6c50566410d1a30cd797dc yt/visualization/volume_rendering/utils.py
--- a/yt/visualization/volume_rendering/utils.py
+++ b/yt/visualization/volume_rendering/utils.py
@@ -1,7 +1,9 @@
 import numpy as np
 from yt.data_objects.static_output import Dataset
+from yt.utilities.lib import bounding_volume_hierarchy
 from yt.utilities.lib.grid_traversal import \
     VolumeRenderSampler, InterpolatedProjectionSampler, ProjectionSampler
+
 from yt.utilities.on_demand_imports import NotAModule
 try:
     from yt.utilities.lib import mesh_traversal
@@ -30,7 +32,7 @@
     if engine == 'embree':
         sampler = mesh_traversal.EmbreeMeshSampler(*args, **kwargs)
     elif engine == 'yt':
-        sampler = mesh_traversal.BVHMeshSampler(*args, **kwargs)
+        sampler = bounding_volume_hierarchy.BVHMeshSampler(*args, **kwargs)
     return sampler

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list