-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfortran_interface_c.f90
More file actions
47 lines (28 loc) · 1.23 KB
/
fortran_interface_c.f90
File metadata and controls
47 lines (28 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
subroutine fortran_interface_c(state_1,reward,Done,Simu_Step_In,action_1,Simu_Step_Out)
implicit none
real :: state_1, action_1
real :: reward, Done
integer :: Simu_Step_In, Simu_Step_Out
! Fortran 90 interface to a C procedure
interface
subroutine c_interface_python(state_1,reward,Done,Simu_Step_In,action_1,Simu_Step_Out)
!DEC$ ATTRIBUTES C :: c_interface_python
!DEC$ ATTRIBUTES REFERENCE :: state_1
!DEC$ ATTRIBUTES REFERENCE :: reward
!DEC$ ATTRIBUTES REFERENCE :: Done
!DEC$ ATTRIBUTES REFERENCE :: Simu_Step_In
!DEC$ ATTRIBUTES REFERENCE :: action_1
!DEC$ ATTRIBUTES REFERENCE :: Simu_Step_Out
!
! in, out are passed by REFERENCE
!
real :: state_1, action_1
real :: reward, Done
integer :: Simu_Step_In, Simu_Step_Out
end subroutine c_interface_python
end interface
!
! Call the C procedure
!
call c_interface_python(state_1,reward,Done,Simu_Step_In,action_1,Simu_Step_Out)
end subroutine fortran_interface_c