@@ -23,6 +23,10 @@ module C_BRIDGE_TO_MAPL
2323 public :: MAPLpy_ESMF_TimeIntervalGet
2424 public :: MAPLpy_Associated
2525
26+ character (len= ESMF_MAXSTR) :: IAm
27+ integer :: STATUS
28+ integer :: RC ! return code
29+
2630 CONTAINS
2731
2832 function MAPLPy_ESMF_AttributeGet_1D_int (esmf_state_c_ptr , name_c_ptr , name_len ) result(return_value) bind(c, name= " MAPLPy_ESMF_AttributeGet_1D_int" )
@@ -45,7 +49,8 @@ function MAPLPy_ESMF_AttributeGet_1D_int(esmf_state_c_ptr, name_c_ptr, name_len)
4549 call c_f_pointer(esmf_state_c_ptr, state)
4650
4751 ! Call function
48- call ESMF_AttributeGet(state, name= varname, value= return_value) ! Need RC=Status and handling
52+ call ESMF_AttributeGet(state, name= varname, value= return_value, RC= STATUS)
53+ VERIFY_(STATUS)
4954
5055 end function MAPLPy_ESMF_AttributeGet_1D_int
5156
@@ -65,7 +70,8 @@ subroutine MAPLPy_ESMF_MethodExecute(esmf_state_c_ptr, label_c_ptr, label_len) b
6570 ! Turn the ESMF State C pointer to a Fortran pointer
6671 call c_f_pointer(esmf_state_c_ptr, state)
6772
68- call ESMF_MethodExecute(state, label= label)
73+ call ESMF_MethodExecute(state, label= label, RC= STATUS)
74+ VERIFY_(STATUS)
6975
7076 end subroutine MAPLPy_ESMF_MethodExecute
7177
@@ -90,8 +96,10 @@ function MAPLpy_GetPointer_via_ESMFAttr(esmf_state_c_ptr, name_c_ptr, name_len)
9096 ! Turn the ESMF State C pointer to a Fortran pointer
9197 call c_f_pointer(esmf_state_c_ptr, state)
9298
93- call ESMF_AttributeGet(state, name= name, value= field_name_from_esmf)
94- call MAPL_GetPointer(state, f_ptr, trim (field_name_from_esmf))
99+ call ESMF_AttributeGet(state, name= name, value= field_name_from_esmf, RC= STATUS)
100+ VERIFY_(STATUS)
101+ call MAPL_GetPointer(state, f_ptr, trim (field_name_from_esmf), RC= STATUS)
102+ VERIFY_(STATUS)
95103 c_data_ptr= c_loc(f_ptr)
96104
97105 end function
@@ -117,10 +125,12 @@ function MAPLpy_GetPointer_2D(esmf_state_c_ptr, name_c_ptr, name_len, alloc) res
117125 ! Turn the ESMF State C pointer to a Fortran pointer
118126 call c_f_pointer(esmf_state_c_ptr, state)
119127
120- call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc))
121- if (associated (f_ptr)) then
122- c_data_ptr= c_loc(f_ptr)
123- endif
128+ call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc), RC= STATUS)
129+ VERIFY_(STATUS)
130+ PRINT * , " Get pointer 2D " , trim (name), " " , logical (alloc), " " , loc(f_ptr), " " , c_loc(f_ptr)
131+ ! if (associated(f_ptr)) then
132+ c_data_ptr= c_loc(f_ptr)
133+ ! endif
124134
125135 end function
126136
@@ -145,7 +155,8 @@ function MAPLpy_GetPointer_2D_associated(esmf_state_c_ptr, name_c_ptr, name_len,
145155 ! Turn the ESMF State C pointer to a Fortran pointer
146156 call c_f_pointer(esmf_state_c_ptr, state)
147157
148- call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc))
158+ call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc), RC= STATUS)
159+ VERIFY_(STATUS)
149160 is_associated = associated (f_ptr)
150161
151162 end function
@@ -171,7 +182,9 @@ function MAPLpy_GetPointer_3D(esmf_state_c_ptr, name_c_ptr, name_len, alloc) res
171182 ! Turn the ESMF State C pointer to a Fortran pointer
172183 call c_f_pointer(esmf_state_c_ptr, state)
173184
174- call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc))
185+ call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc), RC= STATUS)
186+ PRINT * , " Get pointer 3D " , trim (name), " " , logical (alloc), " " , loc(f_ptr), " " , c_loc(f_ptr)
187+ VERIFY_(STATUS)
175188
176189 c_data_ptr= c_loc(f_ptr)
177190
@@ -198,7 +211,8 @@ function MAPLpy_GetPointer_3D_associated(esmf_state_c_ptr, name_c_ptr, name_len,
198211 ! Turn the ESMF State C pointer to a Fortran pointer
199212 call c_f_pointer(esmf_state_c_ptr, state)
200213
201- call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc))
214+ call MAPL_GetPointer(state, f_ptr, trim (name), alloc= logical (alloc), RC= STATUS)
215+ VERIFY_(STATUS)
202216 is_associated = associated (f_ptr)
203217
204218 end function
@@ -237,7 +251,8 @@ function MAPLpy_GetResource_Float(state_c_ptr, name_c_ptr, name_len, default) re
237251
238252 ! Use fortran type & cast back to C types
239253 local_d = default
240- call MAPL_GetResource(state, local_r, label= trim (name), default= local_d)
254+ call MAPL_GetResource(state, local_r, label= trim (name), default= local_d, RC= STATUS)
255+ VERIFY_(STATUS)
241256 result = local_r
242257 end function
243258
@@ -263,7 +278,8 @@ function MAPLpy_GetResource_Bool(mapl_metacomp_c_ptr, name_c_ptr, name_len, defa
263278 call c_f_pointer(mapl_metacomp_c_ptr, state)
264279
265280 local_d = default
266- call MAPL_GetResource(state, local_r, label= trim (name), default= local_d)
281+ call MAPL_GetResource(state, local_r, label= trim (name), default= local_d, RC= STATUS)
282+ VERIFY_(STATUS)
267283 result = local_r
268284
269285 end function
@@ -288,7 +304,8 @@ function MAPLpy_GetResource_Int32(state_c_ptr, name_c_ptr, name_len, default) re
288304 call c_f_pointer(state_c_ptr, state)
289305
290306 local_d = default
291- call MAPL_GetResource(state, local_r, label= trim (name), default= local_d)
307+ call MAPL_GetResource(state, local_r, label= trim (name), default= local_d, RC= STATUS)
308+ VERIFY_(STATUS)
292309 result = local_r
293310
294311 end function
0 commit comments