MAPL_StatePrintSpecCSV Subroutine

public recursive subroutine MAPL_StatePrintSpecCSV(GC, printSpec, RC)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC
integer, intent(in) :: printSpec
integer, intent(out), optional :: RC

Calls

proc~~mapl_stateprintspeccsv~~CallsGraph proc~mapl_stateprintspeccsv MAPL_StatePrintSpecCSV proc~mapl_stateprintspeccsv->proc~mapl_stateprintspeccsv ESMF_GridCompGet ESMF_GridCompGet proc~mapl_stateprintspeccsv->ESMF_GridCompGet interface~write_parallel WRITE_PARALLEL proc~mapl_stateprintspeccsv->interface~write_parallel none~get_child_gridcomp MAPL_MetaComp%get_child_gridcomp proc~mapl_stateprintspeccsv->none~get_child_gridcomp none~get_num_children~4 CompositeComponent%get_num_children proc~mapl_stateprintspeccsv->none~get_num_children~4 proc~mapl_internalstateretrieve MAPL_InternalStateRetrieve proc~mapl_stateprintspeccsv->proc~mapl_internalstateretrieve proc~mapl_return MAPL_Return proc~mapl_stateprintspeccsv->proc~mapl_return proc~mapl_varspecprintcsv MAPL_VarSpecPrintCSV proc~mapl_stateprintspeccsv->proc~mapl_varspecprintcsv proc~mapl_verify MAPL_Verify proc~mapl_stateprintspeccsv->proc~mapl_verify none~get_gridcomp MaplGenericComponent%get_gridcomp none~get_child_gridcomp->none~get_gridcomp none~get_ith_child MAPL_MetaComp%get_ith_child none~get_child_gridcomp->none~get_ith_child none~get_num_children~2 ConcreteComposite%get_num_children none~get_num_children~4->none~get_num_children~2 proc~mapl_internalstateretrieve->ESMF_GridCompGet proc~mapl_internalstateretrieve->proc~mapl_return proc~mapl_internalstateretrieve->proc~mapl_verify ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_internalstateretrieve->ESMF_UserCompGetInternalState proc~mapl_internalstatecreate MAPL_InternalStateCreate proc~mapl_internalstateretrieve->proc~mapl_internalstatecreate at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_varspecprintcsv->proc~mapl_return proc~mapl_varspecprintcsv->proc~mapl_verify none~info Logger%info proc~mapl_varspecprintcsv->none~info proc~mapl_verify->proc~mapl_throw_exception none~is_threading_active MaplGenericComponent%is_threading_active none~get_gridcomp->none~is_threading_active proc~get_current_thread get_current_thread none~get_gridcomp->proc~get_current_thread none~get_child~26 MAPL_MetaComp%get_child none~get_ith_child->none~get_child~26 proc~mapl_internalstatecreate->ESMF_GridCompGet proc~mapl_internalstatecreate->proc~mapl_return proc~mapl_internalstatecreate->proc~mapl_verify ESMF_UserCompSetInternalState ESMF_UserCompSetInternalState proc~mapl_internalstatecreate->ESMF_UserCompSetInternalState none~get_component~2 ConcreteComposite%get_component proc~mapl_internalstatecreate->none~get_component~2 none~initialize~15 ConcreteComposite%initialize proc~mapl_internalstatecreate->none~initialize~15 none~set_composite~2 CompositeComponent%set_composite proc~mapl_internalstatecreate->none~set_composite~2 none~get_child_by_index~3 CompositeComponent%get_child_by_index none~get_child~26->none~get_child_by_index~3 none~get_child_by_name~3 CompositeComponent%get_child_by_name none~get_child~26->none~get_child_by_name~3

Source Code

   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