[yt-svn] commit/yt-3.0: MatthewTurk: Refinements for particle octree.
Bitbucket
commits-noreply at bitbucket.org
Fri Aug 17 22:18:59 PDT 2012
1 new commit in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/changeset/cb951d475d84/
changeset: cb951d475d84
branch: yt-3.0
user: MatthewTurk
date: 2012-08-18 07:18:52
summary: Refinements for particle octree.
affected #: 1 file
diff -r 28eb071a0ddf19599a66a610578ac692fb4c6654 -r cb951d475d849fa15692beb8a8c05a8ae5b2b5ef yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -443,12 +443,13 @@
sd.np = 0
return my_oct
- def add(self, int curdom, np.ndarray[np.float64_t, ndim=2] pos):
+ def add(self, np.ndarray[np.float64_t, ndim=2] pos):
cdef int no = pos.shape[0]
- cdef int p, i
+ cdef int p, i, level
cdef np.float64_t dds[3], cp[3], pp[3]
cdef int ind[3]
for p in range(no):
+ level = 0
for i in range(3):
pp[i] = pos[p, i]
dds[i] = (self.DRE[i] + self.DLE[i])/self.nn[i]
@@ -460,7 +461,9 @@
self.root_mesh[ind[0]][ind[1]][ind[2]] = cur
for i in range(3):
cur.pos[i] = ind[i] # root level
- while cur.sd.np >= 0:
+ if cur.sd.np == 32:
+ self.refine_oct(cur, cp)
+ while cur.sd.np < 0:
for i in range(3):
dds[i] = dds[i] / 2.0
if cp[i] > pp[i]:
@@ -470,6 +473,7 @@
ind[i] = 1
cp[i] += dds[i]/2.0
cur = cur.children[ind[0]][ind[1]][ind[2]]
+ level += 1
if cur.sd.np == 32:
self.refine_oct(cur, cp)
# Now we copy in our particle
@@ -491,16 +495,17 @@
o.children[i][j][k] = noct
for m in range(32):
for i in range(3):
- if o.sd.pos[m][i] < pos[i]:
+ if o.sd.pos[i][m] < pos[i]:
ind[i] = 0
else:
ind[i] = 1
noct = o.children[ind[0]][ind[1]][ind[2]]
k = noct.sd.np
for i in range(3):
- noct.sd.pos[i][k] = o.sd.pos[i][k]
+ noct.sd.pos[i][k] = o.sd.pos[i][m]
noct.sd.np += 1
o.sd.np = -1
for i in range(3):
free(o.sd.pos[i])
free(o.sd.pos)
+
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