[yt-svn] commit/yt-3.0: 4 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Oct 2 04:37:18 PDT 2013
4 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/3c697fc96c97/
Changeset: 3c697fc96c97
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-01 13:03:35
Summary: Adding a "count boundary" option to Octree.add.
Affected #: 2 files
diff -r ace052c7aae2ef2c5b4ac0d92aaa4d5d3d61a1a7 -r 3c697fc96c97f5384f31b470e51e9c4a00bce72e yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -241,7 +241,8 @@
# Note that we're adding *grids*, not individual cells.
if level >= min_level:
assert(pos.shape[0] == ng)
- n = self.oct_handler.add(cpu + 1, level - min_level, pos)
+ n = self.oct_handler.add(cpu + 1, level - min_level, pos,
+ count_boundary = 1)
assert(n == ng)
if n > 0: max_level = max(level - min_level, max_level)
self.max_level = max_level
diff -r ace052c7aae2ef2c5b4ac0d92aaa4d5d3d61a1a7 -r 3c697fc96c97f5384f31b470e51e9c4a00bce72e yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -499,8 +499,10 @@
@cython.cdivision(True)
def add(self, int curdom, int curlevel,
np.ndarray[np.float64_t, ndim=2] pos,
- int skip_boundary = 1):
+ int skip_boundary = 1,
+ int count_boundary = 0):
cdef int level, no, p, i, j, k, ind[3]
+ cdef int nb = 0
cdef Oct *cur, *next = NULL
cdef np.float64_t pp[3], cp[3], dds[3]
no = pos.shape[0] #number of octs
@@ -520,7 +522,10 @@
cp[i] = (ind[i] + 0.5) * dds[i] + self.DLE[i]
if ind[i] < 0 or ind[i] >= self.nn[i]:
in_boundary = 1
- if skip_boundary == in_boundary == 1: continue
+ if skip_boundary == in_boundary == 1:
+ if count_boundary == 1:
+ nb += 1
+ continue
cur = self.next_root(curdom, ind)
if cur == NULL: raise RuntimeError
# Now we find the location we want
@@ -542,7 +547,7 @@
# Now we should be at the right level
cur.domain = curdom
cur.file_ind = p
- return cont.n_assigned - initial
+ return cont.n_assigned - initial + nb
def allocate_domains(self, domain_counts):
cdef int count, i
https://bitbucket.org/yt_analysis/yt-3.0/commits/c80ad38c663e/
Changeset: c80ad38c663e
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-01 14:20:27
Summary: Adding additional error-checking.
Affected #: 1 file
diff -r 3c697fc96c97f5384f31b470e51e9c4a00bce72e -r c80ad38c663e13a49d479a82ce90fba32dff5a9c yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -243,11 +243,36 @@
assert(pos.shape[0] == ng)
n = self.oct_handler.add(cpu + 1, level - min_level, pos,
count_boundary = 1)
- assert(n == ng)
+ self._error_check(cpu, level, pos, n, ng, (nx, ny, nz))
if n > 0: max_level = max(level - min_level, max_level)
self.max_level = max_level
self.oct_handler.finalize()
+ def _error_check(self, cpu, level, pos, n, ng, nn):
+ if n == ng:
+ return
+ # This is where we now check for issues with creating the new octs, and
+ # we attempt to determine what precisely is going wrong.
+ # These are all print statements.
+ print "We have detected an error with the construction of the Octree."
+ print " The number of Octs to be added : %s" % ng
+ print " The number of Octs added : %s" % n
+ print " Level : %s" % level
+ print " CPU Number (0-indexed) : %s" % cpu
+ for i, ax in enumerate('xyz'):
+ print " extent [%s] : %s %s" % \
+ (ax, pos[:,i].min(), pos[:,i].max())
+ print " domain left : %s" % \
+ (self.pf.domain_left_edge,)
+ print " domain right : %s" % \
+ (self.pf.domain_right_edge,)
+ print " offset applied : %s %s %s" % \
+ (nn[0], nn[1], nn[2])
+ print "AMR Header:"
+ for key in sorted(self.amr_header):
+ print " %-30s: %s" % (key, self.amr_header[key])
+ raise RuntimeError
+
def included(self, selector):
if getattr(selector, "domain_id", None) is not None:
return selector.domain_id == self.domain_id
https://bitbucket.org/yt_analysis/yt-3.0/commits/2bc0b6e85833/
Changeset: 2bc0b6e85833
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-01 23:17:54
Summary: Fixes boundary octs not being added.
Affected #: 2 files
diff -r c80ad38c663e13a49d479a82ce90fba32dff5a9c -r 2bc0b6e85833976308d39819b8de4b159590c5c5 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -249,7 +249,9 @@
self.oct_handler.finalize()
def _error_check(self, cpu, level, pos, n, ng, nn):
- if n == ng:
+ # NOTE: We have the second conditional here because internally, it will
+ # not add any octs in that case.
+ if n == ng or cpu + 1 > self.oct_handler.num_domains:
return
# This is where we now check for issues with creating the new octs, and
# we attempt to determine what precisely is going wrong.
diff -r c80ad38c663e13a49d479a82ce90fba32dff5a9c -r 2bc0b6e85833976308d39819b8de4b159590c5c5 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -523,8 +523,7 @@
if ind[i] < 0 or ind[i] >= self.nn[i]:
in_boundary = 1
if skip_boundary == in_boundary == 1:
- if count_boundary == 1:
- nb += 1
+ nb += count_boundary
continue
cur = self.next_root(curdom, ind)
if cur == NULL: raise RuntimeError
https://bitbucket.org/yt_analysis/yt-3.0/commits/e1fc1af0d61c/
Changeset: e1fc1af0d61c
Branch: yt-3.0
User: MatthewTurk
Date: 2013-10-02 13:37:15
Summary: Merged in MatthewTurk/yt-3.0 (pull request #107)
Adding a "count boundary" option to Octree.add.
Affected #: 2 files
diff -r 59d6af464edc0cb7d6322e930999bf715e54766f -r e1fc1af0d61c57213e7f072f6971eb974707e226 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -241,12 +241,40 @@
# Note that we're adding *grids*, not individual cells.
if level >= min_level:
assert(pos.shape[0] == ng)
- n = self.oct_handler.add(cpu + 1, level - min_level, pos)
- assert(n == ng)
+ n = self.oct_handler.add(cpu + 1, level - min_level, pos,
+ count_boundary = 1)
+ self._error_check(cpu, level, pos, n, ng, (nx, ny, nz))
if n > 0: max_level = max(level - min_level, max_level)
self.max_level = max_level
self.oct_handler.finalize()
+ def _error_check(self, cpu, level, pos, n, ng, nn):
+ # NOTE: We have the second conditional here because internally, it will
+ # not add any octs in that case.
+ if n == ng or cpu + 1 > self.oct_handler.num_domains:
+ return
+ # This is where we now check for issues with creating the new octs, and
+ # we attempt to determine what precisely is going wrong.
+ # These are all print statements.
+ print "We have detected an error with the construction of the Octree."
+ print " The number of Octs to be added : %s" % ng
+ print " The number of Octs added : %s" % n
+ print " Level : %s" % level
+ print " CPU Number (0-indexed) : %s" % cpu
+ for i, ax in enumerate('xyz'):
+ print " extent [%s] : %s %s" % \
+ (ax, pos[:,i].min(), pos[:,i].max())
+ print " domain left : %s" % \
+ (self.pf.domain_left_edge,)
+ print " domain right : %s" % \
+ (self.pf.domain_right_edge,)
+ print " offset applied : %s %s %s" % \
+ (nn[0], nn[1], nn[2])
+ print "AMR Header:"
+ for key in sorted(self.amr_header):
+ print " %-30s: %s" % (key, self.amr_header[key])
+ raise RuntimeError
+
def included(self, selector):
if getattr(selector, "domain_id", None) is not None:
return selector.domain_id == self.domain_id
diff -r 59d6af464edc0cb7d6322e930999bf715e54766f -r e1fc1af0d61c57213e7f072f6971eb974707e226 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -499,8 +499,10 @@
@cython.cdivision(True)
def add(self, int curdom, int curlevel,
np.ndarray[np.float64_t, ndim=2] pos,
- int skip_boundary = 1):
+ int skip_boundary = 1,
+ int count_boundary = 0):
cdef int level, no, p, i, j, k, ind[3]
+ cdef int nb = 0
cdef Oct *cur, *next = NULL
cdef np.float64_t pp[3], cp[3], dds[3]
no = pos.shape[0] #number of octs
@@ -520,7 +522,9 @@
cp[i] = (ind[i] + 0.5) * dds[i] + self.DLE[i]
if ind[i] < 0 or ind[i] >= self.nn[i]:
in_boundary = 1
- if skip_boundary == in_boundary == 1: continue
+ if skip_boundary == in_boundary == 1:
+ nb += count_boundary
+ continue
cur = self.next_root(curdom, ind)
if cur == NULL: raise RuntimeError
# Now we find the location we want
@@ -542,7 +546,7 @@
# Now we should be at the right level
cur.domain = curdom
cur.file_ind = p
- return cont.n_assigned - initial
+ return cont.n_assigned - initial + nb
def allocate_domains(self, domain_counts):
cdef int count, i
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