SALFORD FORTRAN 'UNFORMATTED' data output is different from the industry standard, which makes it difficult to process such data from other compilers such as Intel , PGI, and Microsoft FORTRAN all of which use the same format. Has anyone done any low-level work to output/input SALFORD 'unformatted' data that is compatible with Intel/PGI/Microsoft FORTRAN?
SALFORD UNFORMATTED INPUT/OUTPUT
Yes, I have written routines to read and write binary STL files. To do this I use OPENRW@ , WRITEF@ , READF@ and CLOSEF@
I have had no trouble reading binary STL files produced by CAD systems.
Regards, John
Have you tried FORM='UNFORMATTED', ACCESS='TRANSPARENT' or ACCESS='DIRECT' ? You may have better luck with these structures which do not include the record length. The other compilers may support these structures also. It all depends on how complex your I/O list is.
The other option is to use a text format. With present cpu speeds, the big time user is how big is the transfer file, rather than binary vs text I/O. You may be able to speed up the I/O dump, by simply excluding zeros or identifying multiple values in a text structure: such as 'i:j value' where I and j are ranges of subscripts, or 'i:n value' where i is the subscript and n is the count. The basic entry would be 'i value'. You will need to experiment with 'value' to minimise the size while providing sufficient precision. All this could be enclosed in a single subroutine to export or import arrays. This assumes you have access to the code for the other compilers. The other big advantage is that the text file can be more easily inspected or changed.
John
We adopted the text format path temporarily but want to maintain the binary format. I will try ACCESS='TRANSPARENT'/'DIRECT' options as well as OPENRW@/WRITEF@/READF@/CLOSEF@.
I've written a couple of short programs to convert from one format to the other, see if these work. They assume the following:
FTN95 record less than 255 bytes <rec_len 1 btye> <record> <rec_len 1 btye>
FTN95 record greater or equal to 255 bytes <FFhex 1 byte> <rec_len 4 btyes> <record> <rec_len 4 btyes> <FFhex 1 byte>
Other compilers <rec_len 4 btyes> <record> <rec_len 4 btyes>
Programs located at: www.norsoftdev.com/silverfrost/convert_unformatted.zip
They are not very neat and are jsut examples. Probably limited to records less than 65526 bytes, but increase the dimensions if there are problems, or use ALLOCATE etc.
Regards Ian
Ian, thanks a lot for this, I will adapt to requirements.