Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ libdiag_manager_la_SOURCES = \
fms_diag_axis_object.F90 \
fms_diag_object_container.F90 \
fms_diag_dlinked_list.F90 \
fms_diag_buffer.F90 \
fms_diag_output_buffer.F90 \
fms_diag_time_reduction.F90 \
fms_diag_outfield.F90 \
fms_diag_elem_weight_procs.F90 \
Expand All @@ -66,7 +66,7 @@ diag_table_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) diag_util_mod.$(FC_MODEX
fms_diag_yaml_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT)
fms_diag_object_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_file_object_mod.$(FC_MODEXT) fms_diag_field_object_mod.$(FC_MODEXT) fms_diag_yaml_mod.$(FC_MODEXT) \
fms_diag_time_utils_mod.$(FC_MODEXT) \
fms_diag_buffer_mod.$(FC_MODEXT)
fms_diag_output_buffer_mod.$(FC_MODEXT)
fms_diag_field_object_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_yaml_mod.$(FC_MODEXT) fms_diag_time_utils_mod.$(FC_MODEXT) \
fms_diag_axis_object_mod.$(FC_MODEXT)
fms_diag_file_object_mod.$(FC_MODEXT): diag_data_mod.$(FC_MODEXT) fms_diag_yaml_mod.$(FC_MODEXT) fms_diag_field_object_mod.$(FC_MODEXT) fms_diag_time_utils_mod.$(FC_MODEXT) \
Expand Down Expand Up @@ -103,7 +103,7 @@ MODFILES = \
fms_diag_axis_object_mod.$(FC_MODEXT) \
fms_diag_dlinked_list_mod.$(FC_MODEXT) \
fms_diag_object_container_mod.$(FC_MODEXT) \
fms_diag_buffer_mod.$(FC_MODEXT) \
fms_diag_output_buffer_mod.$(FC_MODEXT) \
diag_manager_mod.$(FC_MODEXT) \
fms_diag_time_reduction_mod.$(FC_MODEXT) \
fms_diag_outfield_mod.$(FC_MODEXT) \
Expand Down
20 changes: 10 additions & 10 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module fms_diag_object_mod
&diagDomain_t, get_domain_and_domain_type, diagDomain2d_t, &
&fmsDiagAxisContainer_type, fms_diag_axis_object_end, fmsDiagFullAxis_type, &
&parse_compress_att, get_axis_id_from_name
use fms_diag_buffer_mod
use fms_diag_output_buffer_mod
#endif
#if defined(_OPENMP)
use omp_lib
Expand All @@ -49,7 +49,7 @@ module fms_diag_object_mod
!TODO: Remove FMS prefix from variables in this type
class(fmsDiagFileContainer_type), allocatable :: FMS_diag_files (:) !< array of diag files
class(fmsDiagField_type), allocatable :: FMS_diag_fields(:) !< Array of diag fields
type(fmsDiagBufferContainer_type), allocatable :: FMS_diag_buffers(:) !< array of buffer objects
type(fmsDiagOutputBufferContainer_type), allocatable :: FMS_diag_output_buffers(:) !< array of output buffer objects

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add one for each variable in the diag_table.yaml

integer, private :: registered_buffers = 0 !< number of registered buffers, per dimension
class(fmsDiagAxisContainer_type), allocatable :: diag_axis(:) !< Array of diag_axis
type(time_type) :: current_model_time !< The current model time
Expand Down Expand Up @@ -113,7 +113,7 @@ subroutine fms_diag_object_init (this,diag_subset_output)
this%axes_initialized = fms_diag_axis_object_init(this%diag_axis)
this%files_initialized = fms_diag_files_object_init(this%FMS_diag_files)
this%fields_initialized = fms_diag_fields_object_init(this%FMS_diag_fields)
this%buffers_initialized = fms_diag_buffer_init(this%FMS_diag_buffers, SIZE(diag_yaml%get_diag_fields()))
this%buffers_initialized = fms_diag_output_buffer_init(this%FMS_diag_output_buffers,SIZE(diag_yaml%get_diag_fields()))
this%registered_variables = 0
this%registered_axis = 0
this%current_model_time = get_base_time()
Expand All @@ -139,12 +139,12 @@ subroutine fms_diag_object_end (this, time)

call this%fms_diag_do_io(is_end_of_run=.true.)
!TODO: Deallocate diag object arrays and clean up all memory
do i=1, size(this%FMS_diag_buffers)
if(allocated(this%FMS_diag_buffers(i)%diag_buffer_obj)) then
call this%FMS_diag_buffers(i)%diag_buffer_obj%flush_buffer()
do i=1, size(this%FMS_diag_output_buffers)
if(allocated(this%FMS_diag_output_buffers(i)%diag_buffer_obj)) then
call this%FMS_diag_output_buffers(i)%diag_buffer_obj%flush_buffer()
endif
enddo
deallocate(this%FMS_diag_buffers)
deallocate(this%FMS_diag_output_buffers)
this%axes_initialized = fms_diag_axis_object_end(this%diag_axis)
this%initialized = .false.
call diag_yaml_object_end
Expand Down Expand Up @@ -721,10 +721,10 @@ function get_diag_buffer(this, bufferid) &
result(rslt)
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. LBOUND(this%FMS_diag_buffers, 1))) &
class(fmsDiagOutputBuffer_class),allocatable:: rslt
if( (bufferid .gt. UBOUND(this%FMS_diag_output_buffers, 1)) .or. (bufferid .lt. LBOUND(this%FMS_diag_output_buffers, 1))) &
call mpp_error(FATAL, 'get_diag_bufer: invalid bufferid given')
rslt = this%FMS_diag_buffers(bufferid)%diag_buffer_obj
rslt = this%FMS_diag_output_buffers(bufferid)%diag_buffer_obj
end function
#endif

Expand Down
Loading