Fix bugs in particle track output.

This commit is contained in:
Paul Romano 2013-11-14 19:54:26 -05:00
parent a70fdd1b86
commit b83cdf207d
2 changed files with 10 additions and 7 deletions

View file

@ -414,7 +414,7 @@ contains
n_tracks = n_tracks/3
allocate(track_identifiers(3,n_tracks))
do i=1, n_tracks
track_identifiers(1:3,i) = track_(3*(i-1)+1 : 3*(i-1)+4)
track_identifiers(1:3,i) = track_(3*(i-1)+1 : 3*(i-1)+3)
end do
end if

View file

@ -24,7 +24,6 @@ contains
subroutine initialize_particle_track()
n_tracks = 0
allocate(coords(1,1))
end subroutine initialize_particle_track
!===============================================================================
@ -34,13 +33,17 @@ contains
subroutine write_particle_track(p)
type(Particle), intent(in) :: p
real(8), allocatable :: new_coords(:, :)
real(8), allocatable :: new_coords(:, :)
! Add another column to coords.
! Add another column to coords
n_tracks = n_tracks + 1
allocate(new_coords(3, n_tracks))
new_coords(:, 1:n_tracks-1) = coords
call move_alloc(FROM=new_coords, TO=coords)
if (allocated(coords)) then
allocate(new_coords(3, n_tracks))
new_coords(:, 1:n_tracks-1) = coords
call move_alloc(FROM=new_coords, TO=coords)
else
allocate(coords(3,1))
end if
! Write current coordinates into the newest column.
coords(:, n_tracks) = p % coord0 % xyz