[yt-svn] commit/yt-3.0: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Sat Aug 18 07:18:57 PDT 2012
2 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/changeset/d0d344be1103/
changeset: d0d344be1103
branch: yt-3.0
user: MatthewTurk
date: 2012-08-18 15:55:12
summary: Add finalization, so that particle octs can be selected
affected #: 1 file
diff -r 90d723c1c52f6252684ca346d94d1ccd1994b51c -r d0d344be11036dbc8b216805747555635c293cc6 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -420,6 +420,7 @@
cdef class ParticleOctreeContainer(OctreeContainer):
cdef ParticleArrays *first_sd
cdef ParticleArrays *last_sd
+ cdef Oct** oct_list
def __dealloc__(self):
cdef i, j, k
@@ -445,14 +446,23 @@
def allocate_domains(self, domain_counts):
cdef int count, i
+ def finalize(self):
+ self.oct_list = <Oct**> malloc(sizeof(Oct*)*self.nocts)
+ cdef i = 0
+ cdef ParticleArrays *c = self.first_sd
+ while c != NULL:
+ self.oct_list[i] = c.oct
+ c = c.next
+ i += 1
+
cdef Oct* allocate_oct(self):
self.nocts += 1
cdef Oct *my_oct = <Oct*> malloc(sizeof(Oct))
cdef ParticleArrays *sd = <ParticleArrays*> \
malloc(sizeof(ParticleArrays))
cdef int i, j, k
- my_oct.local_ind = my_oct.domain = -1
- my_oct.ind = self.nocts - 1
+ my_oct.ind = my_oct.domain = -1
+ my_oct.local_ind = self.nocts - 1
my_oct.pos[0] = my_oct.pos[1] = my_oct.pos[2] = -1
my_oct.level = -1
my_oct.sd = sd
@@ -483,6 +493,7 @@
cdef np.int64_t total = 0
cdef ParticleArrays *c = self.first_sd
while c != NULL:
+ assert(c.oct.local_ind == total)
total += 1
c = c.next
return total
https://bitbucket.org/yt_analysis/yt-3.0/changeset/75213d5a0d9b/
changeset: 75213d5a0d9b
branch: yt-3.0
user: MatthewTurk
date: 2012-08-18 16:18:47
summary: Adding octree selection and domain identification for particle octrees
affected #: 1 file
diff -r d0d344be11036dbc8b216805747555635c293cc6 -r 75213d5a0d9bc735a3cac30006692155825298ba yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -493,7 +493,6 @@
cdef np.int64_t total = 0
cdef ParticleArrays *c = self.first_sd
while c != NULL:
- assert(c.oct.local_ind == total)
total += 1
c = c.next
return total
@@ -503,6 +502,7 @@
cdef int p, i, level
cdef np.float64_t dds[3], cp[3], pp[3]
cdef int ind[3]
+ self.max_domain = max(self.max_domain, domain_id)
for p in range(no):
level = 0
for i in range(3):
@@ -591,3 +591,21 @@
if o.children[i][j][k] != NULL:
self.visit(o.children[i][j][k], counts, level + 1)
return
+
+ def domain_identify(self, np.ndarray[np.uint8_t, ndim=2, cast=True] mask):
+ cdef int i, oi, m
+ cdef Oct *o
+ cdef np.ndarray[np.uint8_t, ndim=1, cast=True] dmask
+ dmask = np.zeros(self.max_domain+1, dtype='uint8')
+ for oi in range(self.nocts):
+ m = 0
+ o = self.oct_list[oi]
+ if o.sd.np <= 0: continue
+ for i in range(8):
+ if mask[oi, i] == 1:
+ m = 1
+ break
+ if m == 0: continue
+ for i in range(o.sd.np):
+ dmask[o.sd.domain_id[i]] = 1
+ return dmask.astype("bool")
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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