[Yt-svn] commit/yt: sskory: Fixing the octree to correctly initialize nodes when incremental is True.
Bitbucket
commits-noreply at bitbucket.org
Mon Apr 4 16:52:13 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/ae5c206ba84b/
changeset: r4074:ae5c206ba84b
branch: yt
user: sskory
date: 2011-04-05 01:51:39
summary: Fixing the octree to correctly initialize nodes when incremental is True.
affected #: 2 files (746 bytes)
--- a/yt/data_objects/derived_quantities.py Mon Apr 04 15:27:57 2011 -0600
+++ b/yt/data_objects/derived_quantities.py Mon Apr 04 17:51:39 2011 -0600
@@ -394,17 +394,6 @@
dxes = dxes[lsort]
dyes = dyes[lsort]
dzes = dzes[lsort]
- # This step adds massless cells for all the levels we need in order
- # to fully populate all the parent-child cells needed.
- for L in range(min(data.pf.h.max_level+1, na.amax(levels)+1)):
- ActiveDimensions = cover_ActiveDimensions * 2**L
- i, j, k = na.indices(ActiveDimensions)
- i = i.flatten()
- j = j.flatten()
- k = k.flatten()
- octree.add_array_to_tree(L, i, j, k,
- na.array([na.zeros_like(i)], order='F', dtype='float64'),
- na.zeros_like(i).astype('float64'))
# Now we add actual data to the octree.
for L, dx, dy, dz in zip(levels, dxes, dyes, dzes):
mylog.info("Adding data to Octree for level %d" % L)
--- a/yt/utilities/_amr_utils/Octree.pyx Mon Apr 04 15:27:57 2011 -0600
+++ b/yt/utilities/_amr_utils/Octree.pyx Mon Apr 04 17:51:39 2011 -0600
@@ -80,14 +80,14 @@
self.children[i][j][k] = OTN_initialize(
npos,
self.nvals, self.val, self.weight_val,
- self.level + 1, self)
+ self.level + 1, self, incremental)
if incremental: return
for i in range(self.nvals): self.val[i] = 0.0
self.weight_val = 0.0
cdef OctreeNode *OTN_initialize(np.int64_t pos[3], int nvals,
np.float64_t *val, np.float64_t weight_val,
- int level, OctreeNode *parent):
+ int level, OctreeNode *parent, int incremental = 0):
cdef OctreeNode *node
cdef int i, j, k
node = <OctreeNode *> malloc(sizeof(OctreeNode))
@@ -101,9 +101,14 @@
node.max_level = 0
node.val = <np.float64_t *> malloc(
nvals * sizeof(np.float64_t))
- for i in range(nvals):
- node.val[i] = val[i]
- node.weight_val = weight_val
+ if incremental:
+ for i in range(nvals):
+ node.val[i] = 0.
+ node.weight_val = 0.
+ else:
+ for i in range(nvals):
+ node.val[i] = val[i]
+ node.weight_val = weight_val
for i in range(2):
for j in range(2):
for k in range(2):
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