[yt-svn] commit/yt: ngoldbaum: Merged in MatthewTurk/yt (pull request #2170)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri May 13 10:57:24 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/8d076b60c7da/
Changeset: 8d076b60c7da
Branch: yt
User: ngoldbaum
Date: 2016-05-13 17:57:07+00:00
Summary: Merged in MatthewTurk/yt (pull request #2170)
Override select for semistructured mesh. Closes #1217
Affected #: 2 files
diff -r bdf16ce177f5fd1d88b07c227b0e5759fba0ecea -r 8d076b60c7dacde1de17041f79ff1a6bd0c3ea8e yt/data_objects/unstructured_mesh.py
--- a/yt/data_objects/unstructured_mesh.py
+++ b/yt/data_objects/unstructured_mesh.py
@@ -225,3 +225,12 @@
else:
self._last_count = mask.sum()
return mask
+
+ def select(self, selector, source, dest, offset):
+ mask = self._get_selector_mask(selector)
+ count = self.count(selector)
+ if count == 0: return 0
+ # Note: this likely will not work with vector fields.
+ dest[offset:offset+count] = source.flat[mask]
+ return count
+
diff -r bdf16ce177f5fd1d88b07c227b0e5759fba0ecea -r 8d076b60c7dacde1de17041f79ff1a6bd0c3ea8e yt/frontends/stream/tests/test_stream_hexahedral.py
--- a/yt/frontends/stream/tests/test_stream_hexahedral.py
+++ b/yt/frontends/stream/tests/test_stream_hexahedral.py
@@ -6,6 +6,7 @@
from yt.testing import \
assert_almost_equal, \
assert_equal
+from yt import SlicePlot
# Field information
def test_stream_hexahedral() :
@@ -30,7 +31,7 @@
cell_z[0] = 0.0
coords, conn = hexahedral_connectivity(cell_x, cell_y, cell_z)
- data = {'random_field': np.random.random(Nx*Ny*Nz)}
+ data = {'random_field': np.random.random((Nx, Ny, Nz))}
bbox = np.array([ [0.0, 1.0], [0.0, 1.0], [0.0, 1.0] ])
ds = load_hexahedral_mesh(data, conn, coords, bbox=bbox)
dd = ds.all_data()
@@ -42,7 +43,7 @@
cell_y = np.linspace(0.0, 1.0, Ny+1)
cell_z = np.linspace(0.0, 1.0, Nz+1)
coords, conn = hexahedral_connectivity(cell_x, cell_y, cell_z)
- data = {'random_field': np.random.random(Nx*Ny*Nz)}
+ data = {'random_field': np.random.random((Nx, Ny, Nz))}
bbox = np.array([ [0.0, 1.0], [0.0, 1.0], [0.0, 1.0] ])
ds = load_hexahedral_mesh(data, conn, coords, bbox=bbox)
dd = ds.all_data()
@@ -51,3 +52,7 @@
yield assert_almost_equal, dd["dx"].to_ndarray(), 1.0/Nx
yield assert_almost_equal, dd["dy"].to_ndarray(), 1.0/Ny
yield assert_almost_equal, dd["dz"].to_ndarray(), 1.0/Nz
+
+ s = SlicePlot(ds, "x", "random_field")
+ s._setup_plots()
+ s.frb["random_field"]
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160513/8144ccb7/attachment.html>
More information about the yt-svn
mailing list