Use the grid file to populate the grid points.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | file_handler | (input)file handling unit |
||
type(nodetype), | intent(out), | dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3) | :: | nodes | Grid points |
|
type(extent), | intent(in) | :: | dims | Extent of the domain:imx,jmx,kmx |
subroutine populate_grid_points(file_handler, nodes, dims)
!< Use the grid file to populate the grid points.
!-----------------------------------------------------------
implicit none
integer, intent(in) :: file_handler
!< (input)file handling unit
type(extent), intent(in) :: dims
!< Extent of the domain:imx,jmx,kmx
type(nodetype), dimension(-2:dims%imx+3,-2:dims%jmx+3,-2:dims%kmx+3), intent(out) :: nodes
!< Grid points
character(len=STRING_BUFFER_LENGTH) :: line
!< store read line
integer :: i, j, k
integer :: ios
!< input/output status
DebugCall('populate_grid_point')
! print *, imx, jmx, kmx
! Read grid points from the grid file
do k = 1, dims%kmx
do j = 1, dims%jmx
do i = 1, dims%imx
read(file_handler, '(A)', iostat=ios) line
if (ios /= 0) then
print *, 'Error while reading grid line.'
print *, 'Current grid point: ', i, j, k
print *, 'Current buffer length is set to: ', &
STRING_BUFFER_LENGTH
print *, 'Exiting program.'
!stop
end if
!call extract_grid_point(line, i, j, k)
read(line, *) nodes(i, j, k)%x, nodes(i, j, k)%y, nodes(i, j, k)%z
end do
end do
end do
end subroutine populate_grid_points