DataInitialize Subroutine

private subroutine DataInitialize(xdata, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp) :: xdata
integer, intent(out) :: rc

Calls

proc~~datainitialize~~CallsGraph proc~datainitialize DataInitialize esmf_fieldfill esmf_fieldfill proc~datainitialize->esmf_fieldfill interface~esmf_gridcompgetinternalstate ESMF_GridCompGetInternalState proc~datainitialize->interface~esmf_gridcompgetinternalstate interface~nuopc_compattributeset NUOPC_CompAttributeSet proc~datainitialize->interface~nuopc_compattributeset interface~nuopc_compget NUOPC_CompGet proc~datainitialize->interface~nuopc_compget interface~nuopc_setattribute NUOPC_SetAttribute proc~datainitialize->interface~nuopc_setattribute proc~esmf_logfounderror ESMF_LogFoundError proc~datainitialize->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~datainitialize->proc~esmf_logseterror proc~nuopc_modelget NUOPC_ModelGet proc~datainitialize->proc~nuopc_modelget proc~nuopc_cplcompattributeseti NUOPC_CplCompAttributeSetI interface~nuopc_compattributeset->proc~nuopc_cplcompattributeseti proc~nuopc_cplcompattributesets NUOPC_CplCompAttributeSetS interface~nuopc_compattributeset->proc~nuopc_cplcompattributesets proc~nuopc_cplcompattributesetsl NUOPC_CplCompAttributeSetSL interface~nuopc_compattributeset->proc~nuopc_cplcompattributesetsl proc~nuopc_gridcompattributeseti NUOPC_GridCompAttributeSetI interface~nuopc_compattributeset->proc~nuopc_gridcompattributeseti proc~nuopc_gridcompattributesets NUOPC_GridCompAttributeSetS interface~nuopc_compattributeset->proc~nuopc_gridcompattributesets proc~nuopc_gridcompattributesetsl NUOPC_GridCompAttributeSetSL interface~nuopc_compattributeset->proc~nuopc_gridcompattributesetsl proc~nuopc_cplcompget NUOPC_CplCompGet interface~nuopc_compget->proc~nuopc_cplcompget proc~nuopc_gridcompget NUOPC_GridCompGet interface~nuopc_compget->proc~nuopc_gridcompget proc~nuopc_setattributefield NUOPC_SetAttributeField interface~nuopc_setattribute->proc~nuopc_setattributefield proc~nuopc_setattributestate NUOPC_SetAttributeState interface~nuopc_setattribute->proc~nuopc_setattributestate esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite proc~nuopc_modelget->interface~nuopc_compget proc~nuopc_modelget->proc~esmf_logfounderror proc~nuopc_modelbaseget NUOPC_ModelBaseGet proc~nuopc_modelget->proc~nuopc_modelbaseget

Source Code

  subroutine DataInitialize(xdata, rc)
    ! arguments
    type(ESMF_GridComp)  :: xdata
    integer, intent(out) :: rc
    ! local variables
    integer                    :: stat
    type(xstate_wrap)          :: is
    type(xdata_state), pointer :: xstate
    type(xdata_field), pointer :: xfield
    type(ESMF_State)           :: importState
    type(ESMF_State)           :: exportState

    rc = ESMF_SUCCESS

    ! query component for internal state
    nullify(is%ptr)
    call ESMF_GridCompGetInternalState(xdata, is, rc)
    if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
      line=__LINE__, file=__FILE__)) return
    xstate => is%ptr
    if (.not. associated(xstate)) then
      call ESMF_LogSetError(ESMF_RC_PTR_NOTALLOC, &
        msg='XDATA: xstate has not been associated', &
        line=__LINE__, file=__FILE__, rcToReturn=rc)
      return
    endif

    ! query component for information
    call NUOPC_CompGet(xdata, name=xstate%cname, &
      verbosity=xstate%verbosity, diagnostic=xstate%diagnostic, rc=rc)
    if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
      line=__LINE__, file=__FILE__)) return

    ! query component for import and export states
    call NUOPC_ModelGet(xdata, importState=importState, &
      exportState=exportState, rc=rc)
    if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
      line=__LINE__, file=__FILE__)) return

    ! reset import fields
    xfield => xstate%imp_flds_head
    do while (associated(xfield))
      if (xfield%rlze) then
        call ESMF_FieldFill(xfield%efld, dataFillScheme="const", &
          const1=xfield%dflt, rc=rc)
        if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
          line=__LINE__, file=__FILE__)) return
      endif
      xfield => xfield%nfld
    enddo

    ! reset export fields
    xfield => xstate%exp_flds_head
    do while (associated(xfield))
      if (xfield%rlze) then
        call ESMF_FieldFill(xfield%efld, dataFillScheme="const", &
          const1=xfield%dflt, rc=rc)
        if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
          line=__LINE__, file=__FILE__)) return
        call NUOPC_SetAttribute(xfield%efld, &
          name="Updated", value="true", rc=rc)
        if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
          line=__LINE__, file=__FILE__)) return
      endif
      xfield => xfield%nfld
    enddo

    call NUOPC_CompAttributeSet(xdata, &
      name="InitializeDataComplete", value="true", rc=rc)
    if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
      line=__LINE__, file=__FILE__)) return

  endsubroutine DataInitialize