can now write points3d to a text file

This commit is contained in:
tth 2022-03-27 04:37:14 +02:00
parent d5ff30a545
commit f89860afe0

View File

@ -10,24 +10,49 @@ module points3d
!----------------------------------------------------- !-----------------------------------------------------
contains contains
subroutine list_points3d(array, start, length) subroutine list_points3d(array, start, length)
type(t_point3d), dimension(:), intent(in) :: array type(t_point3d), dimension(:), intent(in) :: array
integer, intent(in) :: start, length 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) sz = ubound(array, 1)
if ((start+length) .GT. sz) then if ((start+length) .GT. sz) then
STOP ' : OUT OF BOUND' STOP ' : LIST P3D, OUT OF BOUND'
endif endif
! send oi to stdout. ! send values to stdout.
do i = start, start+length-1 do i = 1, length
print *, array(i)%x, array(i)%y, array(i)%z, array(i)%seq j = i + start
print *, array(j)%x, array(j)%y, array(j)%z, array(j)%seq
enddo enddo
end subroutine list_points3d 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 end module points3d