-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcwrappers.f95
110 lines (76 loc) · 2.45 KB
/
cwrappers.f95
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
! %%%%%%%%%%%%%%%%%%% c wrappers %%%%%%%%%%%%%%%%%%%%%%%
subroutine init_fort(id, global_c_ptr)
use, intrinsic :: iso_c_binding
use global
implicit none
integer :: id
type (C_PTR), intent(out) :: global_c_ptr
type (global_type), pointer :: gdata
call init(id, gdata)
global_c_ptr = C_LOC(gdata)
end subroutine init_fort
subroutine print_fort(global_c_ptr, timestep)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: g
integer :: timestep
call C_F_POINTER(global_c_ptr,g)
call print(g, timestep)
end subroutine print_fort
subroutine update_fort(timestep, global_c_ptr)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: g
integer :: timestep
call C_F_POINTER(global_c_ptr,g)
call update(timestep, g)
global_c_ptr = C_LOC(g)
end subroutine update_fort
subroutine term_fort(global_c_ptr)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: gdata
call C_F_POINTER(global_c_ptr, gdata)
call term(gdata)
end subroutine term_fort
subroutine get_neighbors_fort(numneighbors, neighbors, global_c_ptr)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: gdata
integer :: numneighbors
integer :: neighbors(MAX_DOMAIN_NEIGHBORS)
call C_F_POINTER(global_c_ptr, gdata)
call get_neighbors(numneighbors, neighbors, gdata)
end subroutine get_neighbors_fort
subroutine get_outgoing_nodes_fort(global_c_ptr, neighbor, num_nodes, alives)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: gdata
integer :: neighbor
integer, intent(out) :: num_nodes
integer :: alives(MAX_BOUNDARY_SIZE)
call C_F_POINTER(global_c_ptr, gdata)
call get_outgoing_nodes(gdata, neighbor, num_nodes, alives)
end subroutine get_outgoing_nodes_fort
subroutine put_incoming_nodes_fort(global_c_ptr, neighbor, num_nodes, alives)
use, intrinsic :: iso_c_binding
use global
implicit none
type (C_PTR) :: global_c_ptr
type (global_type), pointer :: gdata
integer :: neighbor
integer :: num_nodes
integer :: alives(MAX_BOUNDARY_SIZE)
call C_F_POINTER(global_c_ptr, gdata)
call put_incoming_nodes(gdata, neighbor, num_nodes, alives)
end subroutine put_incoming_nodes_fort