Scaling graphs with using avLoadTemplate

Scaling graphs with using avLoadTemplate

Code:

!                                                                                
!   Copyright  (C) 2005 Intel Corporation.  All rights reserved.                 
!                                                                                
!   The information and source code contained herein is the exclusive property   
!   of Intel Corporation and may not be disclosed, examined, or reproduced in    
!   whole or in part without explicit written authorization from the Company.    
!                                                                                
!                                                                                
!  Threesin.f90 
!
!  FUNCTIONS:
!  Threesin      - Entry point of console application.
!
!  Example of using the Intel Array Visualizer library routines
!



    program Threesin
    use AvFRT

    implicit none

    ! Variables
    integer, parameter :: ncols = 1001   
    real, parameter :: pi=3.14159
    character(*), parameter :: templatename = 'template.xml'
    character(*), parameter :: filename = 'threesin.xml'
    real(4) :: XSCALE(ncols)
    real(4) :: SINX(ncols)
    real(4) :: SIN2X(ncols)
    real(4) :: SIN3X(ncols)
    real :: x
    real :: xinc
    character(256) :: templateparams
     
    integer status, viewerId, i

    ! Body of Threesin
    
    ! Initialize the arrays
    x = 0.0
    xinc = 4.0 * pi / (ncols-1)
    do i=1,ncols
        XSCALE(i) = x
	    SINX(i)  = 2.0 *sin(x)
	    SIN2X(i) = 2.0 *sin(2.0*x)
	    SIN3X(i) = 2.0 *sin(3.0*x)   
	    x = x + xinc
    end do

    ! Write params to a string
    write(templateparams, '("XStart=", F6.2, ", XSize=",  F6.2, ", YStart=", F6.2, ", YSize=",  F6.2)')   &
    ( XSCALE(1)-( 0.1*(XSCALE(ncols)-XSCALE(1)) ) ),      &   ! XStart
    ( (XSCALE(ncols) - XSCALE(1))*1.2 ),                  &   ! XSize
    (minval(SINX)),                                       &   ! YStart
    (maxval(SINX) - minval(SINX))                             ! YSize

    print *, "templateparams= ", templateparams


    
    !
    ! Load template file which will display M as a height plot graph
    !
    print *, "loading template"
    call avLoadTemplate(templatename, templateparams, status)  
    print *, "status: ", status
     
    ! Call StartWatch to let the Av lib know we're interested in viewing 
    ! the array.  avStartWatch needs to know the location, rank, shape, 
    ! and the type of the array.
    ! The string "Y" is use to identify the array in the viewer.
    call avStartWatch(LOC(XSCALE), 1, shape(XSCALE), AV_REAL4, "/data/xscale", status)
    call avStartWatch(LOC(SINX), 1, shape(SINX), AV_REAL4, "/data/sinx", status)
    call avStartWatch(LOC(SIN2X), 1, shape(SIN2X), AV_REAL4, "/data/sin2x", status)
    call avStartWatch(LOC(SIN3X), 1, shape(SIN3X), AV_REAL4, "/data/sin3x", status)

    ! Create the viewer
    call avNewViewer(viewerId)

    ! Make it visible
    call avVisible(viewerId, AV_TRUE, status)
     
    print *, "press enter to continue"
    read *
    
    print *, "saving to: ", filename
    call avSave(filename, status)
    print *, "status: ", status

    ! Remove the array(s) from the watch list
    ! This is not really necessary here, since resources used by the AV L
ib
    ! for the arrays will be freed when the program exits.
    call avEndWatch(LOC(XSCALE), status) 
    call avEndWatch(LOC(SINX), status) 
    call avEndWatch(LOC(SIN2X), status)  
    call avEndWatch(LOC(SIN3X), status) 

    end program Threesin

Hi,

When I run the sample project C:Program FilesIntelArray VisualizerSamplesFortranThreesin, the all are OK. Now I try applying this sample for my purpose. But I cant make the scaling of graphs. The xy-sizes of graphs are remained the same in the template.xml. I found (from AvVis.chm) that the scaling I can do with using AvFRT library subroutine avLoadTemplate (Fortran). For example, I want plot the graphs 2sin(x), 2sin(2x), 2sin(3x) versus x (0

! Write params to a string

write(templateparams, '("XStart=", F6.2, ", XSize=", F6.2, ", YStart=", F6.2, ", YSize=", F6.2)') &

( XSCALE(1)-( 0.1*(XSCALE(ncols)-XSCALE(1)) ) ), &! XStart

( (XSCALE(ncols) - XSCALE(1))*1.2 ), &! XSize

(minval(SINX)), &! YStart

(maxval(SINX) - minval(SINX)) ! YSize

print *, "templateparams= ", templateparams

!

! Load template file which will display M as a height plot graph

!

print *, "loading template"

call avLoadTemplate(templatename, templateparams, status)

print *, "status: ", status

This inclusions in sample program doesnt work correct. The xy-sizes of graphs are remained unchanged. The picture of graphs I attached to this message (sine plot.jpg). May be I understand not correct the destination of this subroutine. Or must I make something any more?

Sincerely, Gennadij

6 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Hi Gennadij,

Welcome to th AV forum!

I suspect in the template.xml file you are using you don't contain any strings like "{XStart}" that would be replaced by your templateparams string. If that's the case, the values you pass in won't have any effect.

I'll look into updating the sample to use the templateparam values like you've set up in your program. I'm on "winter break" now, so I probably won't have time to work onthis till I get back to the office after the New Year.

In the meantime, take a look at the modified version of the Threesin project that I created for this post: http://softwareforums.intel.com/ids/board/message?board.id=Visualizer&message.id=501. It doesn't use the template.xml file, but instead uses the AvObjMod interface to set up the plots directly. This should let you scale the graph as you desire. Let us know how that works for you.

John

Hi, John!

Merry Christmas and Happy New Year!

Thanks for answer. I found your modified version of the Threesin project (threesin2.f90) before my question. Now I have tested this sample. It works very well. If you will update the previous sample to use the templateparam it will be excellent as it is more simple.

Gennadij

Hello John,

I found this thread though this is far past for now but I'm a beginner of array visualizer.
I couldn't see the URL and your code that enables set the sacles freely.
I'd appreciate you very much if you could let thecode emerge on the thread again andme see the code.

hope you checkmy posting,

Akiko

The thread John refers to seems to be this one, but the attachment is no longer available. Sorry.

Steve - Intel Developer Support

I think this is the missing file (see attached)!John

Fichiers joints: 

Fichier attachéTaille
Télécharger Threesin2.f903.97 Ko

Connectez-vous pour laisser un commentaire.