Skip to content

Commit

Permalink
Merge pull request #3 from cMax347/master
Browse files Browse the repository at this point in the history
FEATURE added cmplx 6D tensor
  • Loading branch information
MRedies authored May 24, 2019
2 parents 65c08a3 + 657f74a commit 95c08d0
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/npy.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module m_npy
write_dbl_5dT,&
write_cmplx_dbl_3dT,&
write_cmplx_dbl_4dT,&
write_cmplx_dbl_5dT
write_cmplx_dbl_5dT,&
write_cmplx_dbl_6dT


end interface save_npy
Expand Down Expand Up @@ -481,6 +482,31 @@ Subroutine write_cmplx_sgn_vec(filename, vec)
End Subroutine write_cmplx_sgn_vec


Subroutine write_cmplx_dbl_6dT(filename, tensor)
Implicit None
character(len=*), intent(in) :: filename
complex(8), intent(in) :: tensor(:,:,:,:,:,:)
character(len=*), parameter :: var_type = "<c16"
integer(4) :: header_len, i,j, k

header_len = len(dict_str(var_type, shape(tensor)))

open(unit=p_un, file=filename, form="unformatted",&
access="stream")
write (p_un) magic_num, magic_str, major, minor
if(Big_Endian()) then
write (*,*) "6D tensors not implemented on BigEndian"
write (*,*) "write in issue if you need it"
stop 7
else
write (p_un) header_len
endif

write (p_un) dict_str(var_type, shape(tensor))
write (p_un) tensor
close(unit=p_un)
End Subroutine write_cmplx_dbl_6dT

Subroutine write_cmplx_dbl_5dT(filename, tensor)
Implicit None
character(len=*), intent(in) :: filename
Expand All @@ -494,7 +520,7 @@ Subroutine write_cmplx_dbl_5dT(filename, tensor)
access="stream")
write (p_un) magic_num, magic_str, major, minor
if(Big_Endian()) then
write (*,*) "3D tensors not implemented on BigEndian"
write (*,*) "5D tensors not implemented on BigEndian"
write (*,*) "write in issue if you need it"
stop 7
else
Expand All @@ -519,7 +545,7 @@ Subroutine write_cmplx_dbl_4dT(filename, tensor)
access="stream")
write (p_un) magic_num, magic_str, major, minor
if(Big_Endian()) then
write (*,*) "3D tensors not implemented on BigEndian"
write (*,*) "4D tensors not implemented on BigEndian"
write (*,*) "write in issue if you need it"
stop 7
else
Expand Down Expand Up @@ -778,7 +804,7 @@ Subroutine write_dbl_5dT(filename, tensor5)
access="stream")
write (p_un) magic_num, magic_str, major, minor
if(Big_Endian()) then
write (*,*) "4D tensors not implemented on BigEndian"
write (*,*) "5D tensors not implemented on BigEndian"
write (*,*) "write in issue if you need it"
stop 7
else
Expand Down

0 comments on commit 95c08d0

Please sign in to comment.