Skip to content

Commit

Permalink
fix bounds typo and change get_buffer to reference its argument inste…
Browse files Browse the repository at this point in the history
…ad of the module variable (NOAA-GFDL#1160)

Co-authored-by: rem1776 <[email protected]>
  • Loading branch information
2 people authored and rem1776 committed May 1, 2024
1 parent 0e27e9a commit 28ef1c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions diag_manager/fms_diag_buffer.F90
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ module fms_diag_buffer_mod
procedure :: flush_buffer
procedure :: remap_buffer
procedure :: set_buffer_id
! TODO deferred routines, will require some interfaces
! TODO could make these 'defered' ie. declared here but defined in each child type
! holding off cause the class(*) + polymorphism in here is probably already enough to upset the gods of compilation
!procedure(allocate_buffer), deferred :: allocate_buffer
!procedure, deferred :: get_buffer
!procedure, deferred :: initialize_buffer
Expand All @@ -64,7 +65,7 @@ module fms_diag_buffer_mod

!> Scalar buffer type to extend fmsDiagBufferContainer_type
type, extends(fmsDiagBuffer_class) :: buffer0d_type
class(*), allocatable :: buffer(:) !< "scalar" numberic buffer value
class(*), allocatable :: buffer(:) !< "scalar" numeric buffer value
!! will only be allocated to hold 1 value
class(*), allocatable :: counter(:) !< (x,y,z, time-of-day) used in the time averaging functions
contains
Expand Down
4 changes: 2 additions & 2 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ function get_diag_buffer(this, bufferid) &
class(fmsDiagObject_type), intent(in) :: this
integer, intent(in) :: bufferid
class(fmsDiagBuffer_class),allocatable:: rslt
if( (bufferid .gt. UBOUND(this%FMS_diag_buffers, 1)) .or. (bufferid .lt. UBOUND(this%FMS_diag_buffers, 1))) &
if( (bufferid .gt. UBOUND(this%FMS_diag_buffers, 1)) .or. (bufferid .lt. LBOUND(this%FMS_diag_buffers, 1))) &
call mpp_error(FATAL, 'get_diag_bufer: invalid bufferid given')
rslt = fms_diag_object%FMS_diag_buffers(bufferid)%diag_buffer_obj
rslt = this%FMS_diag_buffers(bufferid)%diag_buffer_obj
end function
#endif

Expand Down

0 comments on commit 28ef1c7

Please sign in to comment.