ESMF_MeshSetMOAB Subroutine

public subroutine ESMF_MeshSetMOAB(moabOn, rc)

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: moabOn
integer, intent(out), optional :: rc

Source Code

   subroutine ESMF_MeshSetMOAB(moabOn, rc)
!
! !ARGUMENTS:
    logical, intent(in)                        :: moabOn
    integer, intent(out) , optional            :: rc
!
! !DESCRIPTION:
!   This method is only temporary. It was created to enable testing during the stage in ESMF development while
!   we have two internal mesh implementations. At some point it will be removed.
!
!   This method can be employed to turn on or off using the MOAB library
!   to hold the internal structure of the Mesh. When set to .true. the following
!   Mesh create calls create a Mesh using MOAB internally. When set to .false. the following
!   Mesh create calls use the ESMF native internal mesh respresentation. Note that ESMF Meshes
!   created on MOAB are only supported in a limited set of operations and should be used
!   with caution as they haven't yet been tested as thoroughly as the native version.
!   Also, operations that use a pair of Meshes (e.g. regrid weight generation) are only supported between
!   meshes of the same type (e.g. you can regrid between two MOAB meshes, but not between a MOAB and
!   a native mesh).
!
!   \begin{description}
!   \item [moabOn]
!         Variable used to turn MOAB on or off
!   \item [{[rc]}]
!         Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOP
!------------------------------------------------------------------------------
    integer :: localrc
    integer :: intMoabOn

    ! Init localrc
    localrc = ESMF_SUCCESS

    ! Translate to integer
    intMoabOn=0
    if (moabOn) then
      intMoabOn=1
    endif

    call c_esmc_meshsetMOAB(intMoabOn, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! add log messages about MOAB
    if (moabOn) then
      call ESMF_LogWrite ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!!        MOAB turned ON             !!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!! Meshes now created using MOAB     !!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    else
      call ESMF_LogWrite ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!!        MOAB turned OFF            !!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!! Meshes now created using native   !!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
      call ESMF_LogWrite ('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!',  &
        ESMF_LOGMSG_INFO, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return
    end if

    if (present(rc)) rc = ESMF_SUCCESS

    end subroutine ESMF_MeshSetMOAB