[yt-svn] commit/yt-3.0: 3 new changesets

Bitbucket commits-noreply at bitbucket.org
Tue Sep 18 08:42:16 PDT 2012


3 new commits in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/78aff36ff940/
changeset:   78aff36ff940
branch:      yt-3.0
user:        MatthewTurk
date:        2012-09-18 17:39:17
summary:     Failing RAMSES commit
affected #:  2 files

diff -r 7f839f8a1a73369de6cff44aba21c453c6877870 -r 78aff36ff940f0ae594cf201aecbe5aaaeb3d8e9 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -192,6 +192,9 @@
             return ng
         min_level = self.pf.min_level
         total = 0
+        nx, ny, nz = (((i-1.0)/2.0) for i in self.amr_header['nx'])
+        print "LEFT OFFSET", nx, ny, nz
+        print "MIN LEVEL", min_level
         for level in range(self.amr_header['nlevelmax']):
             # Easier if do this 1-indexed
             for cpu in range(self.amr_header['nboundary'] + self.amr_header['ncpu']):
@@ -201,11 +204,9 @@
                 ind = fpu.read_vector(f, "I").astype("int64")
                 fpu.skip(f, 2)
                 pos = np.empty((ng, 3), dtype='float64')
-                pos[:,0] = fpu.read_vector(f, "d")
-                pos[:,1] = fpu.read_vector(f, "d")
-                pos[:,2] = fpu.read_vector(f, "d")
-                #pos *= self.pf.domain_width
-                #pos += self.parameter_file.domain_left_edge
+                pos[:,0] = fpu.read_vector(f, "d") - nx
+                pos[:,1] = fpu.read_vector(f, "d") - ny
+                pos[:,2] = fpu.read_vector(f, "d") - nz
                 fpu.skip(f, 31)
                 #parents = fpu.read_vector(f, "I")
                 #fpu.skip(f, 6)
@@ -221,6 +222,10 @@
                 # We don't want duplicate grids.
                 # Note that we're adding *grids*, not individual cells.
                 if level >= min_level and cpu + 1 >= self.domain_id: 
+                    print level, cpu,
+                    for i,ax in zip(range(3), 'xyz'):
+                        print pos[:,i].min(), pos[:,i].max(),
+                    print
                     assert(pos.shape[0] == ng)
                     if cpu + 1 == self.domain_id:
                         total += ng
@@ -327,7 +332,7 @@
     def _initialize_oct_handler(self):
         self.domains = [RAMSESDomainFile(self.parameter_file, i + 1)
                         for i in range(self.parameter_file['ncpu'])]
