From 9f251cf0d8f0ce8a741f2399381f636a2fbe6749 Mon Sep 17 00:00:00 2001 From: Giovanni La Mura <giovanni.lamura@inaf.it> Date: Thu, 5 Oct 2023 12:47:09 +0200 Subject: [PATCH] Add a FORTRAN binary I/O callback --- src/sphere/file_io.f | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/sphere/file_io.f diff --git a/src/sphere/file_io.f b/src/sphere/file_io.f new file mode 100644 index 00000000..ebd708c5 --- /dev/null +++ b/src/sphere/file_io.f @@ -0,0 +1,33 @@ + SUBROUTINE OPEN_FILE(UID,NAME,STA,MODE) + INTEGER, INTENT(IN):: UID + CHARACTER*64, INTENT(IN):: NAME + CHARACTER*8, INTENT(IN):: STA + CHARACTER*12, INTENT(IN):: MODE + OPEN(UNIT=UID, FILE=NAME, STATUS=STA(1:7), FORM=MODE(1:11)) + END + SUBROUTINE CLOSE_FILE(UID) + INTEGER, INTENT(IN):: UID + CLOSE(UID) + END + SUBROUTINE READ_INT(UID, VALUE) + INTEGER, INTENT(IN):: UID + INTEGER, INTENT(OUT):: VALUE + READ(UID)VALUE + END + SUBROUTINE WRITE_COMPLEX(UID, RVAL, IVAL) + INTEGER, INTENT(IN):: UID + REAL*8, INTENT(IN):: RVAL, IVAL + COMPLEX*16:: VALUE + VALUE=COMPLEX(RVAL,IVAL) + WRITE(UID)VALUE + END + SUBROUTINE WRITE_DOUBLE(UID, VALUE) + INTEGER, INTENT(IN):: UID + REAL*8, INTENT(IN):: VALUE + WRITE(UID)VALUE + END + SUBROUTINE WRITE_INT(UID,VALUE) + INTEGER, INTENT(IN):: UID + INTEGER, INTENT(IN):: VALUE + WRITE(UID)VALUE + END -- GitLab