mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Merge pull request #1040 from paulromano/internal-read-fix
Convert whitespace to blanks when reading arrays from XML
This commit is contained in:
commit
2a3996a33b
1 changed files with 19 additions and 0 deletions
|
|
@ -261,6 +261,7 @@ contains
|
|||
|
||||
! Get value of text node/attribute
|
||||
str = node_value_string(node, name)
|
||||
call whitespace_to_blanks(str)
|
||||
|
||||
! Read numbers into array
|
||||
read(UNIT=str, FMT=*, IOSTAT=stat) array
|
||||
|
|
@ -283,6 +284,7 @@ contains
|
|||
|
||||
! Get value of text node/attribute
|
||||
str = node_value_string(node, name)
|
||||
call whitespace_to_blanks(str)
|
||||
|
||||
! Read numbers into array
|
||||
read(UNIT=str, FMT=*, IOSTAT=stat) array
|
||||
|
|
@ -333,4 +335,21 @@ contains
|
|||
end if
|
||||
end subroutine get_node_array_string
|
||||
|
||||
!===============================================================================
|
||||
! WHITESPACE_TO_BLANKS converts all whitespace to blanks
|
||||
!===============================================================================
|
||||
|
||||
subroutine whitespace_to_blanks(str)
|
||||
character(len=*, kind=C_CHAR), intent(inout) :: str
|
||||
|
||||
integer :: i
|
||||
|
||||
do i = 1, len(str)
|
||||
select case (str(i:i))
|
||||
case (C_NEW_LINE, C_HORIZONTAL_TAB, C_CARRIAGE_RETURN)
|
||||
str(i:i) = ' '
|
||||
end select
|
||||
end do
|
||||
end subroutine
|
||||
|
||||
end module xml_interface
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue