11! > Wrapper for interfacing `m_get_square_root` with python
22module m_get_square_root_w
33
4- use m_result_int, only: ResultInt
5- use m_result_dp, only: ResultDP
6- use m_result_none, only: ResultNone
4+ use m_result_gen, only: ResultGen
75
86 use m_get_square_root, only: o_get_square_root = > get_square_root
97
108 ! The manager module, which makes this all work
11- use m_result_dp_manager , only: &
12- result_dp_manager_get_available_instance_index = > get_available_instance_index, &
13- result_dp_manager_set_instance_index_to = > set_instance_index_to, &
14- result_dp_manager_ensure_instance_array_size_is_at_least = > ensure_instance_array_size_is_at_least
9+ use m_result_manager , only: &
10+ result_manager_get_available_instance_index = > get_available_instance_index, &
11+ result_manager_set_instance_index_to = > set_instance_index_to, &
12+ result_manager_ensure_instance_array_size_is_at_least = > ensure_instance_array_size_is_at_least
1513
1614 implicit none
1715 private
@@ -32,16 +30,17 @@ function get_square_root(inv) result(res_instance_index)
3230 integer :: res_instance_index
3331 ! ! Instance index of the result type
3432
35- type (ResultDP ) :: res
36- type (ResultInt ) :: res_get_available_instance_index
37- type (ResultNone ) :: res_chk
33+ type (ResultGen ) :: res
34+ type (ResultGen ) :: res_get_available_instance_index
35+ type (ResultGen ) :: res_chk
3836
3937 res = o_get_square_root(inv)
4038
41- call result_dp_manager_ensure_instance_array_size_is_at_least (1 )
39+ call result_manager_ensure_instance_array_size_is_at_least (1 )
4240
4341 ! Get the instance index to return to Python
44- res_get_available_instance_index = result_dp_manager_get_available_instance_index()
42+ ! res_get_available_instance_index = result_dp_manager_get_available_instance_index()
43+ call result_manager_get_available_instance_index(res_instance_index,res_chk)
4544
4645 ! Logic here is trickier.
4746 ! If you can't create a result type to return to Python,
@@ -50,9 +49,11 @@ function get_square_root(inv) result(res_instance_index)
5049 ! Set the derived type value in the manager's array,
5150 ! ready for its attributes to be retrieved from Python.
5251 ! MZ it would be probably good to check "res_chk" for errors
53- res_chk = result_dp_manager_set_instance_index_to(int (res_get_available_instance_index % data_v, kind = 4 ), res)
52+ ! res_chk = result_dp_manager_set_instance_index_to(res_instance_index, res)
53+ call result_manager_set_instance_index_to(instance_index= res_instance_index,&
54+ data_dp= res% data_dp, res_check = res_chk)
5455
55- res_instance_index = int (res_get_available_instance_index % data_v, kind = 4 )
56+ ! res_instance_index = int(res_get_available_instance_index % data_v, kind = 4)
5657
5758 end function get_square_root
5859
0 commit comments