Skip to content

Commit

Permalink
Nullify pointers on declaration lines
Browse files Browse the repository at this point in the history
  Added nullification of various pointers where they are declared.  All answers
are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Jul 3, 2018
1 parent 4416ebb commit b196968
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
19 changes: 10 additions & 9 deletions src/SIS_diag_mediator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ module SIS_diag_mediator
module procedure post_data_2d, post_data_3d
end interface post_SIS_data

! 2D/3D axes type to contain 1D axes handles and pointers to masks
!> 2D/3D axes type to contain 1D axes handles and pointers to masks
type, public :: axesType
character(len=15) :: id ! This is the id string for this particular combination of handles
integer :: rank ! The number of dimensions in the list of axes
integer, dimension(:), allocatable :: handles ! Handles to 1D axes
type(SIS_diag_ctrl), pointer :: diag_cs => null()
type(SIS_diag_ctrl), pointer :: diag_cs => null() !< A structure that is used to regulate diagnostic output
end type axesType

! This type is used to represent a diagnostic at the diag_mediator level.
!> This type is used to represent a diagnostic at the diag_mediator level.
type, private :: diag_type
logical :: in_use
integer :: fms_diag_id ! underlying FMS diag id
Expand All @@ -75,8 +75,8 @@ module SIS_diag_mediator
!> The SIS_diag_ctrl data type contains times to regulate diagnostics along with masks and
!! axes to use with diagnostics, and a list of structures with data about each diagnostic.
type, public :: SIS_diag_ctrl
integer :: doc_unit = -1 ! The unit number of a diagnostic documentation file.
! This file is open if doc_unit is > 0.
integer :: doc_unit = -1 !< The unit number of a diagnostic documentation file.
!! This file is open if doc_unit is > 0.

! The following fields are used for the output of the data.
! These give the computational-domain sizes, and are relative to a start value
Expand Down Expand Up @@ -305,7 +305,7 @@ subroutine post_data_2d(diag_field_id, field, diag_cs, is_static, mask)
logical :: i_data, j_data
integer :: isv, iev, jsv, jev
integer :: fms_diag_id
type(diag_type), pointer :: diag
type(diag_type), pointer :: diag => NULL()

is_stat = .false. ; if (present(is_static)) is_stat = is_static

Expand Down Expand Up @@ -411,7 +411,7 @@ subroutine post_data_3d(diag_field_id, field, diag_cs, is_static, mask)
logical :: is_stat
integer :: isv, iev, jsv, jev
integer :: fms_diag_id
type(diag_type), pointer :: diag
type(diag_type), pointer :: diag => NULL()

is_stat = .false. ; if (present(is_static)) is_stat = is_static

Expand Down Expand Up @@ -563,8 +563,9 @@ function register_SIS_diag_field(module_name, field_name, axes, init_time, &
character(len=240) :: mesg
real :: MOM_missing_value
integer :: primary_id, fms_id
type(SIS_diag_ctrl), pointer :: diag_cs !< A structure that is used to regulate diagnostic output
type(diag_type), pointer :: diag
type(SIS_diag_ctrl), pointer :: diag_cs => NULL() ! A structure that is used
! to regulate diagnostic output
type(diag_type), pointer :: diag => NULL()

MOM_missing_value = axes%diag_cs%missing_value
if(present(missing_value)) MOM_missing_value = missing_value
Expand Down
4 changes: 2 additions & 2 deletions src/SIS_dyn_trans.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ module SIS_dyn_trans
! globally summed ice statistics and conservation checks.
type(time_type) :: write_ice_stats_time ! The next time to write out the ice statistics.

type(time_type), pointer :: Time ! A pointer to the ocean model's clock.
type(SIS_diag_ctrl), pointer :: diag ! A structure that is used to regulate the
type(time_type), pointer :: Time => NULL() ! A pointer to the ocean model's clock.
type(SIS_diag_ctrl), pointer :: diag => NULL() ! A structure that is used to regulate the
! timing of diagnostic output.

integer :: id_fax=-1, id_fay=-1, id_xprt=-1, id_mib=-1, id_mi=-1
Expand Down
2 changes: 1 addition & 1 deletion src/SIS_sum_output_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module SIS_sum_output_type
!! time that write_ice_statistics was called, in J m-2.
salt_col_prev !< The column integrated salt that was in the ice and snow the last
!! time that write_ice_statistics was called, in kg m-2.

type(EFP_type) :: fresh_water_in_EFP !< An extended fixed point version of fresh_water_in
type(EFP_type) :: net_salt_in_EFP !< An extended fixed point version of net_salt_in
type(EFP_type) :: net_heat_in_EFP !< An extended fixed point version of net_heat_in
Expand Down
28 changes: 16 additions & 12 deletions src/SIS_transport.F90
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,14 @@ subroutine ice_transport(part_sz, mH_ice, mH_snow, mH_pond, uc, vc, TrReg, &
real, dimension(SZI_(G),SZJ_(G)), intent(inout) :: rdg_vosh !< rate of ice volume shifted from level to ridged ice

! Local variables
real, dimension(:,:,:,:), pointer :: &
heat_ice=>NULL(), & ! Pointers to the enth_ice and enth_snow arrays from the
heat_snow=>NULL() ! SIS tracer registry. enth_ice is the enthalpy of the
! ice in each category and layer, while enth_snow is the
! enthalpy of the snow atop the ice in each category.
! Both are in enth_units (J or rescaled).
real, dimension(:,:,:,:), &
pointer :: heat_ice=>NULL() ! Pointer to the enth_ice array from the SIS tracer registry.
! Enth_ice is the enthalpy of the ice in each category and layer, in
! enth_units (J or rescaled).
real, dimension(:,:,:,:), &
pointer :: heat_snow=>NULL() ! Pointer to the enth_snow array from the SIS tracer registry.
! Enth_snow is the enthalpy of the snow atop the ice in each category, in
! enth_units (J or rescaled).
real, dimension(SZIB_(G),SZJ_(G),SZCAT_(IG)) :: &
uh_ice, & ! Zonal fluxes of ice in H m2 s-1.
uh_snow, & ! Zonal fluxes of snow in H m2 s-1.
Expand Down Expand Up @@ -994,12 +996,14 @@ subroutine get_total_enthalpy(mH_ice, mH_snow, part_sz, TrReg, &
type(EFP_type), intent(out) :: enth_snow !< The globally integrated total snow enthalpy in J.

! Local variables
real, dimension(:,:,:,:), pointer :: &
heat_ice=>NULL(), & ! Pointers to the enth_ice and enth_snow arrays from the
heat_snow=>NULL() ! SIS tracer registry. enth_ice is the enthalpy of the
! ice in each category and layer, while enth_snow is the
! enthalpy of the snow atop the ice in each category.
! Both are in enth_units (J or rescaled).
real, dimension(:,:,:,:), &
pointer :: heat_ice=>NULL() ! Pointer to the enth_ice array from the SIS tracer registry.
! Enth_ice is the enthalpy of the ice in each category and layer, in
! enth_units (J or rescaled).
real, dimension(:,:,:,:), &
pointer :: heat_snow=>NULL() ! Pointer to the enth_snow array from the SIS tracer registry.
! Enth_snow is the enthalpy of the snow atop the ice in each category, in
! enth_units (J or rescaled).
real, dimension(G%isc:G%iec, G%jsc:G%jec) :: sum_enth_ice, sum_enth_snow
real :: total, I_Nk
integer :: i, j, k, m, isc, iec, jsc, jec, nLay
Expand Down

0 comments on commit b196968

Please sign in to comment.