MPAS-JEDI
mpasjedi_lvc_model2geovars_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 
7 
8 use iso_c_binding
9 
10 use datetime_mod
11 
12 use fckit_configuration_module, only: fckit_configuration
13 
17 
18 implicit none
19 
20 private
22 
23 ! --------------------------------------------------------------------------------------------------
24 
25 #define LISTED_TYPE mpasjedi_lvc_model2geovars
26 
27 !> Linked list interface - defines registry_t type
28 #include "oops/util/linkedList_i.f"
29 
30 !> Global registry
32 
33 ! --------------------------------------------------------------------------------------------------
34 
35 contains
36 
37 ! --------------------------------------------------------------------------------------------------
38 
39 !> Linked list implementation
40 #include "oops/util/linkedList_c.f"
41 
42 ! --------------------------------------------------------------------------------------------------
43 
45  c_key_self, c_key_geom, c_key_bg, c_key_fg, c_conf) &
46  bind(c,name='mpasjedi_lvc_model2geovars_create_f90')
47 
48 integer(c_int), intent(inout) :: c_key_self
49 integer(c_int), intent(in) :: c_key_geom
50 integer(c_int), intent(in) :: c_key_bg
51 integer(c_int), intent(in) :: c_key_fg
52 type(c_ptr), value, intent(in) :: c_conf
53 
54 type(mpasjedi_lvc_model2geovars), pointer :: self
55 type(mpas_geom), pointer :: geom
56 type(mpas_fields), pointer :: bg
57 type(mpas_fields), pointer :: fg
58 type(fckit_configuration) :: conf
59 
60 ! Linked list
61 ! -----------
63 call mpasjedi_lvc_model2geovars_registry%add(c_key_self)
64 call mpasjedi_lvc_model2geovars_registry%get(c_key_self, self)
65 call mpas_geom_registry%get(c_key_geom, geom)
66 call mpas_fields_registry%get(c_key_bg, bg)
67 call mpas_fields_registry%get(c_key_fg, fg)
68 
69 ! APIs
70 ! ----
71 conf = fckit_configuration(c_conf)
72 
73 ! Implementation
74 ! --------------
75 call self%create(geom, bg, fg, conf)
76 
78 
79 ! --------------------------------------------------------------------------------------------------
80 
81 subroutine c_mpasjedi_lvc_model2geovars_delete(c_key_self) &
82  bind(c,name='mpasjedi_lvc_model2geovars_delete_f90')
83 
84 integer(c_int), intent(inout) :: c_key_self
85 
86 type(mpasjedi_lvc_model2geovars), pointer :: self
87 
88 ! Linked list
89 ! -----------
90 call mpasjedi_lvc_model2geovars_registry%get(c_key_self, self)
91 
92 ! Implementation
93 ! --------------
94 call self%delete()
95 
96 ! Linked list
97 ! -----------
98 call mpasjedi_lvc_model2geovars_registry%remove(c_key_self)
99 
101 
102 ! --------------------------------------------------------------------------------------------------
103 
105  c_key_self, c_key_geom, c_key_dxm, c_key_dxg) &
106  bind(c,name='mpasjedi_lvc_model2geovars_multiply_f90')
107 
108 integer(c_int), intent(in) :: c_key_self
109 integer(c_int), intent(in) :: c_key_geom
110 integer(c_int), intent(in) :: c_key_dxm
111 integer(c_int), intent(in) :: c_key_dxg
112 
113 type(mpasjedi_lvc_model2geovars), pointer :: self
114 type(mpas_geom), pointer :: geom
115 type(mpas_fields), pointer :: dxm
116 type(mpas_fields), pointer :: dxg
117 
118 ! Linked list
119 ! -----------
120 call mpasjedi_lvc_model2geovars_registry%get(c_key_self,self)
121 call mpas_geom_registry%get(c_key_geom,geom)
122 call mpas_fields_registry%get(c_key_dxm,dxm)
123 call mpas_fields_registry%get(c_key_dxg,dxg)
124 
125 ! Implementation
126 ! --------------
127 call self%multiply(geom, dxm, dxg)
128 
130 
131 ! --------------------------------------------------------------------------------------------------
132 
134  c_key_self, c_key_geom, c_key_dxg, c_key_dxm) &
135  bind(c,name='mpasjedi_lvc_model2geovars_multiplyadjoint_f90')
136 
137 integer(c_int), intent(in) :: c_key_self
138 integer(c_int), intent(in) :: c_key_geom
139 integer(c_int), intent(in) :: c_key_dxg
140 integer(c_int), intent(in) :: c_key_dxm
141 
142 type(mpasjedi_lvc_model2geovars), pointer :: self
143 type(mpas_geom), pointer :: geom
144 type(mpas_fields), pointer :: dxg
145 type(mpas_fields), pointer :: dxm
146 
147 ! Linked list
148 ! -----------
149 call mpasjedi_lvc_model2geovars_registry%get(c_key_self, self)
150 call mpas_geom_registry%get(c_key_geom, geom)
151 call mpas_fields_registry%get(c_key_dxg, dxg)
152 call mpas_fields_registry%get(c_key_dxm, dxm)
153 
154 ! Implementation
155 ! --------------
156 call self%multiplyadjoint(geom, dxg, dxm)
157 
159 
160 ! --------------------------------------------------------------------------------------------------
161 
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 c_mpasjedi_lvc_model2geovars_multiply(c_key_self, c_key_geom, c_key_dxm, c_key_dxg)
subroutine c_mpasjedi_lvc_model2geovars_create(c_key_self, c_key_geom, c_key_bg, c_key_fg, c_conf)
Linked list implementation.
type(registry_t), public mpasjedi_lvc_model2geovars_registry
Linked list interface - defines registry_t type.
subroutine c_mpasjedi_lvc_model2geovars_multiplyadjoint(c_key_self, c_key_geom, c_key_dxg, c_key_dxm)
Fortran derived type to hold MPAS field.
Fortran derived type to hold geometry definition.