Silverfrost Forums

Welcome to our forums

Simpleplot

6 Feb 2007 1:44 #1610

I am new in using FTN95 and I would like to know how to 'call' simpleplot (isn't it: use spmodule ?).

I have downladed the documentation and copy/paste some of the example given. Plato 3 tells me: C:\Documents and Settings\collinet\Bureau\FreeFormat1.F95(2) : error 404 - Cannot find definition for MODULE SPMODULE

How do I do ? (I am conscious it is perhaps a stupid question) (I am under windows XP)

Thank you in advance !

6 Feb 2007 5:40 #1614

There is an example in 'Direct calls to SIMPLEPLOT' in ftn95.chm.

Which documentation and sample are you using?

6 Feb 2007 11:08 #1618

I was looking in Fsimpleplot.chm Now I am using this documentation, and find what you are talking about (thank you 😄 ).

Just one question:

What is that for (Direct calls to SIMPLEPLOT program): c--The start-up callback INTEGER FUNCTION StartCB() INCLUDE 'CLEARWIN.INS'

And again thanks (FTN95 is the only fortran compiler with IDE I manage to make working on my computer :roll: )

7 Feb 2007 4:16 #1619

I do not manage to plot curve. Here is the beginning of my program: PROGRAM HW2 WINAPP IMPLICIT NONE INTEGER N,K,winio@,l PARAMETER (N=145)

Then I create my data X,Y1,Y2,Y3

and I write:

   l=winio@('%pl[X_AXIS=pouet,Y_AXIS=error,SCALE=LINEAR_LOG,TITLE='Sample',
 & N_GRAPHS=3,COLOUR=red,COLOUR=blue,COLOUR=blue,X_ARRAY]',300,300,N,X,Y1,Y2,Y3)

The & is here because the line is too long. I get the answer: 'error 70 - Unterminated character constant' for the ligne l=winio@('%pl......

(I just want to plot three Y1 Y2 Y3 curves with logarithmic scale for x )

7 Feb 2007 9:57 #1628

Are you using free format Fortran? It is better if you do.

In free format your line can be quite long.

I you want to break the line you must follow the rules which probably means putting an ampersand at the end of the first line as well in this context.

When breaking character variables it is safer to use concatenation...

string = 'abcd' &
            & //'efgh'

The double quoted 'Sample' within a single quote is a potential problem but should be OK here.

7 Feb 2007 2:51 #1632

Thank you.

I have a another (last I hope) problem:

My program is on simple/double precision. But winio@ does not accept single precision array.

How do I make it plot my single precision array. I try to use DBLE but it doesn't seem to have any effect. Should I:

Declare DX, DY, DZ as double array X,Y,Z as simple array and then do DX=DBLE(X) or declare X as a simple arry and then do: X=DBLE(X) ?

thanks a lot in advance

7 Feb 2007 4:45 #1636

I would try DX=DBLE(X) but test it to make sure that all the elements are copied across.

7 Feb 2007 5:19 #1638

It works but when I do it

1.00000010^-16 becomes 1.00000001234567810^-16

But since it is at the end and just for plotting ......

13 Apr 2011 5:00 #8076

I tried to compile the clearwin-Simpleplot testprogram CLWIN_SP, found in Ftn95UserGuide.doc ('Using SimplePlot with FTN95') from BUSS 2001.

Compilation brought some error messages, which are bit too exotic for me. Did that example work somewhen at all? What could I do to get it work? I used just ftn95 without any special options.

These is the compiler output:

PROCESSING MODULE  [<SPWIN> FTN95/Win32 v5.50.0]
NO ERRORS  [<SPWIN> FTN95/Win32 v5.50.0]
NO ERRORS  [<CLWIN_SP> FTN95/Win32 v5.50.0]
  1. TYPE(SIMPLE_WINDOWS_DATA_STRUCT_T), DIMENSION(2) :: OpCodes *** Derived type SIMPLE_WINDOWS_DATA_STRUCT_T has not been declared *** SIMPLE_WINDOWS_DATA_STRUCT_T is not a derived-TYPE name
  2. OpCodes(1)%iOpc = SIMPLE_WINDOWS_SET_HDC_DIM ! hDC + dimensions *** The '%' operator can only be applied to objects which are a derived type *** The '%' operator can only be applied to objects which are a derived type
  3. OpCodes(1)%iPtr = LOC(HDC_DIM) ! See definition of SPWIN above *** The '%' operator can only be applied to objects which are a derived type *** The '%' operator can only be applied to objects which are a derived type
  4. OpCodes(2)%iOpc = SIMPLE_WINDOWS_END_LIST! End of list *** The '%' operator can only be applied to objects which are a derived type *** The '%' operator can only be applied to objects which are a derived type 8 ERRORS [<SP_SUPPLYBITMAP> FTN95/Win32 v5.50.0] NO ERRORS [<TSTFUN> FTN95/Win32 v5.50.0] NO ERRORS [<DRAWCONTL> FTN95/Win32 v5.50.0] NO ERRORS [<DRAWCONTS> FTN95/Win32 v5.50.0] NO ERRORS [<DRAWSURFL> FTN95/Win32 v5.50.0] NO ERRORS [<DRAWSURFS> FTN95/Win32 v5.50.0] NO ERRORS [<UPDATEWIN> FTN95/Win32 v5.50.0] NO ERRORS [<SETATTRIBUTES> FTN95/Win32 v5.50.0] *** Compilation failed
18 Apr 2011 3:00 #8087

I guess you need this module:

MODULE  SPWIN      ! Contains definition of values to pass to DDDATA
INTEGER,PARAMETER  :: SIMPLE_WINDOWS_WINDOW=1,SIMPLE_WINDOWS_PRINTER=2,  &
&SIMPLE_WINDOWS_DIB=4,SIMPLE_WINDOWS_METAFILE=8,SIMPLE_PERCENT=0,SIMPLE_PIXELS=1,SIMPLE_MM=2
TYPE  SIMPLE_WINDOWS_DATA_STRUCT_T
INTEGER  ::  iOpc        !  Corresponds  to  C++  long  int
INTEGER  ::  iPtr        !  Address  of  OpCode  specific  data
END  TYPE  SIMPLE_WINDOWS_DATA_STRUCT_T
TYPE  SIMPLE_WINDOWS_HDC_DATA_T
INTEGER  ::  hDC                    !  device  context  handle
INTEGER  ::  iWidth,  iHeight    !  plotting  area
END  TYPE  SIMPLE_WINDOWS_HDC_DATA_T
TYPE  SIMPLE_WINDOWS_SIZE_T
INTEGER  ::  iUnits   !  SIMPLE_PERCENT,  ..._PIXELS,  ..._MM
INTEGER  ::  iWidth,  iHeight,  iDepth
END  TYPE  SIMPLE_WINDOWS_SIZE_T
TYPE  SIMPLE_WINDOWS_ORIGIN_T
INTEGER  ::  iUnits   !  SIMPLE_PERCENT,  ..._PIXELS,  ..._MM
INTEGER  ::  iX, iY
END  TYPE  SIMPLE_WINDOWS_ORIGIN_T
TYPE HDC_DIM_TYPE
INTEGER*4 iBitmapDC, iWidth, iHeight
END TYPE HDC_DIM_TYPE
TYPE (HDC_DIM_TYPE) :: HDC_DIM
INTEGER, PARAMETER :: SIMPLE_WINDOWS_END_LIST = 0
INTEGER, PARAMETER :: SIMPLE_WINDOWS_SET_WINDOWNAME = 6
INTEGER, PARAMETER :: SIMPLE_WINDOWS_SET_HDC_DIM = 7

! Useful definition of data structure to hold BitmapDC to pass to SIMPLEPLOT

Contains

SUBROUTINE SP_SupplyBitmap     ! Pass Bitmap to SIMPLEPLOT
! Set up a Static (SAVEd) array of OpCodes. Each OpCode consists of an
! OpCode ID followed by an optional address of a data structure.
! The parameter block address is passed to SIMPLEPLOT by SUBROUTINE DDDATA.
!
! In this example:
!   SIMPLE_WINDOWS_SET_HDC_DIM specifies that the next integer is the address
!     of a data structure consisting of a Bitmap DC followed by its dimensions
!   SIMPLE_WINDOWS_END_LIST is the mandatory end of list item which does not
!     require the address of a structure
TYPE(SIMPLE_WINDOWS_DATA_STRUCT_T), DIMENSION(2) :: OpCodes
SAVE OpCodes
OpCodes(1)%iOpc = SIMPLE_WINDOWS_SET_HDC_DIM   ! hDC + dimensions
OpCodes(1)%iPtr = LOC(HDC_DIM)                 ! See definition of SPWIN above
OpCodes(2)%iOpc = SIMPLE_WINDOWS_END_LIST! End of list
CALL DDDATA(LOC(OpCodes))! Notify SIMPLEPLOT
CALL DEVNAM('WINDOW')   ! Select Window
CALL OWNNEW(.TRUE.)     ! Inhibit 'Continue' button
END subroutine SP_SupplyBitmap


SUBROUTINE UpdateWin
CALL OUTBUF  ! Flush buffers
CALL WINDOW_UPDATE@(HDC_DIM%iBitmapDC) ! Copy Bitmap to window
END subroutine UpdateWin
END MODULE SPWIN

you need this when you call Simpleplot routines to plot something in a %dw window like:

ans = winio@('%dw&',HDC_DIM%iBitmapDC) ! Pass bitmapDC to ClearWin

Agustin

Please login to reply.