subroutine ESMF_MeshSet(mesh, &
elementMask, elementArea, rc)
!
! !RETURN VALUE:
!
! !ARGUMENTS:
type(ESMF_Mesh), intent(in) :: mesh
integer, intent(in), optional :: elementMask(:)
real(ESMF_KIND_R8), intent(in), optional :: elementArea(:)
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! This call allows the user to change the set of information that it's legal to alter after
! a mesh has been created. Currently, this call requires that the information has already
! been added to the mesh during creation. For example, you can only change the element mask
! information, if the mesh was initially created with element masking.
!
! The arguments are:
! \begin{description}
! \item [mesh]
! \item [{[elementMask]}]
! An array of mask values for each local element in the mesh. The elementMask array should be of size elementCount.
! \item [{[elementArea]}]
! An array of area values for each local element in the mesh. The elementArea array should be of size elementCount.
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
integer :: localrc
type(ESMF_MeshStatus_Flag) :: status
type(ESMF_InterArray) :: elementMaskIA
type(ESMF_InterArray) :: elementAreaIA
! Init local rc
localrc = ESMF_SUCCESS
!!! Error check status of Mesh versus what's being asked for !!!
! Make sure mesh is initialized
ESMF_INIT_CHECK_DEEP(ESMF_MeshGetInit, mesh, rc)
! If mesh has not been fully created, make sure that the user
! isn't asking for something that requires a fully created mesh
call C_ESMC_MeshGetStatus(mesh, status)
if (status .ne. ESMF_MESHSTATUS_COMPLETE) then
! Check another set, just so the length of the if isn't so big
if (present(elementMask) .or. &
present(elementArea)) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_OBJ_WRONG, &
msg="- the mesh has not been fully created", &
ESMF_CONTEXT, rcToReturn=rc)
return
endif
endif
! XMRKX !
!!!!!!!! Set Misc info in Mesh !!!!!!!!
!!!!!!!! Set Node info in Mesh !!!!!!!!
!!!!!!!! Set Elem info in Mesh !!!!!!!!
! Set elem info
if (present(elementMask) .or. &
present(elementArea)) then
! Create interface arrays
elementMaskIA = ESMF_InterArrayCreate(elementMask, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
elementAreaIA = ESMF_InterArrayCreate(farray1DR8=elementArea, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Call into C
call C_ESMC_MeshSetElemInfo(mesh, &
elementMaskIA, elementAreaIA, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Destroy interface arrays
call ESMF_InterArrayDestroy(elementMaskIA, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_InterArrayDestroy(elementAreaIA, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
! Error output
if (present(rc)) rc = localrc
end subroutine ESMF_MeshSet