MPAS-JEDI
mpasjedi_linvarcha_c2a_interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2018-2021 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 fckit_configuration_module, only: fckit_configuration
11 
12 use oops_variables_mod
13 
14 !use kinds
17 use mpasjedi_linvarcha_c2a_mod !, only: mpasjedi_linvarcha_c2a
18 
19 implicit none
20 
21 private
23 
24 ! --------------------------------------------------------------------------------------------------
25 
26 #define LISTED_TYPE mpasjedi_linvarcha_c2a
27 
28 !> Linked list interface - defines registry_t type
29 #include "oops/util/linkedList_i.f"
30 
31 !> Global registry
33 
34 ! --------------------------------------------------------------------------------------------------
35 
36 contains
37 
38 ! --------------------------------------------------------------------------------------------------
39 
40 !> Linked list implementation
41 #include "oops/util/linkedList_c.f"
42 
43 ! --------------------------------------------------------------------------------------------------
44 
46  c_key_self, c_key_geom, c_key_bg, c_key_fg, c_conf, c_vars) &
47  bind(c,name='mpasjedi_linvarcha_c2a_create_f90')
48 
49 !implicit none
50 integer(c_int), intent(inout) :: c_key_self !< Change variable structure
51 integer(c_int), intent(in) :: c_key_geom !< Geom key
52 integer(c_int), intent(in) :: c_key_bg !< Background key
53 integer(c_int), intent(in) :: c_key_fg !< First guess key
54 type(c_ptr), value, intent(in) :: c_conf !< Configuration
55 type(c_ptr), value, intent(in) :: c_vars !< List of input variables
56 
57 type(mpasjedi_linvarcha_c2a), pointer :: self
58 type(mpas_geom), pointer :: geom
59 type(mpas_fields), pointer :: bg
60 type(mpas_fields), pointer :: fg
61 type(fckit_configuration) :: f_conf
62 type(oops_variables) :: vars
63 
65 call mpasjedi_linvarcha_c2a_registry%add(c_key_self)
66 call mpasjedi_linvarcha_c2a_registry%get(c_key_self, self)
67 
68 call mpas_geom_registry%get(c_key_geom,geom)
69 call mpas_fields_registry%get(c_key_bg,bg)
70 call mpas_fields_registry%get(c_key_fg,fg)
71 
72 f_conf = fckit_configuration(c_conf)
73 vars = oops_variables(c_vars)
74 
75 call self%create(geom, bg, fg, f_conf, vars)
76 
78 
79 ! ------------------------------------------------------------------------------
80 
81 subroutine c_mpasjedi_linvarcha_c2a_delete(c_key_self) &
82  bind(c,name='mpasjedi_linvarcha_c2a_delete_f90')
83 
84 !implicit none
85 integer(c_int), intent(inout) :: c_key_self !< Change variable structure
86 
87 type(mpasjedi_linvarcha_c2a), pointer :: self
88 
89 call mpasjedi_linvarcha_c2a_registry%get(c_key_self,self)
90 call self%delete()
91 call mpasjedi_linvarcha_c2a_registry%remove(c_key_self)
92 
94 
95 ! ------------------------------------------------------------------------------
96 
98  c_key_self, c_key_geom, c_key_in, c_key_out) &
99  bind(c,name='mpasjedi_linvarcha_c2a_multiply_f90')
100 
101 !implicit none
102 integer(c_int), intent(in) :: c_key_self
103 integer(c_int), intent(in) :: c_key_geom
104 integer(c_int), intent(in) :: c_key_in
105 integer(c_int), intent(in) :: c_key_out
106 
107 type(mpasjedi_linvarcha_c2a), pointer :: self
108 type(mpas_geom), pointer :: geom
109 type(mpas_fields), pointer :: xin
110 type(mpas_fields), pointer :: xout
111 
112 call mpasjedi_linvarcha_c2a_registry%get(c_key_self,self)
113 call mpas_geom_registry%get(c_key_geom, geom)
114 call mpas_fields_registry%get(c_key_in,xin)
115 call mpas_fields_registry%get(c_key_out,xout)
116 
117 call self%multiply(geom,xin,xout)
118 
120 
121 ! ----------------------------------------------------------------------------
122 
124  c_key_self, c_key_geom, c_key_in, &
125  c_key_out) bind (c,name='mpasjedi_linvarcha_c2a_multiplyadjoint_f90')
126 
127 !implicit none
128 integer(c_int), intent(in) :: c_key_self
129 integer(c_int), intent(in) :: c_key_geom
130 integer(c_int), intent(in) :: c_key_in
131 integer(c_int), intent(in) :: c_key_out
132 
133 type(mpasjedi_linvarcha_c2a), pointer :: self
134 type(mpas_geom), pointer :: geom
135 type(mpas_fields), pointer :: xin
136 type(mpas_fields), pointer :: xout
137 
138 call mpasjedi_linvarcha_c2a_registry%get(c_key_self,self)
139 call mpas_geom_registry%get(c_key_geom, geom)
140 call mpas_fields_registry%get(c_key_in,xin)
141 call mpas_fields_registry%get(c_key_out,xout)
142 
143 call self%multiplyadjoint(geom,xin,xout)
144 
146 
147 ! ----------------------------------------------------------------------------
148 
149 ! ------------------------------------------------------------------------------
150 
152  c_key_self, c_key_geom, c_key_in, c_key_out) &
153  bind(c,name='mpasjedi_linvarcha_c2a_multiplyinverse_f90')
154 
155 !implicit none
156 integer(c_int), intent(in) :: c_key_self
157 integer(c_int), intent(in) :: c_key_geom
158 integer(c_int), intent(in) :: c_key_in
159 integer(c_int), intent(in) :: c_key_out
160 
161 type(mpasjedi_linvarcha_c2a), pointer :: self
162 type(mpas_geom), pointer :: geom
163 type(mpas_fields), pointer :: xin
164 type(mpas_fields), pointer :: xout
165 
166 call mpasjedi_linvarcha_c2a_registry%get(c_key_self,self)
167 call mpas_geom_registry%get(c_key_geom, geom)
168 call mpas_fields_registry%get(c_key_in,xin)
169 call mpas_fields_registry%get(c_key_out,xout)
170 
171 call self%multiplyinverse(geom,xin,xout)
172 
174 
175 ! ----------------------------------------------------------------------------
176 
178  c_key_self, c_key_geom, c_key_in, &
179  c_key_out) bind (c,name='mpasjedi_linvarcha_c2a_multiplyinverseadjoint_f90')
180 
181 !implicit none
182 integer(c_int), intent(in) :: c_key_self
183 integer(c_int), intent(in) :: c_key_geom
184 integer(c_int), intent(in) :: c_key_in
185 integer(c_int), intent(in) :: c_key_out
186 
187 type(mpasjedi_linvarcha_c2a), pointer :: self
188 type(mpas_geom), pointer :: geom
189 type(mpas_fields), pointer :: xin
190 type(mpas_fields), pointer :: xout
191 
192 call mpasjedi_linvarcha_c2a_registry%get(c_key_self,self)
193 call mpas_geom_registry%get(c_key_geom, geom)
194 call mpas_fields_registry%get(c_key_in,xin)
195 call mpas_fields_registry%get(c_key_out,xout)
196 
197 call self%multiplyinverseadjoint(geom,xin,xout)
198 
200 
201 ! ----------------------------------------------------------------------------
202 
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_linvarcha_c2a_create(c_key_self, c_key_geom, c_key_bg, c_key_fg, c_conf, c_vars)
Linked list implementation.
subroutine c_mpasjedi_linvarcha_c2a_multiplyadjoint(c_key_self, c_key_geom, c_key_in, c_key_out)
type(registry_t), public mpasjedi_linvarcha_c2a_registry
Linked list interface - defines registry_t type.
subroutine c_mpasjedi_linvarcha_c2a_multiply(c_key_self, c_key_geom, c_key_in, c_key_out)
subroutine c_mpasjedi_linvarcha_c2a_multiplyinverse(c_key_self, c_key_geom, c_key_in, c_key_out)
subroutine c_mpasjedi_linvarcha_c2a_multiplyinverseadjoint(c_key_self, c_key_geom, c_key_in, c_key_out)
Fortran derived type to hold MPAS field.
Fortran derived type to hold geometry definition.
Fortran derived type to hold configuration data for the B mat variable change.