[yt-svn] commit/yt: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat Apr 2 13:03:20 PDT 2016
4 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/61d50b7967e3/
Changeset: 61d50b7967e3
Branch: yt
User: atmyers
Date: 2016-04-01 19:48:45+00:00
Summary: Make the Camera have a weak ref to the Scene, to allow it to be garbage collected.
Affected #: 1 file
diff -r d18f33211199f71e2fac4d927307b015d513a328 -r 61d50b7967e38c6912e2b5ea678e591db573f248 yt/visualization/volume_rendering/camera.py
--- a/yt/visualization/volume_rendering/camera.py
+++ b/yt/visualization/volume_rendering/camera.py
@@ -24,6 +24,7 @@
Lens
import numpy as np
from numbers import Number as numeric_type
+import weakref
def _sanitize_camera_property_units(value, scene):
if iterable(value):
@@ -126,7 +127,7 @@
raise RuntimeError(
'The first argument passed to the Camera initializer is a '
'%s object, expected a %s object' % (type(scene), Scene))
- self.scene = scene
+ self.scene = weakref.proxy(scene)
self.lens = None
self.north_vector = None
self.normal_vector = None
https://bitbucket.org/yt_analysis/yt/commits/bd6bd8de783f/
Changeset: bd6bd8de783f
Branch: yt
User: atmyers
Date: 2016-04-01 19:49:42+00:00
Summary: Give ImageSampler a __dealloc__ method.
Affected #: 1 file
diff -r 61d50b7967e38c6912e2b5ea678e591db573f248 -r bd6bd8de783fd19ce26b1ccb9ed6ae2ff4b4687e yt/utilities/lib/grid_traversal.pyx
--- a/yt/utilities/lib/grid_traversal.pyx
+++ b/yt/utilities/lib/grid_traversal.pyx
@@ -492,6 +492,15 @@
cdef void setup(self, PartitionedGrid pg):
return
+ def __dealloc__(self):
+ self.image.image = None
+ self.image.vp_pos = None
+ self.image.vp_dir = None
+ self.image.zbuffer = None
+ self.image.camera_data = None
+ free(self.image)
+
+
cdef void projection_sampler(
VolumeContainer *vc,
np.float64_t v_pos[3],
https://bitbucket.org/yt_analysis/yt/commits/f24289d608dd/
Changeset: f24289d608dd
Branch: yt
User: atmyers
Date: 2016-04-02 08:32:44+00:00
Summary: use pointers instead of memoryviews in Patch, doesn't seem to segfault after this.
Affected #: 3 files
diff -r bd6bd8de783fd19ce26b1ccb9ed6ae2ff4b4687e -r f24289d608dd16bacf940bb1e1e69a1b165fa13d yt/utilities/lib/mesh_construction.pxd
--- a/yt/utilities/lib/mesh_construction.pxd
+++ b/yt/utilities/lib/mesh_construction.pxd
@@ -2,6 +2,7 @@
Vertex, \
Triangle, \
Vec3f
+cimport numpy as np
ctypedef struct MeshDataContainer:
Vertex* vertices # array of triangle vertices
@@ -14,6 +15,5 @@
ctypedef struct Patch:
float[8][3] v
unsigned int geomID
- long [:,:] indices
- double [:,:] vertices
- double [:,:] field_data
+ np.float64_t* vertices
+ np.float64_t* field_data
diff -r bd6bd8de783fd19ce26b1ccb9ed6ae2ff4b4687e -r f24289d608dd16bacf940bb1e1e69a1b165fa13d yt/utilities/lib/mesh_construction.pyx
--- a/yt/utilities/lib/mesh_construction.pyx
+++ b/yt/utilities/lib/mesh_construction.pyx
@@ -241,6 +241,8 @@
'''
cdef Patch* patches
+ cdef np.float64_t* vertices
+ cdef np.float64_t* field_data
cdef unsigned int mesh
# patches per element, vertices per element, and field points per
# element, respectively:
@@ -265,11 +267,22 @@
np.ndarray field_data):
cdef int i, j, ind, idim
cdef int ne = indices_in.shape[0]
+ cdef int nv = vertices_in.shape[0]
cdef int npatch = 6*ne;
cdef unsigned int mesh = rtcgu.rtcNewUserGeometry(scene.scene_i, npatch)
cdef np.ndarray[np.float64_t, ndim=2] element_vertices
- cdef Patch* patches = <Patch*> malloc(npatch * sizeof(Patch));
+ cdef Patch* patches = <Patch*> malloc(npatch * sizeof(Patch))
+ self.vertices = <np.float64_t*> malloc(20 * ne * 3 * sizeof(np.float64_t))
+ self.field_data = <np.float64_t*> malloc(20 * ne * sizeof(np.float64_t))
+
+ for i in range(ne):
+ element_vertices = vertices_in[indices_in[i]]
+ for j in range(20):
+ self.field_data[i*20 + j] = field_data[i][j]
+ for k in range(3):
+ self.vertices[i*20*3 + j*3 + k] = element_vertices[j][k]
+
cdef Patch* patch
for i in range(ne): # for each element
element_vertices = vertices_in[indices_in[i]]
@@ -280,9 +293,8 @@
ind = hex20_faces[j][k]
for idim in range(3): # for each spatial dimension (yikes)
patch.v[k][idim] = element_vertices[ind][idim]
- patch.indices = indices_in
- patch.vertices = vertices_in
- patch.field_data = field_data
+ patch.vertices = self.vertices + i*20*3
+ patch.field_data = self.field_data + i*20
self.patches = patches
self.mesh = mesh
@@ -295,3 +307,5 @@
def __dealloc__(self):
free(self.patches)
+ free(self.vertices)
+ free(self.field_data)
diff -r bd6bd8de783fd19ce26b1ccb9ed6ae2ff4b4687e -r f24289d608dd16bacf940bb1e1e69a1b165fa13d yt/utilities/lib/mesh_samplers.pyx
--- a/yt/utilities/lib/mesh_samplers.pyx
+++ b/yt/utilities/lib/mesh_samplers.pyx
@@ -196,9 +196,6 @@
rtcr.RTCRay& ray) nogil:
cdef int ray_id, elem_id, i
cdef double val
- cdef double[20] field_data
- cdef int[20] element_indices
- cdef double[60] vertices
cdef double[3] position
cdef float[3] pos
cdef Patch* data
@@ -220,16 +217,10 @@
for i in range(3):
position[i] = <double> pos[i]
- for i in range(20):
- field_data[i] = patch.field_data[elem_id, i]
- vertices[i*3 ] = patch.vertices[patch.indices[elem_id, i]][0]
- vertices[i*3 + 1] = patch.vertices[patch.indices[elem_id, i]][1]
- vertices[i*3 + 2] = patch.vertices[patch.indices[elem_id, i]][2]
-
# we use ray.time to pass the value of the field
cdef double mapped_coord[3]
- S2Sampler.map_real_to_unit(mapped_coord, vertices, position)
- val = S2Sampler.sample_at_unit_point(mapped_coord, field_data)
+ S2Sampler.map_real_to_unit(mapped_coord, patch.vertices, position)
+ val = S2Sampler.sample_at_unit_point(mapped_coord, patch.field_data)
ray.time = val
# we use ray.instID to pass back whether the ray is near the
https://bitbucket.org/yt_analysis/yt/commits/d0b73467db93/
Changeset: d0b73467db93
Branch: yt
User: atmyers
Date: 2016-04-02 16:27:37+00:00
Summary: fix bounding volume hierarchy test
Affected #: 1 file
diff -r f24289d608dd16bacf940bb1e1e69a1b165fa13d -r d0b73467db93927ae19868ebc814eaab239c2317 yt/utilities/lib/tests/test_bounding_volume_hierarchy.py
--- a/yt/utilities/lib/tests/test_bounding_volume_hierarchy.py
+++ b/yt/utilities/lib/tests/test_bounding_volume_hierarchy.py
@@ -36,7 +36,8 @@
bvh = BVH(vertices, indices, field_data)
- cam = Camera(Scene())
+ sc = Scene()
+ cam = Camera(sc)
cam.set_position(np.array([8.0, 8.0, 8.0]))
cam.focus = np.array([0.0, 0.0, 0.0])
origins, direction = get_rays(cam)
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160402/1b0d4956/attachment-0001.html>
More information about the yt-svn
mailing list