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