MAPL_CFIODestroy Subroutine

public subroutine MAPL_CFIODestroy(MCFIO, RC)

The subroutine MAPL_CFIODestroy destroys a MAPL CFIO object. It closes any file associated with it and deallocates memory.

Arguments

Type IntentOptional Attributes Name
type(MAPL_CFIO), intent(inout) :: MCFIO
integer, intent(out), optional :: RC

Calls

proc~~mapl_cfiodestroy~~CallsGraph proc~mapl_cfiodestroy MAPL_CFIODestroy proc~esmf_cfiodestroy ESMF_CFIODestroy proc~mapl_cfiodestroy->proc~esmf_cfiodestroy proc~esmf_cfiofileclose ESMF_CFIOFileClose proc~mapl_cfiodestroy->proc~esmf_cfiofileclose proc~mapl_return MAPL_Return proc~mapl_cfiodestroy->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_cfiodestroy->proc~mapl_verify 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 proc~esmf_cfioget ESMF_CFIOGet proc~esmf_cfiofileclose->proc~esmf_cfioget proc~esmf_cfiosdffileclose ESMF_CFIOSdfFileClose proc~esmf_cfiofileclose->proc~esmf_cfiosdffileclose at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception ncclos ncclos proc~cfio_close->ncclos proc~err err proc~cfio_close->proc~err proc~esmf_cfioget->proc~err proc~esmf_cfiosdffileclose->proc~cfio_close 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~~mapl_cfiodestroy~~CalledByGraph proc~mapl_cfiodestroy MAPL_CFIODestroy interface~esmf_iodestroy ESMF_ioDestroy interface~esmf_iodestroy->proc~mapl_cfiodestroy proc~test_main~5 test_main proc~test_main~5->interface~esmf_iodestroy program~utcfio~3 utCFIO program~utcfio~3->proc~test_main~5

Source Code

  subroutine MAPL_CFIODestroy( MCFIO, RC )
!
  type(MAPL_CFIO),             intent(INOUT) :: MCFIO
  integer, optional,           intent(  OUT) :: RC
!
  integer :: status

  if(associated(MCFIO%Krank     )) deallocate(MCFIO%Krank     )
  if(associated(MCFIO%reqs      )) deallocate(MCFIO%reqs      )
  if(associated(MCFIO%varname   )) deallocate(MCFIO%varname   )
  if(associated(MCFIO%vardims   )) deallocate(MCFIO%vardims   )
  if(associated(MCFIO%Levs      )) deallocate(MCFIO%Levs      )
  if(associated(MCFIO%vartype   )) deallocate(MCFIO%vartype   )
  if(associated(MCFIO%needvar   )) deallocate(MCFIO%needvar   )
  if(associated(MCFIO%pairList  )) deallocate(MCFIO%pairList  )
  if(associated(MCFIO%buffer    )) deallocate(MCFIO%buffer  )
  if(associated(MCFIO%varid     )) deallocate(MCFIO%varid  )

  nullify(MCFIO%Krank     )
  nullify(MCFIO%reqs      )
  nullify(MCFIO%varname   )
  nullify(MCFIO%vardims   )
  nullify(MCFIO%Levs      )
  nullify(MCFIO%varid     )
  nullify(MCFIO%buffer    )

  if (MCFIO%Root > 0) then
     if (MCFIO%myPE == mCFIO%RootRank) then
        call ESMF_CFIOFileClose(MCFIO%CFIO,rc=status)
        _VERIFY(STATUS)
     end if
  end if

  call ESMF_CFIODestroy(MCFIO%CFIO,rc=status)
  _VERIFY(STATUS)

  MCFIO%created = .false.

  _RETURN(ESMF_SUCCESS)
  end subroutine MAPL_CFIODestroy