Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program exporttest
- implicit none
- integer(8), parameter :: Stot= 2
- integer(8), dimension(:), allocatable :: Nfp, Nf, Nfvp, Nfv
- integer(4) :: rank, s
- character(10) :: rankstring, sstring
- character(*), parameter :: datadir= '/Users/robertalbarran/Desktop/DISSERTATION/DSMCDATA/'
- character(50) :: NfTfile
- type Specietype
- integer(8), dimension(:), allocatable :: NfT, NfvT
- end type Specietype
- type(Specietype), dimension(:), allocatable :: SpecieT
- allocate(SpecieT(Stot))
- allocate(Nfp(Stot), Nfvp(Stot))
- allocate(SpecieT(Stot)%NfT(1), SpecieT(Stot)%NfvT(1))
- rank= 0
- ! import data
- do s= 1, Stot, 1
- write(sstring, '(I5)') s
- allocate(Nf(1))
- open (unit= 0, file= datadir // adjustl(adjustr(sstring) // ':' // 'Nfmat.bin'), &
- status= 'old', form= 'unformatted', access= 'stream')
- read(0) Nfp(s)
- close(0)
- Nf(1)= Nfp(s)
- SpecieT(s)%NfT= Nf
- deallocate(Nf)
- end do
- deallocate(Nfp)
- write(*, *) 'NfT s1= ', SpecieT(1)%NfT(1)
- write(*, *) 'NfT s2= ', SpecieT(2)%NfT(1)
- ! export data
- write(rankstring, '(i10)') rank
- do s= 1, Stot, 1
- write(sstring, '(I5)') s
- NfTfile= &
- datadir // adjustl(adjustr(rankstring) // ':' // &
- adjustl(adjustr(sstring) // ':' // 'NfTfort.bin'))
- open(unit= 0, status= 'replace', file= NfTfile, form= 'unformatted', &
- access= 'stream')
- write(0) SpecieT(s)%NfT
- close(0)
- end do
- ! import exported data
- do s= 1, Stot, 1
- write(sstring, '(I5)') s
- allocate(Nfv(1))
- open (unit= 0, file= datadir // adjustl(adjustr(rankstring) // ':' // &
- adjustl(adjustr(sstring) // ':' // 'NfTfort.bin')), &
- status= 'old', form= 'unformatted', access= 'stream')
- read(0) Nfvp(s)
- close(0)
- Nfv(1)= Nfvp(s)
- SpecieT(s)%NfvT= Nfv
- deallocate(Nfv)
- end do
- deallocate(Nfvp)
- write(*, *) 'NfvT s1= ', SpecieT(1)%NfvT(1)
- write(*, *) 'NfvT s2= ', SpecieT(2)%NfvT(1)
- end program exporttest
- NfT s1= 1
- NfT s2= 1
- At line 68 of file exporttest.f90
- Fortran runtime error: Cannot open file '/Users/robertalbarran/Desktop/DISSERTATION/DSMCDATA/0:1:NfTfort.bin': No such file or directory
- Error termination. Backtrace:
- #0 0x1052bee46
- #1 0x1052bf718
- #2 0x1052bfd7c
- #3 0x10534005a
- #4 0x1053406e3
- #5 0x1050c59de
- #6 0x1050c5c5e
Add Comment
Please, Sign In to add comment