This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get i, j, k indices of grid nodes as a list to iterate over | |
import numpy as np | |
GRID_SHAPE = (2, 3, 4) | |
grid_indices: np.ndarray = np.indices(GRID_SHAPE).reshape(len(GRID_SHAPE), -1).T | |
grid_indices.shape # >> (24, 3) | |
# This way we can loop through the indices as array rows | |
for idx in grid_indices: |
OlderNewer