-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'indep-octree-raytracing' into support-vertex-centred-data
- Loading branch information
Showing
30 changed files
with
1,099 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""This is a wrapper around the C++ class to efficiently cast rays into an octree. | ||
It relies on the seminal paper by J. Revelles,, C.Ureña and M.Lastra. | ||
""" | ||
|
||
|
||
cimport numpy as np | ||
import numpy as np | ||
from libcpp.vector cimport vector | ||
cimport cython | ||
from cython.parallel import prange, parallel | ||
from libc.stdlib cimport free, malloc | ||
|
||
from .image_samplers cimport ImageAccumulator, ImageSampler | ||
from .grid_traversal cimport sampler_function | ||
from .volume_container cimport VolumeContainer | ||
from .partitioned_grid cimport PartitionedGrid | ||
|
||
cdef extern from "octree_raytracing.cpp": | ||
cdef cppclass RayInfo[T]: | ||
vector[T] keys | ||
vector[double] t | ||
|
||
cdef cppclass Octree3D[T] nogil: | ||
Octree3D(int depth, double* LE, double* RE) | ||
void insert_node_no_ret(const int* ipos, const int lvl, T key) | ||
void cast_ray(double* origins, double* directions, vector[T] keyList, vector[double] tList) | ||
|
||
cdef class CythonOctreeRayTracing: | ||
cdef Octree3D[int]* oct | ||
cdef int depth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""This is a wrapper around the C++ class to efficiently cast rays into an octree. | ||
It relies on the seminal paper by J. Revelles,, C.Ureña and M.Lastra. | ||
""" | ||
|
||
|
||
cimport numpy as np | ||
import numpy as np | ||
from libcpp.vector cimport vector | ||
cimport cython | ||
from cython.parallel import prange, parallel | ||
from libc.stdlib cimport free, malloc | ||
|
||
from .image_samplers cimport ImageAccumulator, ImageSampler | ||
from .grid_traversal cimport sampler_function | ||
from .volume_container cimport VolumeContainer | ||
from .partitioned_grid cimport PartitionedGrid | ||
|
||
DEF Nch = 4 | ||
|
||
|
||
cdef class CythonOctreeRayTracing: | ||
def __init__(self, np.ndarray LE, np.ndarray RE, int depth): | ||
cdef double* LE_ptr = <double *>LE.data | ||
cdef double* RE_ptr = <double *>RE.data | ||
self.oct = new Octree3D[int](depth, LE_ptr, RE_ptr) | ||
self.depth = depth | ||
|
||
@cython.boundscheck(False) | ||
@cython.wraparound(False) | ||
def add_nodes(self, int[:, :] ipos_view, int[:] lvl_view, int[:] key): | ||
cdef int i | ||
cdef int ii[3] | ||
|
||
for i in range(len(key)): | ||
ii[0] = ipos_view[i, 0] | ||
ii[1] = ipos_view[i, 1] | ||
ii[2] = ipos_view[i, 2] | ||
self.oct.insert_node_no_ret(ii, lvl_view[i], <int> key[i]) | ||
|
||
def __dealloc__(self): | ||
del self.oct |
Oops, something went wrong.