Array Visualizer Sample code

Array Visualizer Sample code

Hi,
Can anyone show me (or point me to)a piece of Fortran application code that calls the Array Visualizer routines to draw a 2D plot of a simple curve. For example, how does one invoke the Array Visualizer routine to plot y = sin(x) for 0<= x <=3.1415 from within some Fortran code.
I find that the AV document/guides are very inadequate in giving any useful hints about even simple tasks. Thanks.

publicaciones de 23 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

please also answer my question about AV.

Can AV draw a particular 2D plot which is called Three-component phase diagram in physical chemistry and which looks like a triangle(please see attached jpg).

sorry, I can't upload my jpg .(just 28kb)

There was an error creating your attachments. Please make sure your file type is accepted and that your attachments are smaller than 100.0 K.

sorry, I post too much message!
I upload the jpg to another place.
the attached jpg

Imagen de Community Admin

Are we talking about the Compaq Array Visualizer or the Intel Array Visualizer? Setting up a plot is quite different in the two products.

With respect to the posted jpg, Intel AV should be able to draw the plot (though the triangular grid will need to be rendered as an image).

John

thanks, john.

Can Compaq Array Visualizer do the job?
and would you please tell me where to find the document about drawing this particular plot?

I will post a new message, so please help chartad to solve the question.

Imagen de Community Admin

In response to chartad's original request, I've attached some fortran code displays a plot of sin(x) (and a screenshot).

Also, take a look at the sample programs that are included with the product. If you didn't install them when running setup, you can copy them from the cd.

John

Thanks for the reply John.
I had errors compiling this code. I am using Intel Fortran 7.0 compiler/tools under MS Visual C++ 6.0 environment. Here is the compiler error message:
------
Intel Fortran Compiler for 32-bit applications, Version 7.0 Build 20030212Z
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.
EPC Fortran-95 Version F95 Intel:200200:131124
Copyright (c) 1993-2000 EPCL. All Rights Reserved.
..........FadeSourceIntelAVtest.f90
program MAIN
Error FCE37 : Module AVDEF not found
Error FCE37 : Module AVVIEWER not found
Error FCE37 : Module DFLIB not found
..........FadeSourceIntelAVtest.f90: Error 355 : In program unit MAIN variable AV_TRUE has not been given a type
4 Errors
compilation aborted for ..........FadeSourceIntelAVtest.f90 (code 1)
Error executing c:windowssystem32cmd.exe.

