|
|
Up |
|
|
  |
Author: LorentsLorents Date: Jul 11, 2008 12:08
Hello,
supposing array(:,:) is a doubleprecision array and on unit 1 there is
an unformatted file, is there a different between the forms:
read(1) ((array(i,j), j=1,jmax), i=1,imax)
and
do i =1, imax
do j =1, jmax
read(1) array(i,j)
enddo
enddo
I would say "no", but my experience seems to say otherwise...
Thanks,
Lorenzo
|
| |
|
| | 10 Comments |
|
  |
Author: Craig PowersCraig Powers Date: Jul 11, 2008 12:40
Lorents wrote:
> Hello,
> supposing array(:,:) is a doubleprecision array and on unit 1 there is
> an unformatted file, is there a different between the forms:
>
>
> read(1) ((array(i,j), j=1,jmax), i=1,imax)
>
>
> and
>
>
> do i =1, imax
> do j =1, jmax
> read(1) array(i,j)
> enddo
> enddo
>
>
> ...
|
| Show full article (0.94Kb) |
|
| | no comments |
|
  |
Author: fjfj Date: Jul 12, 2008 02:17
On 11 juil, 21:08, Lorents wrote:
> Hello,
> supposing array(:,:) is a doubleprecision array and on unit 1 there is
> an unformatted file, is there a different between the forms:
>
> read(1) ((array(i,j), j=1,jmax), i=1,imax)
>
> and
>
> do i =1, imax
> do j =1, jmax
> read(1) array(i,j)
> enddo
> enddo
>
> I would say "no", but my experience seems to say otherwise...
> Thanks,
>
> Lorenzo
|
| Show full article (1.44Kb) |
| no comments |
|
  |
Author: LorentsLorents Date: Jul 12, 2008 07:52
fj wrote:
>
> Yes there is a huge difference when the file is just "unformatted". In
> the first case you read a single record. In the second case, you read
> imax*jmax records. And usually, a record is composed of three part :
> descriptor,data,descriptor. It is easy to notice that the too read
> techniques are associated to two very different files.
Thank you all for the very helpful answers!
The situation is exactly as it's been suggested.
If one was working with FORMATTED files there would be no difference
between the two form of read/write (i...
|
| Show full article (1.30Kb) |
| no comments |
|
  |
Author: Gordon SandeGordon Sande Date: Jul 12, 2008 08:14
On 2008-07-12 11:52:51 -0300, Lorents said:
> fj wrote:
>>
>> Yes there is a huge difference when the file is just "unformatted". In
>> the first case you read a single record. In the second case, you read
>> imax*jmax records. And usually, a record...
|
| Show full article (2.62Kb) |
| no comments |
|
  |
Author: nospamnospam Date: Jul 12, 2008 08:23
Lorents wrote:
> If one was working with FORMATTED files there would be no difference
> between the two form of read/write (i.e., the one with an explicit DO
> loop and the one with in-line counters),
This is incorrect, or at least incomplete. Formatted I/O also involves
records and, just as with unformatted I/O, each read or write statement
normally processes exactly one record.
The diference is in that word "normally". With unformatted I/O, that
word could be omitted; each read or write statement for an unformatted
sequential file *ALWAYS* processes exactly one record.
With formatted I/O, there are exceptional cases. Those exceptional cases
might be what you are alluding to, but in that case, the claim is
seriously incomplete in that it applies only to those exceptional cases
rather than to formatted I/O in general.
The 4 exceptional cases are
1. "/" edit descriptors in explicit formats.
2. Format reversion (which is a bit complicated to explain)
3. Some cases of list-directed formatting.
4. Advance='no'
|
| Show full article (1.25Kb) |
| no comments |
|
  |
Author: nospamnospam Date: Jul 12, 2008 08:31
Gordon Sande worldnet.att.net> wrote:
> What has not been said is that Fortran's I/O model is record oriented
...
> So if you think partial reading and backspacing are important then Fortran
> has done it right and if you think byte streams are the future of modern
> file systems then Fortran has done it wrong. The opposite assumptions lead
> to opposite conclusions.
Of course, all of that was for Fortran 95 and earlier. As of Fortran
2003, Fortran does it both ways; you can choose. See fj's comments about
access='stream', known in some circles as threepwood.
(OK, the threepwood part is an "inside joke"; don't worry if you don't
get it.)
Admitedly, there are no full-language f2003 compilers yet, but there are
quite a few f95 compilers that have implemented this f2003 feature, and
the feature was modelled after compiler-specific functionality that has
been commonly available, but nonstandard and thus varying in exact
syntax, for some time.
|
| Show full article (1.16Kb) |
| no comments |
|
  |
Author: Gordon SandeGordon Sande Date: Jul 12, 2008 08:48
On 2008-07-12 12:31:29 -0300, nospam@see.signature (Richard Maine) said:
> Gordon Sande worldnet.att.net> wrote:
>
>> What has not been said is that Fortran's I/O model is record oriented
> ...
>> So if you think partial reading and backspacing are important then...
|
| Show full article (1.85Kb) |
| no comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Jul 18, 2008 16:22
Lorents wrote:
(snip)
> If one was working with FORMATTED files there would be no difference
> between the two form of read/write (i.e., the one with an explicit DO
> loop and the one with in-line counters), but there IS a difference with
> UNFORMATTED files. Also, looking at the binary files with a hex editor,
> I seem to understand that the "descriptor" is nothing but an 4-byte
> integer number counting the size in byte of the data that follows (am I
> write?)
That is a popular form, but the standard is independent of
the way records are described. All you need to know is that a
WRITE will write one record, a READ will read one, and that the
record being read should be at least as long as that needed.
Any part of the record not needed for the specific unformatted
READ statement is ignored.
|
| Show full article (1.47Kb) |
| no comments |
|
  |
|
|
  |
Author: DamianDamian Date: Jul 19, 2008 11:27
On Jul 11, 12:08 pm, Lorents wrote:
> Hello,
> supposing array(:,:) is a doubleprecision array and on unit 1 there is
> an unformatted file, is there a different between the forms:
>
> read(1) ((array(i,j), j=1,jmax), i=1,imax)
>
> and
>
> do i =1, imax
> do j =1, jmax
> read(1) array(i,j)
> enddo
> enddo
>
> I would say "no", but my experience seems to say otherwise...
> Thanks,
>
> Lorenzo
|
| Show full article (0.80Kb) |
| no comments |
|
|
|
|