File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1269,8 +1269,8 @@ def get_idxs_node(self, ids_node):
1269
1269
Returns:
1270
1270
A `numpy.ndarray` of node indices (int)
1271
1271
"""
1272
- elem_id_map = self .get_elem_id_map ()
1273
- return np .array ([np .where (elem_id_map == i )[0 ][0 ] for i in ids_node ])
1272
+ node_id_map = self .get_node_id_map ()
1273
+ return np .array ([np .where (node_id_map == i )[0 ][0 ] for i in ids_node ])
1274
1274
1275
1275
def get_info_records (self ) -> list :
1276
1276
"""Get a list of info records where each entry in the list is one info
Original file line number Diff line number Diff line change @@ -654,6 +654,24 @@ def test_get_idxs_elem_start_blk(mesh):
654
654
assert idxs [0 ] == 0 and idxs [1 ] == 2
655
655
656
656
657
+ def test_get_idxs_elem (mesh ):
658
+ ids = mesh .get_elem_id_map ()
659
+ np .random .shuffle (ids )
660
+ mesh .put_elem_id_map (ids )
661
+ idxs = mesh .get_idxs_elem (ids )
662
+ assert np .all (idxs == np .arange (mesh .get_num_elems ()))
663
+ mesh .put_elem_id_map (np .sort (ids ))
664
+
665
+
666
+ def test_get_idxs_node (mesh ):
667
+ ids = mesh .get_node_id_map ()
668
+ np .random .shuffle (ids )
669
+ mesh .put_node_id_map (ids )
670
+ idxs = mesh .get_idxs_node (ids )
671
+ assert np .all (idxs == np .arange (mesh .get_num_nodes ()))
672
+ mesh .put_node_id_map (np .sort (ids ))
673
+
674
+
657
675
def test_get_info_records (mesh ):
658
676
assert 'info_records' in mesh .dataset .variables
659
677
assert 'num_info' in mesh .dataset .dimensions
You can’t perform that action at this time.
0 commit comments