IntelAVtest.obj - 4 error(s), 0 warning(s)
---------
I am inclined to assume that some source files (don't know which/where) have to be compiled along with this file to resolve for modules AVDEF, AVVIEWER,and DFLIB.
--------
Also, what Intel AV library modules will I need for the linker to do its thing, when I get that far? Thanks.

Regards,
Charles

Imagen de Community Admin

Sorry, I should have noted that the example I posted is for Compaq AV, not Intel AV. The IAV and CAV libraries have different routine names/functionality so you can't go from CAV to IAV by just re-compiling.

To build IAV programs you need to do the following:

1. Add /Include to the include path.
2. Add /Lib to the lib path.
3. Add /Include/AvFRT.f90 to your project.
4. Use the /MT flag in the compile (multi-threaded CRT lib).
5. Add AvFRT.lib, ole32.lib, oleaut32.lib to the link line.

See the release notes for more details.

John

Imagen de Community Admin

Here's a version and screen shot of the simple.f90 program I posted earlier modified to use IAV.

Since Intel Fortran v7.0 doesn't support interaction with COM objects (this should be coming in v8.0), in this version of IAV it's not possible to directly interact with the plot settings from Fortran.

To get around this limitation you can load a file that defines the graph(s), but does not contain any data. This is the template.xml file that I've posted here. I created the file by running the program, adding the graph interactively in the Array Viewer, deleting the data arrays, and then saving to template.xml.

The next time the program is run, it finds the template.xml file, and displays the viewer with the data arrays and the graph.

A big change between CAV and IAV is that in IAV the Viewer can display an arbitrary number of arrays and graphs, and there is not necessarily a 1-1 correspondence between arrays and graphs. Each graph may contain 0, 1, or more plots. And each plot may reference multiple datasets

John

Imagen de Community Admin

Here are the first two of the files I mentioned in my last post.

Imagen de Community Admin

Ok, one more time...You are not allowed to post xml files, so I made a zip file out of template.xml and main.f90.

John

Hi John,
I followed your suggestions for the Intel Fortran compiler, with the project options for include and library files added in the MS Visual C++ Tools/Options directories (Intel defualt directories are at C:Program FilesIntelArray VisualizerInclude, and similarly for Lib), adding the AVFRT.f90 source file to the project and the /MT line to the compiler directive. Compiled AVFRT.f90 first in the project, and then the graph file containing your example code. I got the following error messages. Here is the the latest compiler errors:
-------
Intel Fortran Compiler Build Tool
Intel Fortran Compiler for 32-bit applications, Version 7.0 Build 20030212Z
Copyright (C) 1985-2003 Intel Corporation. All rights reserved.
EPC Fortran-95 Version F95 Intel:200200:131124
Copyright (c) 1993-2000 EPCL. All Rights Reserved.
..........FadeSourceIntelAVtest.f90
program MAIN
Error FCE37 : Module AVDEF not found
Error FCE37 : Module AVVIEWER not found
Error FCE37 : Module DFLIB not found
..........FadeSourceIntelAVtest.f90: Error 355 : In program unit MAIN variable AV_TRUE has not been given a type
4 Errors
compilation aborted for ..........FadeSourceIntelAVtest.f90 (code 1)
Error executing c:windowssystem32cmd.exe.
IntelAVtest.obj - 4 error(s), 0 warning(s)
Thanks,
Charles

Imagen de Community Admin

Are you sure you grabbed the right file? This thread is confusing with a mixture of Intel AV and Compaq AV attachments.

The simple.f90 file I posted is for Compaq AV. It uses modules AVDEF, and AVVIEWER.

The sinx.zip file I posted later is for Intel AV. It contains main.f90 that uses AvFRT.

John

JOhn,
I had used your original Fortran files, which was intended for Compaq AV, and that caused the compiler to barf.
I downloaded the new zip files and compiled them, and got past the compile and link steps. When I run the program, it opens the Viewer and creates three entries under Root(DataDimScale1, DimScale1, XYPlot). When I double click on the XYplot, I a get display of the x-y axes with the tick points along the axes, but no graph of y =sin(x) is drawn, and no labels. The datasets look OK though.So, I am not sure what is causing this problem.
(I could not attach the Array Viewer output to this message, a .h5 type file). Thanks
Charles

Imagen de Community Admin

Charles,

It looks like one of the dataset names is getting accidently concatenated. Note in the code we have:

call avStartWatch(LOC(X), 1, dim1d, AV_REAL4, "DimScale1", status)
call avStartWatch(LOC(Y), 1, dim1d, AV_REAL4, "Data", status)

But the datasets show up in the viewer as, "DimScale1" and "DataDimScale", rather than "DimScale1" and "Data".

In the Viewer, check the Edit box, got to xyplot, and then in the right pane click on "sin(x)" in the contents list. You'll see the property page for the plot displayed with the XSource as "/DimScale1" and the YSource as "/Data". Since "/Data" doesn't exist, the plot isn't drawn.

If you change the YSource to "/DataDimScale1", you should see the plot.

The problem was caused by a bug in the program I posted. Go back to the main.f90 source, add a 'C' to the end of the name strings. i.e.:

call avStartWatch(LOC(X), 1, dim1d, AV_REAL4, "DimScale1"C, status)
call avStartWatch(LOC(Y), 1, dim1d, AV_REAL4, "Data"C, status)

This lets the compiler know it should pass null-terminated strings to the library. Rebuild and the plot should display correctly.

By the way, you can get around the restriction on attaching .h5 or .xml files by creating a zip file.

John

John,
Your fix worked like a charm. To me most of it looks like black magic!
I hope that someday (soon) your knowledge of this stuff can be documented so that software mortals like me can make intelligent use of the AV.
Again thanks a lot for your effort and patience.
Regards,
Charles

Imagen de Community Admin

Ok, great!

Regarding the documentation, at some point we would like to provide a tutorial that would provide a step-by-step guide on using AV. In the meantime, please post your questions on this forum and I'll do my best to answer them.

John

Hi John,
I had assumed that once I figured the AV 2Dplot for a generic "y=sin(x)" problem and got it to work in my Developer Environment, then I could use it for about any graph by making appropirate mods. Well, I was very wrong. I wrestled with the problem for a day and did not get very far - just frustrated! I basically ended up with no plot and the wrong scales on the axes.
So, here is a more general problem: If I want to graph (x,y), where y =f(x)= A sin(x), and the left and right limits on x (say x_left < x < x_right) and the constant A are input at runtime (say user input at the console), and I want to graph Npoints (again set at run time) what changes do I have to make to the template/and main.f90 files to accomplish this. The values for x_left and x_right may be negative.
For example in my "similar" case the values are -61.0 < x < 0.0, and A=2.85 The number of points to plot are Npoints=60. But on some other runs could be Npoints=100, 120 or other values.
Thanks,
Charles

Imagen de Community Admin

Hi Charles,

For a graph where the ranges are setup at runtime, you'll want to use the 2nd parameter of avLoadTemplate to replace placeholder names in the template file with the appropriate values.

This is how it works...In the template XML file, selected attributes are replaced with strings in the form: {ABC} where ABC can be any string. For instance the original template.xml file I posted had the xyplot Transform as:

This tells AV that the lower-left coordinate of the graph is (-0.7, -0.15) and the upper-right coordinate is (-0.7+4.55, -0.15+1.25), or (3.85, 1.1).

The template.xml file I'm posting now has the following:

The strings {XStart}, {YStart}, {XSize}, and {YSize} are replaced with the actual values to be used when the template is loaded.

This is where the 2nd parameter of avLoadTemplate comes in. It should be a string of name-value pairs in the form: "XStart=n.nn, YStart=n.nn, ...". The avLoadTemplate routine goes through the xml file and replaces every name string with the corresponding value.

By the way, when you are editing the XML file, it's a good idea to open it in Internet Explorer to make sure it is syntactically correct.

Unzip the attached file and try running main.f90 with the template.xml. The program now requests the user input x_left, x_right, etc. (note: no error checking!), and uses the values in avLoadTemplate.

I realize this all seems a bit tedious to create a simple XY Plot. In the next release I'm planning to add routines to the library to create basic plots automatically, e.g.

avCreateXYPlot("myxyplot", "Data", "DimScale1", status)

Even then it's not foolproof. For example, if after avCreateXYPlot s called the values of Data are modified so that the range is extended, then some points in the plot will be off the graph.

Anyway, let me know how this works for you.

John

Imagen de Community Admin

I'm having trouble attaching files (not for the first time!). Let me try again.

John

Imagen de Community Admin

Well that last one was my fault...

Inicie sesión para dejar un comentario.