Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ESMF_GridComp), | intent(inout) | :: | GC | |||
type(MAPL_MetaComp), | pointer | :: | MAPLOBJ | |||
integer, | intent(out), | optional | :: | RC |
subroutine MAPL_InternalStateCreate( GC, MAPLOBJ, RC) use mapl_ConcreteComposite type(ESMF_GridComp), intent(INOUT) :: GC ! Gridded component type (MAPL_MetaComp), pointer :: MAPLOBJ integer, optional, intent( OUT) :: RC ! Return code ! ErrLog Variables character(len=ESMF_MAXSTR) :: IAm character(len=ESMF_MAXSTR) :: comp_name integer :: status ! Local variables ! --------------- type (MAPL_GenericWrap ) :: WRAP #if defined(ABSOFT) || defined(sysIRIX64) type(MAPL_MetaComp ), target :: DUMMY #endif type(ConcreteComposite), pointer :: root_composite class(AbstractFrameworkComponent), pointer :: tmp_component !============================================================================= ! Begin... ! Get the target components name and set-up traceback handle. ! ----------------------------------------------------------- Iam = "MAPL_InternalStateCreate" call ESMF_GridCompGet( GC, name=comp_name, RC=status ) _VERIFY(status) Iam = trim(comp_name) // trim(Iam) #if defined(ABSOFT) || defined(sysIRIX64) WRAP%MAPLOBJ => DUMMY #endif ! Allocate this instance of the internal state and put it in wrapper. ! ------------------------------------------------------------------- if (.not. associated(MAPLOBJ)) then ! Root component (hopefully) allocate(MAPLOBJ, STAT=status) _VERIFY(status) ! Memory leak ! allocate(root_composite) ! TODO: test if workaround is needed for 10.2 ! workaround for gfortran 10.1 !C$ root_composite = ConcreteComposite(MAPLOBJ) call root_composite%initialize(MAPLOBJ) tmp_component => root_composite%get_component() select type (tmp_component) class is (MAPL_MetaComp) MAPLOBJ => tmp_component end select call MAPLOBJ%set_composite(root_composite) end if WRAP%MAPLOBJ => MAPLOBJ ! Have ESMF save pointer to the wrapped internal state in the G.C. ! ---------------------------------------------------------------- call ESMF_UserCompSetInternalState(GC, "MAPL_GenericInternalState", WRAP, status) _VERIFY(status) _RETURN(ESMF_SUCCESS) end subroutine MAPL_InternalStateCreate