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

Bitbucket commits-noreply at bitbucket.org
Mon Sep 17 11:53:29 PDT 2012


2 new commits in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/6395d52366a8/
changeset:   6395d52366a8
branch:      yt-3.0
user:        MatthewTurk
date:        2012-09-17 19:05:31
summary:     Initial boundary conditions fixes for RAMSES data.  This now lets boundary
conditions datasets get loaded up, but IO is currently not working.
affected #:  2 files

diff -r 62b81d3a0a3d28cdc4270eb68610716b49e5e822 -r 6395d52366a818ec2812c318bbd66357480b3e3c yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -157,9 +157,9 @@
         fpu.skip(f)
         if hvals['nboundary'] > 0:
             fpu.skip(f, 2)
-            self.ngridbound = fpu.read_vector(f, 'i')
+            self.ngridbound = fpu.read_vector(f, 'i').astype("int64")
         else:
-            self.ngridbound = 0
+            self.ngridbound = np.zeros(hvals['nlevelmax'], dtype='int64')
         free_mem = fpu.read_attrs(f, (('free_mem', 5, 'i'), ) )
         ordering = fpu.read_vector(f, 'c')
         fpu.skip(f, 4)
@@ -182,7 +182,7 @@
         f.write(fb.read())
         f.seek(0)
         mylog.debug("Reading domain AMR % 4i (%0.3e, %0.3e)",
-            self.domain_id, self.local_oct_count, self.ngridbound)
+            self.domain_id, self.local_oct_count, self.ngridbound.sum())
         def _ng(c, l):
             if c < self.amr_header['ncpu']:
                 ng = self.amr_header['numbl'][l, c]
@@ -327,7 +327,8 @@
     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 for dom in self.domains)
+        total_octs = sum(dom.local_oct_count #+ dom.ngridbound.sum()
+                         for dom in self.domains)
         self.num_grids = total_octs
         #this merely allocates space for the oct tree
         #and nothing else
@@ -337,7 +338,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
+            [dom.local_oct_count #+ 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 62b81d3a0a3d28cdc4270eb68610716b49e5e822 -r 6395d52366a818ec2812c318bbd66357480b3e3c yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -335,7 +335,7 @@
     @cython.cdivision(True)
     def add(self, int curdom, int curlevel, int ng,
             np.ndarray[np.float64_t, ndim=2] pos,
-            int local_domain):
+            int local_domain, int skip_boundary = 1):
         cdef int level, no, p, i, j, k, ind[3]
         cdef int local = (local_domain == curdom)
         cdef Oct *cur, *next = NULL
@@ -344,15 +344,20 @@
         if curdom > self.max_domain: curdom = local_domain
         cdef OctAllocationContainer *cont = self.domains[curdom - 1]
         cdef int initial = cont.n_assigned
+        cdef int in_boundary = 0
         # How do we bootstrap ourselves?
         for p in range(no):
             #for every oct we're trying to add find the 
             #floating point unitary position on this level
+            in_boundary = 0
             for i in range(3):
                 pp[i] = pos[p, i]
                 dds[i] = (self.DRE[i] + self.DLE[i])/self.nn[i]
                 ind[i] = <np.int64_t> (pp[i]/dds[i])
                 cp[i] = (ind[i] + 0.5) * dds[i]
+                if ind[i] < 0 or ind[i] >= self.nn[i]:
+                    in_boundary = 1
+            if skip_boundary == in_boundary == 1: continue
             cur = self.root_mesh[ind[0]][ind[1]][ind[2]]
             if cur == NULL:
                 if curlevel != 0:



https://bitbucket.org/yt_analysis/yt-3.0/changeset/7f839f8a1a73/
changeset:   7f839f8a1a73
branch:      yt-3.0
user:        MatthewTurk
date:        2012-09-17 20:53:11
summary:     Adding a new relative-offset checking scheme.  Any octs which are allocated but
not identified as belonging to the active domain (i.e., they are in the
boundary zones) are excluded from IO, but are allowed to remain in the
OctAllocationContainer.
affected #:  2 files

diff -r 6395d52366a818ec2812c318bbd66357480b3e3c -r 7f839f8a1a73369de6cff44aba21c453c6877870 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -327,7 +327,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 + dom.ngridbound.sum()
                          for dom in self.domains)
         self.num_grids = total_octs
         #this merely allocates space for the oct tree
@@ -338,11 +338,12 @@
             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 + dom.ngridbound.sum()
              for dom in self.domains])
         #this actually reads every oct and loads it into the octree
         for dom in self.domains:
             dom._read_amr(self.oct_handler)
+        self.oct_handler.finalize_offsets()    
         #for dom in self.domains:
         #    self.oct_handler.check(dom.domain_id)
 


diff -r 6395d52366a818ec2812c318bbd66357480b3e3c -r 7f839f8a1a73369de6cff44aba21c453c6877870 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -330,6 +330,21 @@
         print "DOMAIN % 3i HAS % 9i BAD OCTS (%s / %s / %s)" % (curdom, nbad, 
             cont.n - cont.n_assigned, cont.n_assigned, cont.n)
 
+    def finalize_offsets(self):
+        cdef OctAllocationContainer *cont = self.domains[0]
+        cdef int oi, offset
+        cdef Oct* o
+        while cont != NULL:
+            offset = 0
+            for oi in range(cont.n):
+                o = &cont.my_octs[oi]
+                if o.level == -1:
+                    o.local_ind = -1 # Boundary
+                    offset += 1
+                else:
+                    o.local_ind -= offset
+            cont = cont.next
+
     @cython.boundscheck(False)
     @cython.wraparound(False)
     @cython.cdivision(True)
@@ -418,6 +433,7 @@
         coords = np.empty((cell_count, 3), dtype="int64")
         for oi in range(cur.n):
             o = &cur.my_octs[oi]
+            if o.local_ind == -1: continue
             for i in range(2):
                 for j in range(2):
                     for k in range(2):
@@ -447,6 +463,7 @@
         ci = 0
         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]
@@ -466,8 +483,10 @@
         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
                 level_count[o.level] += 1
         return level_count
 
@@ -494,6 +513,7 @@
             base_dx[i] = (self.DRE[i] - self.DLE[i])/self.nn[i]
         for oi in range(cur.n):
             o = &cur.my_octs[oi]
+            if o.local_ind == -1: continue
             for i in range(3):
                 # This gives the *grid* width for this level
                 dx[i] = base_dx[i] / (1 << o.level)
@@ -538,6 +558,7 @@
                         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]
                             local_filled += 1
         return local_filled

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