Skip to content

Instantly share code, notes, and snippets.

@matthewturk
Last active November 23, 2021 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewturk/7146bc51fe34cad9f5fc85139f406569 to your computer and use it in GitHub Desktop.
Save matthewturk/7146bc51fe34cad9f5fc85139f406569 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/yt/data_objects/index_subobjects/unstructured_mesh.py b/yt/data_objects/index_subobjects/unstructured_mesh.py
index 375a2ae19..e864498f7 100644
--- a/yt/data_objects/index_subobjects/unstructured_mesh.py
+++ b/yt/data_objects/index_subobjects/unstructured_mesh.py
@@ -1,4 +1,5 @@
import numpy as np
+from yt.geometry.selection_routines import convert_mask_to_indices
from yt.data_objects.selection_objects.data_selection_objects import (
YTSelectionContainer,
@@ -163,6 +164,18 @@ class SemiStructuredMesh(UnstructuredMesh):
elif field == "dz":
return self._current_chunk.fwidth[:, 2]
+ def select_icoords(self, dobj):
+ mask = self._get_selector_mask(dobj.selector)
+ if mask is None:
+ return np.empty((0, 3), dtype="int64")
+ indices = np.unravel_index(np.where(mask), [64, 64, 64])
+ mask = np.zeros((64, 64, 64), dtype="bool")
+ mask[indices] = True
+ coords = convert_mask_to_indices(mask, self._last_count)
+ start_index = np.array([0, 0, 0], dtype="i8")
+ coords += start_index[None, :]
+ return coords
+
def select_fwidth(self, dobj):
mask = self._get_selector_mask(dobj.selector)
if mask is None:
diff --git a/yt/loaders.py b/yt/loaders.py
index e63069d22..faca50925 100644
--- a/yt/loaders.py
+++ b/yt/loaders.py
@@ -805,7 +805,7 @@ def load_hexahedral_mesh(
)
from yt.frontends.stream.definitions import process_data, set_particle_types
- domain_dimensions = np.ones(3, "int32") * 2
+ domain_dimensions = np.ones(3, "int32") * 64
nprocs = 1
if bbox is None:
bbox = np.array([[0.0, 1.0], [0.0, 1.0], [0.0, 1.0]], "float64")
@@ -1157,7 +1157,7 @@ def load_unstructured_mesh(
from yt.frontends.stream.definitions import process_data, set_particle_types
dimensionality = coordinates.shape[1]
- domain_dimensions = np.ones(3, "int32") * 2
+ domain_dimensions = np.ones(3, "int32") * 64
nprocs = 1
if elem_data is None and node_data is None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment