can now write points3d to a text file
This commit is contained in:
parent
d5ff30a545
commit
f89860afe0
@ -10,24 +10,49 @@ module points3d
|
||||
!-----------------------------------------------------
|
||||
contains
|
||||
|
||||
|
||||
subroutine list_points3d(array, start, length)
|
||||
type(t_point3d), dimension(:), intent(in) :: array
|
||||
integer, intent(in) :: start, length
|
||||
integer :: sz, i
|
||||
integer :: sz, i, j
|
||||
|
||||
write(0, '(1X, A15, 2I9)') "list pt3d ", start, length
|
||||
sz = ubound(array, 1)
|
||||
if ((start+length) .GT. sz) then
|
||||
STOP ' : OUT OF BOUND'
|
||||
STOP ' : LIST P3D, OUT OF BOUND'
|
||||
endif
|
||||
|
||||
! send oi to stdout.
|
||||
do i = start, start+length-1
|
||||
print *, array(i)%x, array(i)%y, array(i)%z, array(i)%seq
|
||||
! send values to stdout.
|
||||
do i = 1, length
|
||||
j = i + start
|
||||
print *, array(j)%x, array(j)%y, array(j)%z, array(j)%seq
|
||||
enddo
|
||||
|
||||
end subroutine list_points3d
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
subroutine write_points3d(array, start, length, fname)
|
||||
type(t_point3d), dimension(:), intent(in) :: array
|
||||
integer, intent(in) :: start, length
|
||||
character(*), intent(in) :: fname
|
||||
|
||||
integer :: sz, i, j, io
|
||||
|
||||
write(0, '(1X, A15, 2I9)') "write pt3d ", start, length
|
||||
sz = ubound(array, 1)
|
||||
if ((start+length) .GT. sz) then
|
||||
STOP ' : WRITE P3D, OUT OF BOUND'
|
||||
endif
|
||||
|
||||
open(newunit=io, file=fname)
|
||||
do i = 1, length
|
||||
j = i + start
|
||||
write(io, '(3F12.6)') array(j)%x, array(j)%y, array(j)%z
|
||||
enddo
|
||||
close(io)
|
||||
|
||||
end subroutine write_points3d
|
||||
|
||||
!-----------------------------------------------------
|
||||
|
||||
end module points3d
|
Loading…
Reference in New Issue
Block a user