MPAS-JEDI
GetValues.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 dependencies
31 
32 implicit none
33 private
34 
35 ! --------------------------------------------------------------------------------------------------
36 
37 contains
38 
39 ! --------------------------------------------------------------------------------------------------
40 
41 subroutine mpas_getvalues_create_c(c_key_self, c_key_geom, c_locs, c_conf) &
42  bind(c, name='mpas_getvalues_create_f90')
43 implicit none
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_getvalues), pointer :: self
50 type(mpas_geom), pointer :: geom
51 type(ufo_locations) :: locs
52 type(fckit_configuration) :: f_conf
53 
54 ! Create object
55 call mpas_getvalues_registry%init()
56 call mpas_getvalues_registry%add(c_key_self)
57 call mpas_getvalues_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_getvalues_create_c
68 
69 ! --------------------------------------------------------------------------------------------------
70 
71 subroutine mpas_getvalues_delete_c(c_key_self) bind (c, name='mpas_getvalues_delete_f90')
72 
73 integer(c_int), intent(inout) :: c_key_self !< Key to self
74 
75 type(mpasjedi_getvalues), pointer :: self
76 
77 ! Get object
78 call mpas_getvalues_registry%get(c_key_self, self)
79 
80 ! Call method
81 call self%delete()
82 
83 ! Remove object
84 call mpas_getvalues_registry%remove(c_key_self)
85 
86 end subroutine mpas_getvalues_delete_c
87 
88 ! --------------------------------------------------------------------------------------------------
89 
90 subroutine mpas_getvalues_fill_geovals_c(c_key_self, c_key_geom, c_key_state, c_t1, c_t2, &
91  c_locs, c_key_geovals) &
92  bind(c, name='mpas_getvalues_fill_geovals_f90')
93 
94 integer(c_int), intent(in) :: c_key_self
95 integer(c_int), intent(in) :: c_key_geom
96 integer(c_int), intent(in) :: c_key_state
97 type(c_ptr), value, intent(in) :: c_t1
98 type(c_ptr), value, intent(in) :: c_t2
99 type(c_ptr), value, intent(in) :: c_locs
100 integer(c_int), intent(in) :: c_key_geovals
101 
102 type(mpasjedi_getvalues), pointer :: self
103 type(mpas_geom), pointer :: geom
104 type(mpas_fields), pointer :: fields
105 type(datetime) :: t1
106 type(datetime) :: t2
107 type(ufo_locations) :: locs
108 type(ufo_geovals), pointer :: geovals
109 
110 ! Get objects
111 call mpas_getvalues_registry%get(c_key_self, self)
112 call mpas_geom_registry%get(c_key_geom, geom)
113 call mpas_fields_registry%get(c_key_state, fields)
114 call c_f_datetime(c_t1, t1)
115 call c_f_datetime(c_t2, t2)
116 locs = ufo_locations(c_locs)
117 call ufo_geovals_registry%get(c_key_geovals, geovals)
118 
119 ! Call method
120 call self%fill_geovals(geom, fields, t1, t2, locs, geovals)
121 
122 end subroutine mpas_getvalues_fill_geovals_c
123 
124 ! --------------------------------------------------------------------------------------------------
125 
127 
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_getvalues_create_c(c_key_self, c_key_geom, c_locs, c_conf)
subroutine mpas_getvalues_delete_c(c_key_self)
subroutine mpas_getvalues_fill_geovals_c(c_key_self, c_key_geom, c_key_state, c_t1, c_t2, c_locs, c_key_geovals)
type(registry_t), public mpas_getvalues_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold MPAS field.
Fortran derived type to hold geometry definition.