f_esmf_compreplicate Subroutine

recursive subroutine f_esmf_compreplicate(comp, comp_src, vm, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_CWrap) :: comp
type(ESMF_CWrap) :: comp_src
type(ESMF_VM) :: vm
integer :: rc

Source Code

recursive subroutine f_esmf_compreplicate(comp, comp_src, vm, rc)
  use ESMF_UtilTypesMod      ! ESMF utility types
  use ESMF_BaseMod           ! ESMF base class
  use ESMF_LogErrMod
  use ESMF_CompMod
  use ESMF_VMMod
  use ESMF_InitMacrosMod
  
  implicit none

  type(ESMF_CWrap) :: comp
  type(ESMF_CWrap) :: comp_src
  type(ESMF_VM)    :: vm
  integer :: rc

  type(ESMF_VM) :: vm_cpy
  type(ESMF_Pointer) :: this
  type (ESMF_CompClass), pointer :: compclass
  integer :: localrc
  
  ! Initialize return code; assume routine not implemented
  localrc = ESMF_RC_NOT_IMPL
  rc = ESMF_RC_NOT_IMPL

  nullify(comp%compp)
  nullify(compclass)
  allocate(compclass)
  compclass = comp_src%compp
  call ESMF_CompClassSetInitCreated(compclass)
  call c_ESMC_FTableCreate(compclass%ftable, localrc) 
  if (ESMF_LogFoundError(localrc, &
    ESMF_ERR_PASSTHRU, &
    ESMF_CONTEXT, rcToReturn=rc)) return
  call ESMF_VMGetThis(vm, this)
  call ESMF_VMSetThis(vm_cpy, this)
  call ESMF_VMSetInitCreated(vm_cpy)
  call ESMF_CompSet(compclass, vm=vm_cpy)
  comp%compp => compclass
  call ESMF_CWrapSetInitCreated(comp)
  
  ! return successfully
  rc = ESMF_SUCCESS
end subroutine f_esmf_compreplicate