View previous topic :: View next topic |
Author |
Message |
saturn
Joined: 22 Apr 2008 Posts: 12
|
Posted: Mon Jun 14, 2010 12:20 pm Post subject: SALFORD UNFORMATTED INPUT/OUTPUT |
|
|
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? |
|
Back to top |
|
|
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Mon Jun 14, 2010 2:39 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Tue Jun 15, 2010 2:15 am Post subject: |
|
|
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 |
|
Back to top |
|
|
saturn
Joined: 22 Apr 2008 Posts: 12
|
Posted: Tue Jun 15, 2010 10:11 am Post subject: |
|
|
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@. |
|
Back to top |
|
|
IanLambley
Joined: 17 Dec 2006 Posts: 490 Location: Sunderland
|
Posted: Thu Jun 17, 2010 12:22 pm Post subject: |
|
|
I've written a couple of short programs to convert from one format to the other, see if these work.
They assume the following:
1. FTN95 record less than 255 bytes
<rec_len 1 btye> <record> <rec_len 1 btye>
2. FTN95 record greater or equal to 255 bytes
<FFhex 1 byte> <rec_len 4 btyes> <record> <rec_len 4 btyes> <FFhex 1 byte>
3. 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 |
|
Back to top |
|
|
saturn
Joined: 22 Apr 2008 Posts: 12
|
Posted: Thu Jun 17, 2010 12:47 pm Post subject: |
|
|
Ian, thanks a lot for this, I will adapt to requirements. |
|
Back to top |
|
|
|