functions don't need acces to variables of function
better keep them out
This commit is contained in:
parent
1cae6c4533
commit
efa30d1f3a
24
src/VTK.f90
24
src/VTK.f90
|
@ -102,7 +102,8 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
material = material + 1
|
||||
if (any(material<1)) call IO_error(error_ID = 844, ext_msg='material ID < 0')
|
||||
|
||||
contains
|
||||
end subroutine VTK_readVTI
|
||||
|
||||
|
||||
!------------------------------------------------------------------------------------------------
|
||||
!> @brief determine size and origin from coordinates
|
||||
|
@ -149,6 +150,7 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
integer, dimension(:), allocatable :: as_Int
|
||||
|
||||
|
||||
select case(dataType)
|
||||
case('Int32')
|
||||
as_Int = int(prec_bytesToC_INT32_T(asBytes(base64_str,headerType,compressed)))
|
||||
|
@ -177,6 +179,7 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
real(pReal), dimension(:), allocatable :: as_pReal
|
||||
|
||||
|
||||
select case(dataType)
|
||||
case('Int32')
|
||||
as_pReal = real(prec_bytesToC_INT32_T(asBytes(base64_str,headerType,compressed)),pReal)
|
||||
|
@ -204,6 +207,7 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes
|
||||
|
||||
|
||||
if (compressed) then
|
||||
bytes = asBytes_compressed(base64_str,headerType)
|
||||
else
|
||||
|
@ -212,6 +216,7 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
end function asBytes
|
||||
|
||||
|
||||
!------------------------------------------------------------------------------------------------
|
||||
!> @brief Interpret compressed Base64 string in vtk XML file as bytes
|
||||
!> @details A compressed Base64 string consists of a header block and a data block
|
||||
|
@ -225,9 +230,9 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
character(len=*), intent(in) :: base64_str, & ! base64 encoded string
|
||||
headerType ! header type (UInt32 or Uint64)
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes
|
||||
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes, bytes_inflated
|
||||
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes_inflated
|
||||
integer(pI64), dimension(:), allocatable :: temp, size_inflated, size_deflated
|
||||
integer(pI64) :: headerLen, nBlock, b,s,e
|
||||
|
||||
|
@ -269,11 +274,12 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
character(len=*), intent(in) :: base64_str, & ! base64 encoded string
|
||||
headerType ! header type (UInt32 or Uint64)
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes
|
||||
|
||||
integer(pI64) :: s
|
||||
integer(pI64), dimension(1) :: nByte
|
||||
|
||||
integer(C_SIGNED_CHAR), dimension(:), allocatable :: bytes
|
||||
|
||||
allocate(bytes(0))
|
||||
|
||||
s=0_pI64
|
||||
|
@ -293,13 +299,13 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
end function asBytes_uncompressed
|
||||
|
||||
|
||||
!------------------------------------------------------------------------------------------------
|
||||
!> @brief Get XML string value for given key
|
||||
!> @brief Get XML string value for given key.
|
||||
!------------------------------------------------------------------------------------------------
|
||||
pure function getXMLValue(line,key)
|
||||
|
||||
character(len=*), intent(in) :: line, key
|
||||
|
||||
character(len=:), allocatable :: getXMLValue
|
||||
|
||||
integer :: s,e
|
||||
|
@ -307,6 +313,7 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
character :: q
|
||||
#endif
|
||||
|
||||
|
||||
s = index(line," "//key,back=.true.)
|
||||
if (s==0) then
|
||||
getXMLValue = ''
|
||||
|
@ -331,13 +338,14 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
|
||||
!------------------------------------------------------------------------------------------------
|
||||
!> @brief check for supported file format
|
||||
!> @brief Check for supported file format variants.
|
||||
!------------------------------------------------------------------------------------------------
|
||||
pure function fileFormatOk(line)
|
||||
|
||||
character(len=*),intent(in) :: line
|
||||
logical :: fileFormatOk
|
||||
|
||||
|
||||
fileFormatOk = getXMLValue(line,'type') == 'ImageData' .and. &
|
||||
getXMLValue(line,'byte_order') == 'LittleEndian' .and. &
|
||||
getXMLValue(line,'compressor') /= 'vtkLZ4DataCompressor' .and. &
|
||||
|
@ -345,6 +353,4 @@ subroutine VTK_readVTI(cells,geomSize,origin,material, &
|
|||
|
||||
end function fileFormatOk
|
||||
|
||||
end subroutine VTK_readVTI
|
||||
|
||||
end module VTK
|
||||
|
|
Loading…
Reference in New Issue