run Subroutine

public subroutine run(this, rc)

Type Bound

ExtDataDriver

Arguments

Type IntentOptional Attributes Name
class(ExtDataDriver), intent(inout) :: this
integer, intent(out), optional :: rc

Calls

proc~~run~12~~CallsGraph proc~run~12 ExtDataDriver%run ESMF_ConfigCreate ESMF_ConfigCreate proc~run~12->ESMF_ConfigCreate ESMF_ConfigDestroy ESMF_ConfigDestroy proc~run~12->ESMF_ConfigDestroy ESMF_ConfigFindLabel ESMF_ConfigFindLabel proc~run~12->ESMF_ConfigFindLabel ESMF_ConfigGetAttribute ESMF_ConfigGetAttribute proc~run~12->ESMF_ConfigGetAttribute ESMF_ConfigGetDim ESMF_ConfigGetDim proc~run~12->ESMF_ConfigGetDim ESMF_ConfigLoadFile ESMF_ConfigLoadFile proc~run~12->ESMF_ConfigLoadFile ESMF_ConfigNextLine ESMF_ConfigNextLine proc~run~12->ESMF_ConfigNextLine ESMF_Initialize ESMF_Initialize proc~run~12->ESMF_Initialize begin begin proc~run~12->begin get get proc~run~12->get interface~mapl_am_i_root MAPL_Am_I_Root proc~run~12->interface~mapl_am_i_root mpi_comm_rank mpi_comm_rank proc~run~12->mpi_comm_rank mpi_finalize mpi_finalize proc~run~12->mpi_finalize next next proc~run~12->next none~get_name SplitCommunicator%get_name proc~run~12->none~get_name none~get_splitcomm ServerManager%get_splitcomm proc~run~12->none~get_splitcomm none~get_subcommunicator SplitCommunicator%get_subcommunicator proc~run~12->none~get_subcommunicator none~run~9 ExtData_DriverGridComp%run proc~run~12->none~run~9 none~set_services~3 ExtData_DriverGridComp%set_services proc~run~12->none~set_services~3 proc~finalize_io_clients_servers ExtDataDriver%finalize_io_clients_servers proc~run~12->proc~finalize_io_clients_servers proc~finalize~7 ExtData_DriverGridComp%finalize proc~run~12->proc~finalize~7 proc~initialize_io_clients_servers ExtDataDriver%initialize_io_clients_servers proc~run~12->proc~initialize_io_clients_servers proc~initialize~7 ExtData_DriverGridComp%initialize proc~run~12->proc~initialize~7 proc~mapl_finalize MAPL_Finalize proc~run~12->proc~mapl_finalize proc~mapl_return MAPL_Return proc~run~12->proc~mapl_return proc~mapl_verify MAPL_Verify proc~run~12->proc~mapl_verify proc~new_extdata_drivergridcomp new_ExtData_DriverGridComp proc~run~12->proc~new_extdata_drivergridcomp push_back push_back proc~run~12->push_back

Called by

proc~~run~12~~CalledByGraph proc~run~12 ExtDataDriver%run program~extdata_driver ExtData_Driver program~extdata_driver->proc~run~12

Source Code

   subroutine run(this,RC)

      class(ExtDataDriver), intent(inout) :: this
      integer,       optional, intent(OUT) :: rc

      type(ESMF_Config)            :: config


      integer                      :: STATUS

      integer                  :: CommCap

      type (ESMF_VM) :: VM

      type(ExtData_DriverGridComp), target :: cap

      integer :: lineCount, columnCount,i,rank
      character(len=ESMF_MAXSTR) :: ctemp
      character(len=:), pointer :: cname
      type(StringVector) :: cases
      type(StringVectorIterator) :: iter  
      type(SplitCommunicator) :: split_comm

      CommCap = MPI_COMM_WORLD

      call this%initialize_io_clients_servers(commCap, rc = status); _VERIFY(status)
      call this%cap_server%get_splitcomm(split_comm)
      select case(split_comm%get_name())
      case('model')
         call ESMF_Initialize (vm=vm, logKindFlag=this%cap_options%esmf_logging_mode, &
              & mpiCommunicator=split_comm%get_subcommunicator(), rc=status)
         _VERIFY(STATUS)

         config = ESMF_ConfigCreate(rc=status)
         _VERIFY(status)
         call ESMF_ConfigLoadFile   ( config, 'CAP.rc', rc=STATUS )
         _VERIFY(status)
         call ESMF_ConfigGetDim(config,lineCount,columnCount,label='CASES::',rc=status)
         _VERIFY(status)
         call ESMF_ConfigFindLabel(config,label='CASES::',rc=status)
         _VERIFY(status)
         do i=1,lineCount
            call ESMF_ConfigNextLine(config,rc=status)
            _VERIFY(status)
            call ESMF_ConfigGetAttribute(config,ctemp,rc=status)
            _VERIFY(status)
            call cases%push_back(trim(ctemp))
         enddo
         call ESMF_ConfigDestroy(config, rc=status)
         _VERIFY(status)

         iter = cases%begin()
         do while (iter /= cases%end())

            if (mapl_am_I_root()) write(*,*)"Running new case"
            cname => iter%get()
            cap = new_ExtData_DriverGridComp(root_setservices, name=this%name, configFileName=cname)
            call cap%set_services(rc = status)
            _VERIFY(status)
            call cap%initialize(rc = status)
            _VERIFY(status)

            call cap%run(rc=status)
            _VERIFY(status)

            call cap%finalize(rc = status)
            _VERIFY(status)

            call iter%next()
         enddo

      end select

!  Finalize framework
!  ------------------

     call MPI_Comm_Rank(CommCap,rank,status)
     _VERIFY(status)
     if (rank==0) then
        close(99)
        open(99,file='egress',form='formatted')
        close(99)
     end if
   
      call this%finalize_io_clients_servers()
      call MAPL_Finalize(rc=status)
      _VERIFY(status) 
      call mpi_finalize(status)
      _VERIFY(STATUS)

      _RETURN(ESMF_SUCCESS)


   end subroutine run