Is there a convenient way to export/import a derived-type structure to a binary file?
For instance, let's assume that I have declared the following type
INTEGER,ALLOCATABLE :: A(:,:)
REAL :: SOME_VARIABLE
INTEGER,ALLOCATABLE :: ANOTHER_BIG_ARRAY(:,:,:)
END TYPE T_MY_TYPE
and that later on in my program I declared and initialized a variable MY_VAR of type T_MY_TYPE.
Is there a nice, convenient way to export MY_VAR to a binary file, and then load it back later on? Or should I go over all the components of MY_VAR, find whether they are allocated or not, write them to file along with a description of their size and allocation status, so that I can read MY_VAR later on.
It would be great if I could just do something like: WRITE(MY_UNIT) MY_VAR... The problem here is of course the presence of allocatable arrays (which may or may not be allocated) in the derived type structure. Otherwise it would just be a simple record of fixed length.
Thanks in advance,