MPAS-JEDI
LinearGetValues.interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2020 UCAR
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 
6 ! --------------------------------------------------------------------------------------------------
7 
9 
10 ! intrinsic
11 use iso_c_binding
12 
13 ! fckit dependencies
14 use fckit_configuration_module, only: fckit_configuration
15 
16 ! oops dependencies
17 use datetime_mod
18 use kinds, only: kind_real
19 
20 ! ufo dependencies
21 use ufo_locations_mod
22 use ufo_geovals_mod
23 use ufo_geovals_mod_c, only: ufo_geovals_registry
24 
25 ! self dependency
27 
28 ! mpas-jedi dependencies
31 
32 implicit none
33 private
34 
35 ! --------------------------------------------------------------------------------------------------
36 
37 contains
38 
39 ! -------------------------------------------------------------------------------------------------
40 
41 subroutine mpas_lineargetvalues_create_c(c_key_self, c_key_geom, c_locs, c_conf) &
42  bind(c,name='mpas_lineargetvalues_create_f90')
43 
44 integer(c_int), intent(inout) :: c_key_self !< Key to self
45 integer(c_int), intent(in) :: c_key_geom !< Key to geometry
46 type(c_ptr), value, intent(in) :: c_locs !< Observation locations
47 type(c_ptr), value, intent(in) :: c_conf !< Key to configuration
48 
49 type(mpasjedi_lineargetvalues), pointer :: self
50 type(mpas_geom), pointer :: geom
51 type(ufo_locations) :: locs
52 type(fckit_configuration) :: f_conf
53 
54 ! Create object
56 call mpas_lineargetvalues_registry%add(c_key_self)
57 call mpas_lineargetvalues_registry%get(c_key_self, self)
58 
59 ! Others
60 call mpas_geom_registry%get(c_key_geom, geom)
61 locs = ufo_locations(c_locs)
62 f_conf = fckit_configuration(c_conf)
63 
64 ! Call method
65 call self%create(geom, locs, f_conf)
66 
67 end subroutine mpas_lineargetvalues_create_c
68 
69 ! --------------------------------------------------------------------------------------------------
70 
71 subroutine mpas_lineargetvalues_delete_c(c_key_self) &
72  bind(c,name='mpas_lineargetvalues_delete_f90')
73 
74 integer(c_int), intent(inout) :: c_key_self !< Key to self
75 
76 type(mpasjedi_lineargetvalues), pointer :: self
77 
78 ! Get object
79 call mpas_lineargetvalues_registry%get(c_key_self, self)
80 
81 ! Call method
82 call self%delete()
83 
84 ! Remove object
85 call mpas_lineargetvalues_registry%remove(c_key_self)
86 
87 end subroutine mpas_lineargetvalues_delete_c
88 
89 ! --------------------------------------------------------------------------------------------------
90 
91 subroutine mpas_lineargetvalues_set_trajectory_c(c_key_self, c_key_geom, c_key_state, c_t1, &
92  c_t2, c_locs, c_key_geovals) &
93  bind(c,name='mpas_lineargetvalues_set_trajectory_f90')
94 
95 integer(c_int), intent(in) :: c_key_self
96 integer(c_int), intent(in) :: c_key_geom
97 integer(c_int), intent(in) :: c_key_state
98 type(c_ptr), value, intent(in) :: c_t1
99 type(c_ptr), value, intent(in) :: c_t2
100 type(c_ptr), value, intent(in) :: c_locs
101 integer(c_int), intent(in) :: c_key_geovals
102 
103 type(mpasjedi_lineargetvalues), pointer :: self
104 type(mpas_geom), pointer :: geom
105 type(mpas_fields), pointer :: fields
106 type(datetime) :: t1
107 type(datetime) :: t2
108 type(ufo_locations) :: locs
109 type(ufo_geovals), pointer :: geovals
110 
111 ! Get objects
112 call mpas_lineargetvalues_registry%get(c_key_self, self)
113 call mpas_geom_registry%get(c_key_geom, geom)
114 call mpas_fields_registry%get(c_key_state, fields)
115 call c_f_datetime(c_t1, t1)
116 call c_f_datetime(c_t2, t2)
117 locs = ufo_locations(c_locs)
118 call ufo_geovals_registry%get(c_key_geovals, geovals)
119 
120 ! Call method
121 call self%set_trajectory(geom, fields, t1, t2, locs, geovals)
122 
124 
125 
126 ! --------------------------------------------------------------------------------------------------
127 
128 subroutine mpas_lineargetvalues_fill_geovals_tl_c(c_key_self, c_key_geom, c_key_inc, c_t1, &
129  c_t2, c_locs, c_key_geovals) &
130  bind(c,name='mpas_lineargetvalues_fill_geovals_tl_f90')
131 
132 integer(c_int), intent(in) :: c_key_self
133 integer(c_int), intent(in) :: c_key_geom
134 integer(c_int), intent(in) :: c_key_inc
135 type(c_ptr), value, intent(in) :: c_t1
136 type(c_ptr), value, intent(in) :: c_t2
137 type(c_ptr), value, intent(in) :: c_locs
138 integer(c_int), intent(in) :: c_key_geovals
139 
140 type(mpasjedi_lineargetvalues), pointer :: self
141 type(mpas_geom), pointer :: geom
142 type(mpas_fields), pointer :: fields
143 type(datetime) :: t1
144 type(datetime) :: t2
145 type(ufo_locations) :: locs
146 type(ufo_geovals), pointer :: geovals
147 
148 ! Get objects
149 call mpas_lineargetvalues_registry%get(c_key_self, self)
150 call mpas_geom_registry%get(c_key_geom, geom)
151 call mpas_fields_registry%get(c_key_inc, fields)
152 call c_f_datetime(c_t1, t1)
153 call c_f_datetime(c_t2, t2)
154 locs = ufo_locations(c_locs)
155 call ufo_geovals_registry%get(c_key_geovals, geovals)
156 
157 ! Call method
158 call self%fill_geovals_tl(geom, fields, t1, t2, locs, geovals)
159 
161 
162 ! --------------------------------------------------------------------------------------------------
163 
164 subroutine mpas_lineargetvalues_fill_geovals_ad_c(c_key_self, c_key_geom, c_key_inc, c_t1, &
165  c_t2, c_locs, c_key_geovals) &
166  bind(c,name='mpas_lineargetvalues_fill_geovals_ad_f90')
167 
168 integer(c_int), intent(in) :: c_key_self
169 integer(c_int), intent(in) :: c_key_geom
170 integer(c_int), intent(in) :: c_key_inc
171 type(c_ptr), value, intent(in) :: c_t1
172 type(c_ptr), value, intent(in) :: c_t2
173 type(c_ptr), value, intent(in) :: c_locs
174 integer(c_int), intent(in) :: c_key_geovals
175 
176 type(mpasjedi_lineargetvalues), pointer :: self
177 type(mpas_geom), pointer :: geom
178 type(mpas_fields), pointer :: fields
179 type(datetime) :: t1
180 type(datetime) :: t2
181 type(ufo_locations) :: locs
182 type(ufo_geovals), pointer :: geovals
183 
184 ! Get objects
185 call mpas_lineargetvalues_registry%get(c_key_self, self)
186 call mpas_geom_registry%get(c_key_geom, geom)
187 call mpas_fields_registry%get(c_key_inc, fields)
188 call c_f_datetime(c_t1, t1)
189 call c_f_datetime(c_t2, t2)
190 locs = ufo_locations(c_locs)
191 call ufo_geovals_registry%get(c_key_geovals, geovals)
192 
193 ! Call method
194 call self%fill_geovals_ad(geom, fields, t1, t2, locs, geovals)
195 
197 
198 ! --------------------------------------------------------------------------------------------------
199 
201 
type(registry_t), public mpas_fields_registry
Linked list interface - defines registry_t type.
type(registry_t), public mpas_geom_registry
Linked list interface - defines registry_t type.
subroutine mpas_lineargetvalues_set_trajectory_c(c_key_self, c_key_geom, c_key_state, c_t1, c_t2, c_locs, c_key_geovals)
subroutine mpas_lineargetvalues_create_c(c_key_self, c_key_geom, c_locs, c_conf)
subroutine mpas_lineargetvalues_fill_geovals_tl_c(c_key_self, c_key_geom, c_key_inc, c_t1, c_t2, c_locs, c_key_geovals)
subroutine mpas_lineargetvalues_fill_geovals_ad_c(c_key_self, c_key_geom, c_key_inc, c_t1, c_t2, c_locs, c_key_geovals)
type(registry_t), public mpas_lineargetvalues_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold MPAS field.
Fortran derived type to hold geometry definition.