recursive subroutine MAPL_StatePrintSpecCSV(GC, printSpec, RC)
!ARGUMENTS:
type(ESMF_GridComp), intent(INOUT) :: GC
integer, intent(IN ) :: printSpec
integer, optional, intent( OUT) :: RC
!EOPI
!=============================================================================
!
! ErrLog Variables
character(len=ESMF_MAXSTR) :: IAm='MAPL_StatePrintSpecCSV'
integer :: status
character(len=ESMF_MAXSTR) :: comp_name
! Local variables
! ---------------
type (MAPL_MetaComp), pointer :: MAPLOBJ
type (MAPL_VarSpec), pointer :: IMPORT_SPEC(:)
type (MAPL_VarSpec), pointer :: EXPORT_SPEC(:)
type (MAPL_VarSpec), pointer :: INTERNAL_SPEC(:)
integer :: I
type(ESMF_GridComp), pointer :: gridcomp
!EOP
! Get my name and set-up traceback handle
! ---------------------------------------
call ESMF_GridCompGet( GC, NAME=comp_name, RC=status )
_VERIFY(status)
Iam = trim(comp_name) // trim(Iam)
! Retrieve the pointer to the internal state
! --------------------------------------------
call MAPL_InternalStateRetrieve ( GC, MAPLOBJ, RC=status )
_VERIFY(status)
IMPORT_SPEC => MAPLOBJ%COMPONENT_SPEC%IMPORT%OLD_VAR_SPECS
EXPORT_SPEC => MAPLOBJ%COMPONENT_SPEC%EXPORT%OLD_VAR_SPECS
INTERNAL_SPEC => MAPLOBJ%COMPONENT_SPEC%INTERNAL%OLD_VAR_SPECS
if (printSpec == 1) then
if (associated(IMPORT_SPEC)) then
call WRITE_PARALLEL("#IMPORT spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(IMPORT_SPEC)) then
call MAPL_VarSpecPrintCSV(IMPORT_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
if (associated(EXPORT_SPEC)) then
call WRITE_PARALLEL("#EXPORT spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(EXPORT_SPEC)) then
call MAPL_VarSpecPrintCSV(EXPORT_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
if (associated(INTERNAL_SPEC)) then
call WRITE_PARALLEL("#INTERNAL spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(INTERNAL_SPEC)) then
call MAPL_VarSpecPrintCSV(INTERNAL_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
else if (printSpec == 2) then
if (associated(IMPORT_SPEC)) then
call WRITE_PARALLEL("#IMPORT spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(IMPORT_SPEC)) then
call MAPL_VarSpecPrintCSV(IMPORT_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
else if (printSpec == 3) then
if (associated(EXPORT_SPEC)) then
call WRITE_PARALLEL("#EXPORT spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(EXPORT_SPEC)) then
call MAPL_VarSpecPrintCSV(EXPORT_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
else if (printSpec == 4) then
if (associated(INTERNAL_SPEC)) then
call WRITE_PARALLEL("#INTERNAL spec for " // trim(comp_name))
call WRITE_PARALLEL("#COMPONENT, SHORT_NAME, LONG_NAME, UNIT, DIMS, CONTAINER_TYPE")
if (associated(INTERNAL_SPEC)) then
call MAPL_VarSpecPrintCSV(INTERNAL_SPEC, comp_name, RC=status)
_VERIFY(status)
end if
end if
end if
do I = 1, MAPLOBJ%get_num_children()
gridcomp => MAPLOBJ%GET_CHILD_GRIDCOMP(I)
call MAPL_StatePrintSpecCSV(gridcomp, printSpec, RC=status)
_VERIFY(status)
end do
_RETURN(ESMF_SUCCESS)
end subroutine MAPL_StatePrintSpecCSV