ESMF_GridWriteVTK Subroutine

public subroutine ESMF_GridWriteVTK(grid, staggerLoc, filename, array1, array2, array3, array4, array5, array6, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Grid), intent(inout) :: grid
type(ESMF_StaggerLoc), intent(in), optional :: staggerLoc
character(len=*), intent(in) :: filename
type(ESMF_Array), intent(inout), optional :: array1
type(ESMF_Array), intent(inout), optional :: array2
type(ESMF_Array), intent(inout), optional :: array3
type(ESMF_Array), intent(inout), optional :: array4
type(ESMF_Array), intent(inout), optional :: array5
type(ESMF_Array), intent(inout), optional :: array6
integer, intent(out), optional :: rc

Source Code

    subroutine ESMF_GridWriteVTK(grid, staggerLoc, filename, &
                                 array1, array2, array3, array4, array5,&
                                 array6, rc)
!
!
! !ARGUMENTS:
    type(ESMF_Grid), intent(inout)                :: grid
    type(ESMF_StaggerLoc), intent(in),optional    :: staggerLoc
    character(len = *), intent(in)                :: filename
    type(ESMF_Array), intent(inout), optional     :: array1
    type(ESMF_Array), intent(inout), optional     :: array2
    type(ESMF_Array), intent(inout), optional     :: array3
    type(ESMF_Array), intent(inout), optional     :: array4
    type(ESMF_Array), intent(inout), optional     :: array5
    type(ESMF_Array), intent(inout), optional     :: array6
    integer,                intent(out), optional :: rc
!
! !DESCRIPTION:
!   Write the fields out for purview.  This function overcomes certain
!   difficulties in passing strings with an optional number of arguments.
!
!   \begin{description}
!   \item [grid]
!         grid to write
!   \item[{[staggerLoc]}]
!         stagger of field
!   \item[filename]
!         File (stub) to write results to
!   \item [{[array1-6]}]
!         Arrays to write as data
!   \item [{[rc]}]
!         Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOPI
!------------------------------------------------------------------------------
    integer                 :: localrc      ! local return code
    integer                 :: minidx
    integer                 :: tmp_staggerloc
    type(ESMF_Array)        :: arrayEmpty
    integer                 :: lspherical
    integer                 :: lisLatLonDeg


    ! initialize return code; assume routine not implemented
    localrc = ESMF_SUCCESS
    if (present(rc)) rc = ESMF_SUCCESS

    ! These aren't used anymore, but just set them so they have a defined value
    ! TODO: REMOVE THESE
    lspherical = 0
    lisLatLonDeg = 0


    ! Set default staggerloc
    if (present(staggerloc)) then
      tmp_staggerloc=staggerloc%staggerloc
    else
       tmp_staggerloc=ESMF_STAGGERLOC_CENTER%staggerloc
    endif


    minidx = 10

    if (.not. present(array6)) minidx = 6
    if (.not. present(array5)) minidx = 5
    if (.not. present(array4)) minidx = 4
    if (.not. present(array3)) minidx = 3
    if (.not. present(array2)) minidx = 2
    if (.not. present(array1)) minidx = 1

    select case (minidx)
      case (1)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 0, filename, localrc, &
             arrayEmpty, arrayEmpty, arrayEmpty, arrayEmpty, arrayEmpty, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (2)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 1, filename, localrc, &
             array1, arrayEmpty, arrayEmpty, arrayEmpty, arrayEmpty, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (3)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 2, filename, localrc, &
             array1, array2, arrayEmpty, arrayEmpty, arrayEmpty, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (4)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 3, filename, localrc, &
             array1, array2, array3, arrayEmpty, arrayEmpty, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (5)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 4, filename, localrc, &
             array1, array2, array3, array4, arrayEmpty, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (6)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 5, filename, localrc, &
             array1, array2, array3, array4, array5, &
             arrayEmpty, lspherical, lisLatLonDeg)
      case (10)
        call c_ESMC_GridIO(grid, tmp_staggerloc, 5, filename, localrc, &
             array1, array2, array3, array4, array5, &
             array6, lspherical, lisLatLonDeg)
      case default
        localrc = ESMF_RC_NOT_IMPL
    end select
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

  end subroutine ESMF_GridWriteVTK