ESMF_CFIODestroy Subroutine

public subroutine ESMF_CFIODestroy(cfio, rc)

ESMF_CFIODestroy – destructor for a CFIO object

Arguments

Type IntentOptional Attributes Name
type(ESMF_CFIO), intent(inout) :: cfio
integer, intent(out), optional :: rc

Calls

proc~~esmf_cfiodestroy~~CallsGraph proc~esmf_cfiodestroy ESMF_CFIODestroy proc~cfio_close CFIO_Close proc~esmf_cfiodestroy->proc~cfio_close proc~esmf_cfiogriddestroy ESMF_CFIOGridDestroy proc~esmf_cfiodestroy->proc~esmf_cfiogriddestroy proc~esmf_cfiovarinfodestroy ESMF_CFIOVarInfoDestroy proc~esmf_cfiodestroy->proc~esmf_cfiovarinfodestroy ncclos ncclos proc~cfio_close->ncclos proc~err err proc~cfio_close->proc~err proc~esmf_cfiovarinfodestroy->proc~esmf_cfiogriddestroy proc~cnodedestroy cNodeDestroy proc~esmf_cfiovarinfodestroy->proc~cnodedestroy proc~inodedestroy iNodeDestroy proc~esmf_cfiovarinfodestroy->proc~inodedestroy proc~rnodedestroy rNodeDestroy proc~esmf_cfiovarinfodestroy->proc~rnodedestroy

Called by

proc~~esmf_cfiodestroy~~CalledByGraph proc~esmf_cfiodestroy ESMF_CFIODestroy none~find~31 CFIOCollection%find none~find~31->proc~esmf_cfiodestroy proc~mapl_cfiodestroy MAPL_CFIODestroy proc~mapl_cfiodestroy->proc~esmf_cfiodestroy interface~esmf_iodestroy ESMF_ioDestroy interface~esmf_iodestroy->proc~mapl_cfiodestroy proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->none~find~31 proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~31 proc~test_main~3 test_main proc~test_main~3->interface~esmf_iodestroy program~utcfio~2 utCFIO program~utcfio~2->proc~test_main~3

Source Code

      subroutine ESMF_CFIODestroy (cfio, rc)
!
! !INPUT PARAMETERS:
!
      integer, intent(out), OPTIONAL :: rc      ! Error return code:      
                                                ! 0   all is well
!
! !INPUT/OUTPUT PARAMETERS:
!
      type(ESMF_CFIO), intent(inout) :: cfio       ! CFIO object

!
!------------------------------------------------------------------------------
      integer :: rtcode
      integer :: i

      if ( cfio%isOpen ) call CFIO_Close(cfio%fid, rtcode)
      if ( associated(cfio%varObjs) ) then
         do i = 1, size(cfio%varObjs)
            call ESMF_CFIOVarInfoDestroy (cfio%varObjs(i), rtcode)
         end do
         deallocate(cfio%varObjs, stat=rtcode)
      end if
      if ( associated(cfio%grids) ) then
         if (cfio%isGridSet) then
            do i = 1, size(cfio%grids)
               call ESMF_CFIOGridDestroy (cfio%grids(i), rtcode)
            end do
         end if

         deallocate(cfio%grids, stat=rtcode)
      end if

      if (associated(cfio%attCharCnts)) deallocate(cfio%attCharCnts,         &
         stat=rtcode)
      if (associated(cfio%attRealCnts)) deallocate(cfio%attRealCnts,         &
         stat=rtcode)
      if (associated(cfio%attIntCnts)) deallocate(cfio%attIntCnts,           &
         stat=rtcode)

      if (associated(cfio%attCharNames)) deallocate(cfio%attCharNames,       &
         stat=rtcode)
      if (associated(cfio%attRealNames)) deallocate(cfio%attRealNames,       &
         stat=rtcode)
      if (associated(cfio%attIntNames)) deallocate(cfio%attIntNames,         &
         stat=rtcode)

      if (associated(cfio%attChars)) deallocate(cfio%attChars, stat=rtcode)
      if (associated(cfio%attReals)) deallocate(cfio%attReals, stat=rtcode)
      if (associated(cfio%attInts)) deallocate(cfio%attInts, stat=rtcode)

      if (associated(cfio%iList)) deallocate(cfio%iList, stat=rtcode)
      if (associated(cfio%rList)) deallocate(cfio%rList, stat=rtcode)
      if (associated(cfio%cList)) deallocate(cfio%cList, stat=rtcode)

      rtcode = 0
      if ( present(rc) ) rc = rtcode

      end subroutine ESMF_CFIODestroy