@@ -1165,6 +1165,39 @@ def my_rhs(scale, vel):
11651165 np .testing .assert_allclose (result .u , - 3.14 * v_y )
11661166 np .testing .assert_allclose (result .v , 3.14 * v_x )
11671167
1168+
1169+ def test_actx_compile_with_outlined_function (actx_factory ):
1170+ actx = actx_factory ()
1171+ rng = np .random .default_rng ()
1172+
1173+ @actx .outline
1174+ def outlined_scale_and_orthogonalize (alpha , vel ):
1175+ return scale_and_orthogonalize (alpha , vel )
1176+
1177+ def multi_scale_and_orthogonalize (alpha , vel1 , vel2 ):
1178+ return make_obj_array ([
1179+ outlined_scale_and_orthogonalize (alpha , vel1 ),
1180+ outlined_scale_and_orthogonalize (alpha , vel2 )])
1181+
1182+ compiled_rhs = actx .compile (multi_scale_and_orthogonalize )
1183+
1184+ v1_x = rng .uniform (size = 10 )
1185+ v1_y = rng .uniform (size = 10 )
1186+ v2_x = rng .uniform (size = 10 )
1187+ v2_y = rng .uniform (size = 10 )
1188+
1189+ vel1 = actx .from_numpy (Velocity2D (v1_x , v1_y , actx ))
1190+ vel2 = actx .from_numpy (Velocity2D (v2_x , v2_y , actx ))
1191+
1192+ scaled_speed1 , scaled_speed2 = compiled_rhs (np .float64 (3.14 ), vel1 , vel2 )
1193+
1194+ result1 = actx .to_numpy (scaled_speed1 )
1195+ result2 = actx .to_numpy (scaled_speed2 )
1196+ np .testing .assert_allclose (result1 .u , - 3.14 * v1_y )
1197+ np .testing .assert_allclose (result1 .v , 3.14 * v1_x )
1198+ np .testing .assert_allclose (result2 .u , - 3.14 * v2_y )
1199+ np .testing .assert_allclose (result2 .v , 3.14 * v2_x )
1200+
11681201# }}}
11691202
11701203
0 commit comments