Skip to content

Commit

Permalink
fix: change fms_diag_accept_data into a subroutine (#1610)
Browse files Browse the repository at this point in the history
  • Loading branch information
uramirez8707 authored Nov 14, 2024
1 parent 174105e commit 23df6d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ LOGICAL FUNCTION diag_send_data(diag_field_id, field, time, is_in, js_in, ks_in,
allocate(mask_remap(1:size(mask,1), 1:size(mask,2), 1:size(mask,3), 1))
mask_remap(:,:,:,1) = mask
endif
diag_send_data = fms_diag_object%fms_diag_accept_data(diag_field_id, field_remap, mask_remap, rmask_remap, &
call fms_diag_object%fms_diag_accept_data(diag_field_id, field_remap, mask_remap, rmask_remap, &
time, is_in, js_in, ks_in, ie_in, je_in, ke_in, weight, &
err_msg)
deallocate (field_remap)
Expand Down Expand Up @@ -3518,7 +3518,7 @@ LOGICAL FUNCTION send_data_4d(diag_field_id, field, time, is_in, js_in, ks_in, &
if (present(mask)) mask_local = mask
if (present(rmask)) rmask_local = rmask

send_data_4d = fms_diag_object%fms_diag_accept_data(diag_field_id, field, mask_local, rmask_local, &
call fms_diag_object%fms_diag_accept_data(diag_field_id, field, mask_local, rmask_local, &
time, is_in, js_in, ks_in, ie_in, je_in, ke_in, weight, &
err_msg)

Expand Down
9 changes: 2 additions & 7 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ end function fms_diag_axis_init
!! multithreaded case.
!! \note If some of the diag manager is offloaded in the future, then it should be treated similarly
!! to the multi-threaded option for processing later
logical function fms_diag_accept_data (this, diag_field_id, field_data, mask, rmask, &
subroutine fms_diag_accept_data (this, diag_field_id, field_data, mask, rmask, &
time, is_in, js_in, ks_in, &
ie_in, je_in, ke_in, weight, err_msg)
class(fmsDiagObject_type),TARGET, INTENT(inout) :: this !< Diaj_obj to fill
Expand Down Expand Up @@ -681,8 +681,6 @@ logical function fms_diag_accept_data (this, diag_field_id, field_data, mask, rm
!$omp end critical
call this%FMS_diag_fields(diag_field_id)%set_data_buffer(field_data, oor_mask, field_weight, &
is, js, ks, ie, je, ke)
fms_diag_accept_data = .TRUE.
return
else

!< At this point if we are no longer in an openmp region or running with 1 thread
Expand Down Expand Up @@ -710,13 +708,10 @@ logical function fms_diag_accept_data (this, diag_field_id, field_data, mask, rm
if(.not. this%FMS_diag_fields(diag_field_id)%has_mask_allocated()) &
call this%FMS_diag_fields(diag_field_id)%allocate_mask(oor_mask)
call this%FMS_diag_fields(diag_field_id)%set_mask(oor_mask, field_info)
return
end if main_if
!> Return false if nothing is done
fms_diag_accept_data = .FALSE.
return
#endif
end function fms_diag_accept_data
end subroutine fms_diag_accept_data

!< @brief Do the math for all the buffers
subroutine do_buffer_math(this)
Expand Down
4 changes: 2 additions & 2 deletions test_fms/diag_manager/test_diag_manager2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ diag_files:
kind: r4
- module: atm_mod
var_name: var7
reduction: average
reduction: none
kind: r4
- file_name: file4
freq: 6 hours
Expand Down Expand Up @@ -1050,7 +1050,7 @@ diag_files:
dimensions: time grid_index
- module: atm_mod
var_name: var7
reduction: average
reduction: none
kind: r4
output_name:
long_name:
Expand Down
5 changes: 2 additions & 3 deletions test_fms/diag_manager/test_modern_diag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ program test_modern_diag

call allocate_dummy_data(var_data, domain, Domain_cube_sph, land_domain, nz)
Time_step = set_time (3600,0) !< 1 hour
call set_dummy_data(var_data, 666)
used = send_data(id_var8, var_data%var6, Time)
do i=1,23
Time = Time + Time_step
call set_dummy_data(var_data, i)
Expand All @@ -210,9 +212,6 @@ program test_modern_diag
used = send_data(id_var6, var_data%var6, Time)
used = send_data(id_var7, var_data%var6, Time)

!TODO I don't know about this (scalar field) or how this is suppose to work #WUT
used = send_data(id_var8, var_data%var6, Time)

call diag_send_complete(Time_step)
enddo
call deallocate_dummy_data(var_data)
Expand Down

0 comments on commit 23df6d7

Please sign in to comment.