Skip to content

Commit

Permalink
Always buffer the data
Browse files Browse the repository at this point in the history
  • Loading branch information
uramirez8707 committed Mar 11, 2024
1 parent ad05ea9 commit be5de2a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions diag_manager/fms_diag_field_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ module fms_diag_field_object_mod
procedure :: get_dimnames
procedure :: get_var_skind
procedure :: get_longname_to_write
procedure :: get_multiple_send_data
procedure :: write_field_metadata
procedure :: write_coordinate_attribute
procedure :: get_math_needs_to_be_done
Expand Down Expand Up @@ -1072,6 +1073,13 @@ pure function get_var_skind(this, field_yaml) &

end function get_var_skind

pure function get_multiple_send_data(this) &
result(rslt)
class (fmsDiagField_type), intent(in) :: this !< diag field
logical :: rslt
rslt = this%multiple_send_data
end function get_multiple_send_data

!> @brief Determine the long name to write for the field
!! @return Long name to write
pure function get_longname_to_write(this, field_yaml) &
Expand Down
5 changes: 5 additions & 0 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,11 @@ logical function fms_diag_accept_data (this, diag_field_id, field_data, mask, rm
shape(field_data))
endif

!< If send data is called multiple times, buffer the data
!! This is so that the other reduction methods work and just averaging
if (this%FMS_diag_fields(diag_field_id)%get_multiple_send_data()) &
buffer_the_data = .true.

!If this is true, buffer data
main_if: if (buffer_the_data) then
!> Only 1 thread allocates the output buffer and sets set_math_needs_to_be_done
Expand Down

0 comments on commit be5de2a

Please sign in to comment.