-        total_octs = sum(dom.local_oct_count + dom.ngridbound.sum()
+        total_octs = sum(dom.local_oct_count + 0*dom.ngridbound.sum()
                          for dom in self.domains)
         self.num_grids = total_octs
         #this merely allocates space for the oct tree
@@ -338,7 +343,7 @@
             self.parameter_file.domain_right_edge)
         mylog.debug("Allocating %s octs", total_octs)
         self.oct_handler.allocate_domains(
-            [dom.local_oct_count + dom.ngridbound.sum()
+            [dom.local_oct_count + 0*dom.ngridbound.sum()
              for dom in self.domains])
         #this actually reads every oct and loads it into the octree
         for dom in self.domains:


diff -r 7f839f8a1a73369de6cff44aba21c453c6877870 -r 78aff36ff940f0ae594cf201aecbe5aaaeb3d8e9 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -134,9 +134,9 @@
             size[i] = (self.DRE[i] - self.DLE[i]) / (self.nn[i] << o.level)
             corner[i] = o.pos[i] * size[i] + self.DLE[i]
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     cdef Oct *get(self, ppos):
         cdef np.int64_t ind[3]
         cdef np.float64_t dds[3], cp[3], pp[3]
@@ -160,9 +160,9 @@
             cur = cur.children[ind[0]][ind[1]][ind[2]]
         return cur
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def count_cells(self, SelectorObject selector,
               np.ndarray[np.uint8_t, ndim=2, cast=True] mask):
         cdef int i, j, k, oi
@@ -180,16 +180,16 @@
             base_dx[i] = (self.DRE[i] - self.DLE[i])/self.nn[i]
         cur = self.cont
         for oi in range(n):
-            if oi - cur.offset >= cur.n:
+            if oi - cur.offset >= cur.n_assigned:
                 cur = cur.next
             o = &cur.my_octs[oi - cur.offset]
             for i in range(8):
                 count[o.domain - 1] += mask[oi,i]
         return count
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     cdef void neighbors(self, Oct* o, Oct* neighbors[27]):
         cdef np.int64_t curopos[3]
         cdef np.int64_t curnpos[3]
@@ -254,9 +254,9 @@
                     neighbors[nn] = candidate
                     nn += 1
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def get_neighbor_boundaries(self, ppos):
         cdef Oct *main = self.get(ppos)
         cdef Oct* neighbors[27]
@@ -293,9 +293,9 @@
         # called.
         if self.domains != NULL: free(self.domains)
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def count(self, np.ndarray[np.uint8_t, ndim=1, cast=True] mask,
                      split = False):
         cdef int n = mask.shape[0]
@@ -332,22 +332,33 @@
 
     def finalize_offsets(self):
         cdef OctAllocationContainer *cont = self.domains[0]
-        cdef int oi, offset
+        cdef int oi, loffset, goffset, ci
         cdef Oct* o
+        ci = 0
+        goffset = 0
         while cont != NULL:
-            offset = 0
+            loffset = 0
             for oi in range(cont.n):
                 o = &cont.my_octs[oi]
                 if o.level == -1:
+                    #print "Eliminating", o.pos[0], o.pos[1], o.pos[2],
+                    #print o.local_ind, o.ind, o.domain, oi
                     o.local_ind = -1 # Boundary
-                    offset += 1
+                    loffset += 1
+                    goffset += 1
+                elif o.local_ind == -1:
+                    raise RuntimeError
                 else:
-                    o.local_ind -= offset
+                    o.local_ind -= loffset
+            print "Container %s has %s / %s unassigned (%s)" % (
+                ci, loffset, cont.n, goffset)
             cont = cont.next
+            cont.offset -= goffset
+            ci += 1
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def add(self, int curdom, int curlevel, int ng,
             np.ndarray[np.float64_t, ndim=2] pos,
             int local_domain, int skip_boundary = 1):
@@ -417,9 +428,9 @@
             cur.level = curlevel
         return cont.n_assigned - initial
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def icoords(self, int domain_id,
                 np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count,
@@ -446,9 +457,9 @@
                         level_counts[o.level] += 1
         return coords
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def ires(self, int domain_id,
                 np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count,
@@ -464,35 +475,41 @@
         for oi in range(cur.n):
             o = &cur.my_octs[oi]
             if o.local_ind == -1: continue
-            for i in range(8):
-                if mask[oi + cur.offset, i] == 0: continue
-                ci = level_counts[o.level]
-                levels[ci] = o.level
-                level_counts[o.level] += 1
+            for i in range(2):
+                for j in range(2):
+                    for k in range(2):
+                        ii = ((k*2)+j)*2+i
+                        if mask[o.local_ind, ii] == 0: continue
+                        ci = level_counts[o.level]
+                        levels[ci] = o.level
+                        level_counts[o.level] += 1
         return levels
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def count_levels(self, int max_level, int domain_id,
                      np.ndarray[np.uint8_t, ndim=2, cast=True] mask):
         cdef np.ndarray[np.int64_t, ndim=1] level_count
         cdef OctAllocationContainer *cur = self.domains[domain_id - 1]
         cdef Oct *o
-        cdef int oi, i
+        cdef int oi, i, skipped = 0
         level_count = np.zeros(max_level+1, 'int64')
         for oi in range(cur.n):
             o = &cur.my_octs[oi]
             if o.local_ind == -1: continue
             for i in range(8):
-                if mask[o.local_ind, i] == 0: continue
-                if o.local_ind == -1: raise RuntimeError
+                if (o.local_ind + cur.offset) > mask.shape[0]:
+                    print mask.shape[0], o.local_ind, cur.offset, o.ind, o.level
+                if mask[o.local_ind + cur.offset, i] == 0: continue
+                ci = level_count[o.level]
                 level_count[o.level] += 1
+        print "Skipped (%s) %s / %s => %s" % (domain_id, skipped, cur.n, mask.shape[0])
         return level_count
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def fcoords(self, int domain_id,
                 np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count,
@@ -533,9 +550,9 @@
                         level_counts[o.level] += 1
         return coords
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def fill_level(self, int domain, int level, dest_fields, source_fields,
                    np.ndarray[np.uint8_t, ndim=2, cast=True] mask, int offset):
         cdef np.ndarray[np.float64_t, ndim=2] source
@@ -558,8 +575,9 @@
                         for k in range(2):
                             ii = ((k*2)+j)*2+i
                             if mask[o.local_ind, ii] == 0: continue
-                            if o.local_ind == -1: raise RuntimeError
-                            dest[local_filled + offset] = source[o.ind, ii]
+                            if o.local_ind + offset > dest.shape[0]:
+                                print dest.shape[0], o.local_ind, offset
+                            dest[o.local_ind + offset] = source[o.ind, ii]
                             local_filled += 1
         return local_filled
 
@@ -604,9 +622,9 @@
             free(o.sd.domain_id)
         free(o)
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def icoords(self, np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count):
         cdef np.ndarray[np.int64_t, ndim=2] coords
@@ -626,9 +644,9 @@
                             ci += 1
         return coords
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def ires(self, np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count):
         cdef np.ndarray[np.int64_t, ndim=1] res
@@ -643,9 +661,9 @@
                     ci += 1
         return res
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def fcoords(self, np.ndarray[np.uint8_t, ndim=2, cast=True] mask,
                 np.int64_t cell_count):
         cdef np.ndarray[np.float64_t, ndim=2] coords
@@ -858,9 +876,9 @@
                 dmask[o.sd.domain_id[i]] = 1
         return dmask.astype("bool")
 
-    @cython.boundscheck(False)
-    @cython.wraparound(False)
-    @cython.cdivision(True)
+    #@cython.boundscheck(False)
+    #@cython.wraparound(False)
+    #@cython.cdivision(True)
     def count_neighbor_particles(self, ppos):
         cdef Oct *main = self.get(ppos)
         cdef Oct* neighbors[27]



https://bitbucket.org/yt_analysis/yt-3.0/changeset/869e8c682b27/
changeset:   869e8c682b27
branch:      yt-3.0
user:        MatthewTurk
date:        2012-09-18 17:41:25
summary:     This fixes the boundary issue.  We no longer read boundaries, and we don't do
any finalization.
affected #:  1 file

diff -r 6395d52366a818ec2812c318bbd66357480b3e3c -r 869e8c682b27807946f28dc5484bc6ae1c8665f4 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -192,6 +192,7 @@
             return ng
         min_level = self.pf.min_level
         total = 0
+        nx, ny, nz = (((i-1.0)/2.0) for i in self.amr_header['nx'])
         for level in range(self.amr_header['nlevelmax']):
             # Easier if do this 1-indexed
             for cpu in range(self.amr_header['nboundary'] + self.amr_header['ncpu']):
@@ -201,9 +202,9 @@
                 ind = fpu.read_vector(f, "I").astype("int64")
                 fpu.skip(f, 2)
                 pos = np.empty((ng, 3), dtype='float64')
-                pos[:,0] = fpu.read_vector(f, "d")
-                pos[:,1] = fpu.read_vector(f, "d")
-                pos[:,2] = fpu.read_vector(f, "d")
+                pos[:,0] = fpu.read_vector(f, "d") - nx
+                pos[:,1] = fpu.read_vector(f, "d") - ny
+                pos[:,2] = fpu.read_vector(f, "d") - nz
                 #pos *= self.pf.domain_width
                 #pos += self.parameter_file.domain_left_edge
                 fpu.skip(f, 31)



https://bitbucket.org/yt_analysis/yt-3.0/changeset/c54f76bb6571/
changeset:   c54f76bb6571
branch:      yt-3.0
user:        MatthewTurk
date:        2012-09-18 17:42:09
summary:     Merging in dead head.
affected #:  2 files

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