[Yt-svn] commit/yt: MatthewTurk: Adding an incremental mode. There may be a bug somewhere, as testing this with

Bitbucket commits-noreply at bitbucket.org
Fri Mar 11 11:42:40 PST 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/b0f4cc46c000/
changeset:   r3814:b0f4cc46c000
branch:      yt
user:        MatthewTurk
date:        2011-03-11 20:29:48
summary:     Adding an incremental mode.  There may be a bug somewhere, as testing this with
my previous script indicates a 0.2% difference in the mass in the coarsest grid
with the total mass.
affected #:  1 file (258 bytes)

--- a/yt/utilities/_amr_utils/Octree.pyx	Fri Mar 11 11:04:32 2011 -0800
+++ b/yt/utilities/_amr_utils/Octree.pyx	Fri Mar 11 11:29:48 2011 -0800
@@ -106,10 +106,12 @@
     cdef np.int64_t po2[80]
     cdef OctreeNode ****root_nodes
     cdef np.int64_t top_grid_dims[3]
+    cdef int incremental
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
-                  int nvals):
+                  int nvals, int incremental = False):
         cdef int i, j
+        self.incremental = incremental
         cdef OctreeNode *node
         cdef np.int64_t pos[3]
         cdef np.float64_t *vals = <np.float64_t *> alloca(
@@ -152,6 +154,8 @@
         node = self.find_on_root_level(pos, level)
         cdef np.int64_t fac
         for L in range(level):
+            if self.incremental:
+                OTN_add_value(node, val, weight_val)
             if node.children[0][0][0] == NULL:
                 OTN_refine(node)
             # Maybe we should use bitwise operators?
@@ -233,6 +237,7 @@
         # We only really return a non-zero, calculated value if we are at the
         # level in question.
         if node.level == level:
+            if self.incremental: return 1
             # We return 1 if there are no finer points at this level and zero
             # if there are
             return (node.children[0][0][0] == NULL)
@@ -251,7 +256,8 @@
                               np.float64_t *wdata):
         cdef int i, j
         if node.level == level:
-            if node.children[0][0][0] != NULL: return 0
+            if node.children[0][0][0] != NULL and not self.incremental:
+                return 0
             for i in range(self.nvals):
                 vdata[self.nvals * curpos + i] = node.val[i]
             wdata[curpos] = node.weight_val

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