module testCasesMpi
  use testHelperMpi
  use gamapp_mpi
  use usergamic

  implicit none


contains

  @before
  subroutine firstSerial(this)
      class (MpiTestMethod), intent(inout) :: this

  end subroutine firstSerial

  @after
  subroutine lastSerial(this)
      class (MpiTestMethod), intent(inout) :: this

  end subroutine lastSerial

  @test(npes=[8])
  subroutine testBlast3D(this)
      class (MpiTestMethod), intent(inout) :: this

      type(gamAppMpi_T) :: gameraAppMpi

      call setMpiReal()

      call initGamera_mpi(gameraAppMpi, initUser, getMpiF08Communicator(this), 'blast3d_large.xml')

      do while ((gameraAppMpi%Model%tFin - gameraAppMpi%Model%t) > 1e-15)
        call stepGamera_mpi(gameraAppMpi)

        if (gameraAppMpi%Model%IO%doConsole(gameraAppMpi%Model%ts)) then
            call consoleOutput(gameraAppMpi%Model,gameraAppMpi%Grid,gameraAppMpi%State)
        endif

        if (gameraAppMpi%Model%IO%doOutput(gameraAppMpi%Model%t)) then
            call fOutput(gameraAppMpi%Model,gameraAppMpi%Grid,gameraAppMpi%State)
        endif

      end do
      write(*,*) 'End time = ', gameraAppMpi%Model%t

  end subroutine testBlast3D

end module testCasesMpi

