read_particles_snapshot Subroutine

public subroutine read_particles_snapshot(file_exists)

Uses

  • proc~~read_particles_snapshot~~UsesGraph proc~read_particles_snapshot read_particles_snapshot module~mod_global_parameters mod_global_parameters proc~read_particles_snapshot->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Arguments

Type IntentOptional Attributes Name
logical, intent(out) :: file_exists

Calls

proc~~read_particles_snapshot~~CallsGraph proc~read_particles_snapshot read_particles_snapshot mpi_bcast mpi_bcast proc~read_particles_snapshot->mpi_bcast proc~comm_particles_global comm_particles_global proc~read_particles_snapshot->proc~comm_particles_global proc~mpistop mpistop proc~read_particles_snapshot->proc~mpistop proc~read_from_snapshot read_from_snapshot proc~read_particles_snapshot->proc~read_from_snapshot proc~comm_particles_global->proc~mpistop mpi_waitall mpi_waitall proc~comm_particles_global->mpi_waitall proc~find_particle_ipe find_particle_ipe proc~comm_particles_global->proc~find_particle_ipe proc~mpi_irecv_wrapper mpi_irecv_wrapper proc~comm_particles_global->proc~mpi_irecv_wrapper proc~mpi_isend_wrapper mpi_isend_wrapper proc~comm_particles_global->proc~mpi_isend_wrapper proc~mpi_recv_wrapper mpi_recv_wrapper proc~comm_particles_global->proc~mpi_recv_wrapper proc~mpi_send_wrapper mpi_send_wrapper proc~comm_particles_global->proc~mpi_send_wrapper proc~pull_particle_from_particles_on_mype pull_particle_from_particles_on_mype proc~comm_particles_global->proc~pull_particle_from_particles_on_mype proc~push_particle_into_particles_on_mype push_particle_into_particles_on_mype proc~comm_particles_global->proc~push_particle_into_particles_on_mype mpi_abort mpi_abort proc~mpistop->mpi_abort proc~read_from_snapshot->proc~find_particle_ipe proc~read_from_snapshot->proc~push_particle_into_particles_on_mype proc~get_igslice get_igslice proc~find_particle_ipe->proc~get_igslice proc~particle_in_domain particle_in_domain proc~find_particle_ipe->proc~particle_in_domain mpi_irecv mpi_irecv proc~mpi_irecv_wrapper->mpi_irecv mpi_isend mpi_isend proc~mpi_isend_wrapper->mpi_isend mpi_recv mpi_recv proc~mpi_recv_wrapper->mpi_recv mpi_send mpi_send proc~mpi_send_wrapper->mpi_send proc~get_igslice->proc~mpistop

Called by

proc~~read_particles_snapshot~~CalledByGraph proc~read_particles_snapshot read_particles_snapshot proc~main main proc~main->proc~read_particles_snapshot program~agile agile program~agile->proc~main

Source Code

  subroutine read_particles_snapshot(file_exists)
    use mod_global_parameters

    logical,intent(out)             :: file_exists
    character(len=std_len)          :: filename
    integer                         :: mynpayload, mynparticles, pos

    ! some initialisations:
    nparticles_on_mype = 0
    mynparticles       = 0
    nparticles         = 0
    it_particles       = 0

    ! open the snapshot file on the headnode
    file_exists=.false.
    if (mype == 0) then
!      write(filename,"(a,a,i4.4,a)") trim(base_filename),'_particles',snapshotini,'.dat'
      ! Strip restart_from_filename of the ending
      pos = scan(restart_from_file, '.dat', back=.true.)
      write(filename,"(a,a,i4.4,a)") trim(restart_from_file(1:pos-8)),&
         '_particles',snapshotini,'.dat'
      INQUIRE(FILE=filename, EXIST=file_exists)
      if (.not. file_exists) then
        write(*,*) 'WARNING: File '//trim(&
           filename)//' with particle data does not exist.'
        write(*,*) 'Initialising particles from user or default routines'
      else
        open(unit=unitparticles,file=filename,form='unformatted',action='read',&
           status='unknown',access='stream')
        read(unitparticles) nparticles,it_particles,mynpayload
        if (mynpayload .ne. npayload) call &
           mpistop&
('npayload in restart file does not match npayload in mod_particles')
      end if
    end if

    call MPI_BCAST(file_exists,1,MPI_LOGICAL,0,icomm,ierrmpi)
    if (.not. file_exists) return

    call MPI_BCAST(nparticles,1,MPI_INTEGER,0,icomm,ierrmpi)
    call MPI_BCAST(it_particles,1,MPI_INTEGER,0,icomm,ierrmpi)

    do while (mynparticles .lt. nparticles)
      if (mype == 0) then
        do while (nparticles_on_mype .lt. nparticles_per_cpu_hi .and. &
           mynparticles .lt. nparticles)
          call read_from_snapshot
          mynparticles = mynparticles + 1
        end do
      end if ! mype==0
      call MPI_BCAST(mynparticles,1,MPI_INTEGER,0,icomm,ierrmpi)
      call comm_particles_global
    end do

    if (mype == 0) close(unit=unitparticles)

  end subroutine read_particles_snapshot