@@ -267,6 +267,7 @@ def test_get_all_side_set_params():
267
267
268
268
def test_get_coord (mesh ):
269
269
# Assert correct return type
270
+ coords = mesh .get_coords ()
270
271
coord = mesh .get_coord (1 )
271
272
for c in coord :
272
273
assert isinstance (c , np .ndarray )
@@ -276,18 +277,33 @@ def test_get_coord(mesh):
276
277
mesh .put_coords (coord_vals , coord_vals , coord_vals )
277
278
for i , v in enumerate (coord_vals ):
278
279
assert np .all (np .stack (mesh .get_coord (i + 1 )) == float (v ))
280
+ mesh .put_coords (* coords )
279
281
280
282
281
283
def test_get_coords (mesh ):
282
284
# Assert correct return type
283
- coords = np . stack ( mesh .get_coords ()). T
285
+ coords = mesh .get_coords ()
284
286
for coord in coords :
285
287
assert isinstance (coord , np .ndarray )
286
288
287
289
# Assert that the correct values are fetched
288
- coord_vals = np .arange (mesh .get_num_nodes ())
289
- for i , v in enumerate (coord_vals ):
290
- assert np .all (coords [i ] == float (v ))
290
+ num_nodes_x = mesh .shape [0 ] + 1
291
+ num_nodes_y = mesh .shape [1 ] + 1
292
+ num_nodes_z = mesh .shape [2 ] + 1
293
+
294
+ idxs_x = np .arange (num_nodes_x )
295
+ idxs_y = np .arange (num_nodes_y )
296
+ idxs_z = np .arange (num_nodes_z )
297
+
298
+ idxs = np .meshgrid (idxs_y , idxs_z , idxs_x )
299
+
300
+ idxs_yg = idxs [0 ].flatten ()
301
+ idxs_zg = idxs [1 ].flatten ()
302
+ idxs_xg = idxs [2 ].flatten ()
303
+
304
+ assert np .allclose (coords [0 ], mesh .resolution [0 ] * idxs_xg )
305
+ assert np .allclose (coords [1 ], mesh .resolution [1 ] * idxs_yg )
306
+ assert np .allclose (coords [2 ], mesh .resolution [2 ] * idxs_zg )
291
307
292
308
293
309
def test_get_coord_names (mesh ):
@@ -980,9 +996,11 @@ def test_get_side_set_names(mesh):
980
996
assert names [i - 1 ] == f'test_ss_name{ i } '
981
997
982
998
983
- @pytest .mark .unwritten
984
- def test_get_side_set_node_list ():
985
- assert False
999
+ def test_get_side_set_node_list (mesh ):
1000
+ num_nodes , nodes = mesh .get_side_set_node_list (1 )
1001
+ assert num_nodes == len (nodes )
1002
+ nodes_check = mesh .get_nodes_on_surface (1 )
1003
+ assert set (nodes ) == set (nodes_check )
986
1004
987
1005
988
1006
def test_get_side_set_params (mesh , dir_test_file ):
@@ -1153,14 +1171,16 @@ def test_put_coord_names(mesh):
1153
1171
1154
1172
1155
1173
def test_put_coords (mesh ):
1174
+ coords = mesh .get_coords ()
1156
1175
coordx = np .arange (12 )
1157
1176
coordy = 10 * coordx
1158
1177
coordz = 100 * coordx
1159
1178
mesh .put_coords (coordx , coordy , coordz )
1160
- coords = mesh .get_coords ()
1161
- assert np .allclose (coordx , coords [0 ])
1162
- assert np .allclose (coordy , coords [1 ])
1163
- assert np .allclose (coordz , coords [2 ])
1179
+ coords_new = mesh .get_coords ()
1180
+ assert np .allclose (coordx , coords_new [0 ])
1181
+ assert np .allclose (coordy , coords_new [1 ])
1182
+ assert np .allclose (coordz , coords_new [2 ])
1183
+ mesh .put_coords (* coords )
1164
1184
1165
1185
1166
1186
# put_elem ------------------------------------------------------------------ #
0 commit comments