- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Needing an array expert for review. I have converted an old program from f77 to f90. Everything compiles and links but there is an array problem.
PROBLEM WHEN X1 READS IT ALSO PUSHES DATA IN Y1
SAMES ISSUE WITH X2. IT WRITES TO NEXT AVAILABLE ENTRIES FOR Y1. UPON READ OF Y1, DATA ALSO OVERWRITES X1.
I will attach the files so someone can maybe take a look, compile or link.
Thanks for any help.
PROBLEM WHEN X1 READS IT ALSO PUSHES DATA IN Y1
SAMES ISSUE WITH X2. IT WRITES TO NEXT AVAILABLE ENTRIES FOR Y1. UPON READ OF Y1, DATA ALSO OVERWRITES X1.
I will attach the files so someone can maybe take a look, compile or link.
Thanks for any help.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Note table.txt needs to be renamed table.inp.
The upload would not accept a .inp file.
Thanks
The upload would not accept a .inp file.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the main program is a major error:
the statement CALL READ1(0,0) is in error, because the constant 0 will be overwritten as 1 by the statement IPAS1 = 1.
You should call READ1 in the main program as:
IPAS1 = 0
IERR = 0
CALL READ1(IPAS1, IERR)
But when this is corrected, X1 is indeed overwritten by Y1 in subroutine READ3. This happens when READ3 is called for the second time in subroutine READ2.
It appears that the ITAB indices are not correct: ITAB(2,2) = 548 and ITAB(4,2 ) = 549.
Via the call of READ3 in subroutine READ2: TAB(548) represents X1 and TABS(549) represents Y1. So, Y1(1...) overwrites X1(2... ).
I assume the computation of the ITAB indices is incorrect somewhere.
the statement CALL READ1(0,0) is in error, because the constant 0 will be overwritten as 1 by the statement IPAS1 = 1.
You should call READ1 in the main program as:
IPAS1 = 0
IERR = 0
CALL READ1(IPAS1, IERR)
But when this is corrected, X1 is indeed overwritten by Y1 in subroutine READ3. This happens when READ3 is called for the second time in subroutine READ2.
It appears that the ITAB indices are not correct: ITAB(2,2) = 548 and ITAB(4,2 ) = 549.
Via the call of READ3 in subroutine READ2: TAB(548) represents X1 and TABS(549) represents Y1. So, Y1(1...) overwrites X1(2... ).
I assume the computation of the ITAB indices is incorrect somewhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks nijhuis.
I see the error in the itabs. It should be as below.
ITAB (NT, 2) = ITAB (NT, 1) + NX
ITAB (NT, 3) = ITAB (NT, 2) + NY
ITAB (NT, 4) = ITAB (NT, 3) + NZ
Those other errors were a result of skinying down the code to post it.
I see the error in the itabs. It should be as below.
ITAB (NT, 2) = ITAB (NT, 1) + NX
ITAB (NT, 3) = ITAB (NT, 2) + NY
ITAB (NT, 4) = ITAB (NT, 3) + NZ
Those other errors were a result of skinying down the code to post it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After correcting the ITAB statements the program crashes because a string is read where a number is expected.
This happens, because the input file is not correct. The values NX, NY, NZ and NTAB as read in the file are not conform the amount of data following that line.
Guus
This happens, because the input file is not correct. The values NX, NY, NZ and NTAB as read in the file are not conform the amount of data following that line.
Guus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I caught that.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page