forked from open-atmos/PyPartMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_state.F90
152 lines (102 loc) · 4.44 KB
/
env_state.F90
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
!###################################################################################################
! This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) #
! Copyright (C) 2022 University of Illinois Urbana-Champaign #
! Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors #
!###################################################################################################
module PyPartMC_env_state
use iso_c_binding
use pmc_env_state
use camp_env_state, only: camp_env_state_t => env_state_t
implicit none
contains
subroutine f_env_state_ctor(ptr_c) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(out) :: ptr_c
allocate(ptr_f)
ptr_f%elapsed_time = 0
ptr_c = c_loc(ptr_f)
end subroutine
subroutine f_env_state_dtor(ptr_c) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
call c_f_pointer(ptr_c, ptr_f)
deallocate(ptr_f)
end subroutine
subroutine f_env_state_from_json(ptr_c) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
type(spec_file_t) :: file
call c_f_pointer(ptr_c, ptr_f)
call spec_file_read_env_state(file, ptr_f)
end subroutine
subroutine f_env_state_set_temperature(ptr_c, temperature) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(in) :: temperature
call c_f_pointer(ptr_c, ptr_f)
ptr_f%temp = temperature
end subroutine
subroutine f_env_state_get_temperature(ptr_c, temperature) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: temperature
call c_f_pointer(ptr_c, ptr_f)
temperature = ptr_f%temp
end subroutine
subroutine f_env_state_get_rel_humid(ptr_c, rel_humid) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: rel_humid
call c_f_pointer(ptr_c, ptr_f)
rel_humid = ptr_f%rel_humid
end subroutine
subroutine f_env_state_set_height(ptr_c, height) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(in) :: height
call c_f_pointer(ptr_c, ptr_f)
ptr_f%height = height
end subroutine
subroutine f_env_state_get_height(ptr_c, height) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: height
call c_f_pointer(ptr_c, ptr_f)
height = ptr_f%height
end subroutine
subroutine f_env_state_set_pressure(ptr_c, pressure) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(in) :: pressure
call c_f_pointer(ptr_c, ptr_f)
ptr_f%pressure = pressure
end subroutine
subroutine f_env_state_get_pressure(ptr_c, pressure) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: pressure
call c_f_pointer(ptr_c, ptr_f)
pressure = ptr_f%pressure
end subroutine
subroutine f_env_state_get_elapsed_time(ptr_c, elapsed_time) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: elapsed_time
call c_f_pointer(ptr_c, ptr_f)
elapsed_time = ptr_f%elapsed_time
end subroutine
subroutine f_env_state_get_start_time(ptr_c, start_time) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: start_time
call c_f_pointer(ptr_c, ptr_f)
start_time = ptr_f%start_time
end subroutine
subroutine f_env_state_air_dens(ptr_c, air_density) bind(C)
type(env_state_t), pointer :: ptr_f => null()
type(c_ptr), intent(in) :: ptr_c
real(c_double), intent(out) :: air_density
call c_f_pointer(ptr_c, ptr_f)
air_density = env_state_air_den(ptr_f)
end subroutine
end module