Trouble about Array Viewer!

Trouble about Array Viewer!

Hello, everyone:

I have tried to display some arrays in Array viewer using fav Routines. For example,

Subroutine viewary( )
use AVDef
use AVViewer
use DFLib
allocatable :: testA(:)
!DEC$ATTRIBUTES array_visualizer :: testA
real xmax, x
integer istatus, ihv
allocate (testA(0:2000))
......

xmax=0.1
DO i=0, 2000
x=xmax*i/2000.0
100 testA(x)=dsqrt(x)
END DO

call faglStartWatch(testA, istatus)
call FavStartViewer(ihv, istatus)
call favSetArray(ihv, testA, istatus)
call favShowWindow(ihv, AV_TRUE, istatus)
call faglSaveAsFile(testA, "testA.agl", istatus)
call favEndViewer(ihv, istatus)
call faglEndWatch(testA, istatus)
deallocate(testA)
END Subroutine viewary

The display result is that the x axis range is not from 0 to 0.1 but from 0 to 2000, and the wanted curve is hardly seen because it only spreads in the very narrow x range(0 to 0.1 as compared with 0 to 2000).

If I replace the line 100 by

100 testA(i)=dsqrt(x)

Then the wanted curve is seen to spread along all the x range, but the x_axis value displayed is not from 0 to 0.1 but yet from 0 to 2000.

What is the reason?

Thank you in advance!

Wen

8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello Wen,

I don't think:

testA(x)=dsqrt(x)

is what you want. The index for testA should be an integer between 0 and 2000. Instead:

testA(i)=dsqrt(x)

looks to be what you trying to do, i.e. initializing testA to contain the sqrts of values between 0.0 and 0.1. But as you noted, when you display the array in the Array Viewer you see an xrange of 0 to 2000. That's because the default behaviour is to display the array indices along the x-axis. To display different x-axis labels you need to create an additional array containing the x values and then call favSetDimScale.

The code would look like this:

Subroutine viewary( )
use AVDef
use AVViewer
use DFLib

real(8), allocatable :: testA(:)
real(8), allocatable :: xscale(:)
!DEC$ATTRIBUTES array_visualizer :: testA
real(8) xmax, x

integer istatus, ihv
allocate (testA(0:2000))
allocate (xscale(0:2000))

xmax=0.1
DO i=0, 2000
x=xmax*i/2000.0
100 testA(i)=dsqrt(x)
xscale(i) = x

END DO

call faglStartWatch(testA, istatus)
call faglStartWatch(xscale, istatus)
call FavStartViewer(ihv, istatus)
call favSetArray(ihv, testA, istatus)
call favSetDimScale(ihv, 1, xscale, istatus)
call favShowWindow(ihv, AV_TRUE, istatus)
call faglSaveAsFile(testA, "testA.agl", istatus)
call favEndViewer(ihv, istatus)
call faglEndWatch(testA, istatus)

deallocate(testA)
deallocate(xscale)
END Subroutine viewary

John

Johnreadey,

Thank you for your consideration.

I have tried it again as what you suggested but there was still no change. It seems a big trouble.

Can you give me some resource about CVF?

Wen

I'm not sure what the problem could be. I'll attach the source for the program I ran and a screen shot. Is this not what you are looking for?

John

Johnreadey,
Yes, I have done as what you suggested under Win32 API enviroment. I used a dialog to replace the keyboard response in your program. I also found that if I only utilized the line: call fagSaveasFile(...), what I had saved in the file was not what I needed X_scale_modified figure but the original form. So, I saved the figure directly in the array viewer as another file then everything was OK.

But another problem is coming: how can I realize the logarithm scale(uneven intervals) on X axis?

Thank you!
wen

Yes, that looks like a bug. At least saving from the Array Viewer works ok.

Logarithmic scales aren't supported in the Compaq Array Visualizer, but they are in the new Intel Array Visualizer that ships with Intel Fortran v7.0. There's a free trial download if you want to try it out.

John

Can you tell me the website?

30-Day Trial of Intel Fortran for Windows (includes Array Visualizer). Be aware that it looks quite different from the one in CVF.

Steve

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today