forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

More Diagnostics for %pl of Simpleplot
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Mar 14, 2013 5:07 am    Post subject: More Diagnostics for %pl of Simpleplot Reply with quote

Well, this is about Simpleplot's %pl function again. This function is very handy but not many users seems use it and not all bugs are hunted down there.

If you make declaration in %pl[Y_MIN=1.d-7] or Y_MAX=1.d-3 expect to lose a day hunting the unexplainable behavior or the graph scales. This is because you naturally expect it to accept only double precision values but things here are exactly opposite, counterintuitive to general design of CWP.

Suggestion is for compiler to warn user that form of double precision is not accepted here or make it acceptable.

Another suggestion is to warn user when %pl can not use LOG scale user required due to zeros so the %pl switches to linear scale explaining why.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Thu Mar 14, 2013 7:45 am    Post subject: Reply with quote

Thanks for the input but realistically work on %pl is way down on the agenda.
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Thu Mar 14, 2013 4:40 pm    Post subject: Reply with quote

%pl is only usefull when you have to do some very simple plots. I used Simpleplot a lot from the very beginning (when BUSS was still alive in the 90') and I would advise to program specific subroutines for making graphics using the proper subroutines of Simpleplot. Manuals are in the Silverfrost web site, and yes, that requires more work but in the end you will find that you have better control of your graphs (and lots of other facilities). It is a pitty that the development of Simpleplot has been frozen but one get graph facilities for free....and that's good....at least for me...

Agustin
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Mar 14, 2013 7:08 pm    Post subject: Reply with quote

Is the axis tics issue fixed in the package? If yes, i might be interested

http://forums.silverfrost.com/viewtopic.php?t=2481
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Thu Mar 14, 2013 7:22 pm    Post subject: Reply with quote

well...to tell you the truth...no

This still existing bug and the lack of update or upgrade of some features of Simpleplot is a natural consequence of the dissapearance of BUSS software company.....I guess the last version of Simpleplot is now 12 years old....maybe too old for the today software standars, but it still works "almost" fine and free....but of course, if you need a better and bug-free solution, you then have to look at Gino, for example....as I use fortran for personal use, I can accept Simpleplot as it is...

Agustin
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Mar 14, 2013 9:21 pm    Post subject: Reply with quote

Is it really free? Where is Simpleplot LIB? Also can you show here small Fortran text for the simplest plot, say, for parabola, and show how do you compile?
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Mon Mar 18, 2013 12:41 am    Post subject: Reply with quote

Sorry for the delay but I was out for a couple of days and with no access to my computer.

First point: I said it is free because it comes with the fortran compiler, so you do not need to buy it apart like Gino or other graphic packages, although I do not know what happens if you want to use the routines in programs for commercial use.

Second point: there is no Simpleplot LIB (although there was one when BUSS was developing and selling the software, first for FTN77 and then for FTN90 and FTN95, among other compilers). Today you have just a DLL that comes with the distribution of FTN95. Manuals and help files (i.e. FSimpleplot.chm) are available in the Silverfrost web site.

Third point: here is an example of fortran code using the proper Simpleplot subroutines instead of %pl. You have to compile this code with Simpleplot.dll in order to run properly. I guess the Module SPwin is explained in the manuals.


[code:1:e6720f4926]
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

!this subroutine is needed if the content of the graph window changes during the program run
SUBROUTINE UpdateWin
CALL OUTBUF ! Flush buffers
CALL WINDOW_UPDATE@(HDC_DIM%iBitmapDC) ! Copy Bitmap to window
END subroutine UpdateWin
END MODULE SPWIN

program Simpleplot_plots
!requires simpleplot.dll
use mswin
use spwin
implicit none
real*4,dimension(100) ::xarr,yarr
integer*4 :: narr,ltype,xscale,yscale,nstep=1,mtype=5
integer*4 :: ctype,i,ans
character(8) :: xlabel="x",ylabel="y",p
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Mon Mar 18, 2013 7:55 am    Post subject: Reply with quote

I think the text was cut as usually due to too small size limits for forum post...
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Mon Mar 18, 2013 2:25 pm    Post subject: Reply with quote

yes!...it's funny because the "preview" of the message showed the whole text....here goes the part of the program:

Code:

program Simpleplot_plots
!requires simpleplot.dll
use mswin
use spwin
implicit none
real*4,dimension(100) ::xarr,yarr
integer*4 :: narr,ltype,xscale,yscale,nstep=1,mtype=5
integer*4 :: ctype,i,ans
character(8) :: xlabel="x",ylabel="y",ptype
real*4 :: minx,maxx,miny,maxy

narr=0
do i=1,100
  xarr(i)=2*i
  yarr(i)=i*i
  narr=narr+1
end do 

HDC_DIM%iWidth = 600
HDC_DIM%iHeight = 800
HDC_DIM%iBitmapDC = GET_Bitmap_DC@(HDC_DIM%iWidth, HDC_DIM%iHeight)
CALL SP_SupplyBitmap     ! Pass Bitmap to SIMPLEPLOT
call initsp
call pgfull(.true.)
!scale factor for text in graph
call textmg(1.5)
!characters set
call chset(0)
!direction of ticks: in, out
call axsbtk('XC','I')
call axsbtk('YC','O')
!line thickness
call thckmg('L',2.0)
!location of labels in the axes
CALL AXLBJS('**', 'Centre')
minx=minval(xarr)
maxx=maxval(xarr)
miny=minval(yarr)
maxy=maxval(yarr)
!define the graph scales: max and min values of x and y and the type of scales: 1-linear, 2-log
xscale=1;yscale=1
CALL SCALES(minx,maxx,xscale,miny,maxy,yscale)
!pen color 1...for axes
call pen(4)
!cross point of x and y
call axcrss('YC',minx)
! labels of axes
CALL AXES7(xlabel, ylabel)   
!pen color for data 
call pen(2)
!full line or dashed?
!ltype=0, full line,ltype=1, dashed
ltype=0
ptype="scatter"
ptype="curve"
if(ptype=='curve') then
!cvtype=1 -> smooth
!cvtype=3 -> straight lines 
ctype=3
call cvtype(ctype)
CALL BRKNCV(real(xarr,1),real(yarr,1),narr,ltype)
else !scatter
CALL MKSET(1) !set of markers 1,2,3......
CALL MARKCV(real(xarr,1),real(yarr,1),narr,mtype,nstep)
endif
ans=winio@('%ca[A Simple Plot with Simpleplot]%bg[grey]&')
ans=winio@('%dw&',HDC_DIM%iBitmapDC) ! Pass bitmapDC to ClearWin
ans=winio@('%ff%nl%cn%6bt[Close]')
end program simpleplot_plots


Agustin
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Mar 18, 2013 3:13 pm    Post subject: Reply with quote

I feel helplessly lost here. I always assumed that you got a stripped down minimal version with the FTN95.

Is it the case that SIMPLE.DLL contains the entirety of SimplePlot? (it is about 1/3 the size of Salflibc.dll, so there's a lot in it!).

Eddie
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Mon Mar 18, 2013 4:10 pm    Post subject: Reply with quote

As far as I tested simpleplot.dll, it contains the whole set of graphic subroutines, even those related to maps, 3D visualisation, etc. So, for taking full advantage of what Simpleplot can do, one needs to read carefully the help file (well, the sections corresponding to the type of graph one wants to program).

There is apparently a "minimal" version of Simpleplot in FTN95: it's the one that use %pl......but if you use directly Simpleplot trough a %dw window, you have quite a lot of possibilities. Simpleplot offers linear regressions, iso surfaces, drawing an iso surface in slices, contour maps, etc.


Agustin

P.D. by the way, the minimal example could be even more minimalistic (appart from the simpleplot module):

Code:

program Simpleplot_plots
!requires simpleplot.dll
use mswin
use spwin
implicit none
real*4,dimension(100) ::xarr,yarr
integer*4 :: narr,ltype,xscale,yscale,ctype,i,ans
character(8) :: xlabel="x",ylabel="y"
real*4 :: minx,maxx,miny,maxy
narr=0
do i=1,100
  xarr(i)=2*i
  yarr(i)=i*i
  narr=narr+1
end do 
HDC_DIM%iWidth = 600
HDC_DIM%iHeight = 800
HDC_DIM%iBitmapDC = GET_Bitmap_DC@(HDC_DIM%iWidth, HDC_DIM%iHeight)
CALL SP_SupplyBitmap     ! Pass Bitmap to SIMPLEPLOT
minx=minval(xarr)
maxx=maxval(xarr)
miny=minval(yarr)
maxy=maxval(yarr)
xscale=1;yscale=1
CALL SCALES(minx,maxx,xscale,miny,maxy,yscale)
CALL AXES7(xlabel, ylabel)   
ltype=0
CALL BRKNCV(real(xarr,1),real(yarr,1),narr,ltype)
ans=winio@('%ca[A Simple Plot with Simpleplot]%bg[grey]&')
ans=winio@('%dw&',HDC_DIM%iBitmapDC) ! Pass bitmapDC to ClearWin
ans=winio@('%ff%nl%cn%6bt[Close]')
end program simpleplot_plots
Back to top
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Mon Mar 18, 2013 4:27 pm    Post subject: Reply with quote

Hi Augustin,

So it's a %dw window, is it. My first encounters with Clearwin were trying to use a %dw window to replace the old DBOS graphics. I didn't make much headway for some years. The trick to make better progress is to use a %gr window. Perhaps it is worth revisiting %dw!

Thanks for the advice

Eddie
Back to top
View user's profile Send private message
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Mon Mar 18, 2013 5:07 pm    Post subject: Reply with quote

The confusion about what simpleplot.dll is likely comes from what the Ftn95 Help says: "ClearWin+ provides access to SIMPLEPLOT via a dynamic link library (simple.dll) that is distributed with Salford compilers. Access to this library is available by using the winio@ function together with the %pl format code. %pl is designed to be similar to %gr."

In fact, one can directly use Simpleplot.dll. The difference is that one uses %dw (with its limitations) instead of %gr (i.e. %pl). %pl was set to provide fortran users the possibility to make rather simple plots with minimal efforts. But Simpleplot is far more than that. It is far from perfect (rather old, the problem with ticks in the y-axes, fonts are far from the best ones, etc.)...but it works....

Agustin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Tue Mar 19, 2013 8:41 am    Post subject: Reply with quote

Augustin

I have noted your SimplePlot example above and the MODULE spwin.
I would be interested to know where this code comes from and if you know of a module or header file for the whole library.
Back to top
View user's profile Send private message AIM Address
aebolzan



Joined: 06 Jul 2007
Posts: 229
Location: La Plata, Argentina

PostPosted: Tue Mar 19, 2013 2:00 pm    Post subject: Reply with quote

When Ftn90 (not FTN95!) was still in the very beginning, David Butland from BUSS sent me the first directives for creating a module that allowed one to use SIMPLEPLOT with Clearwin+ through a %dw window. Then, they added it in the printed manuals that used to come with the installation disks. Today you can find these instructions in the document "Using SimplePlot with FTN95" in this address: http://www.silverfrost.com/23/ftn95/support/documentation.aspx.

With this module you can use the whole library (v. 2-16), even those related to maps. The only problem is that the manual for maps is not available in the Silverfrost site. I know that you can use maps because I checked it some time ago with some old examples, but I have no manuals at all because when I bought Simpleplot in the 90' the map library was a set that was sold apart at a different price.

Agustin

Update!!!: maps examples are available in the help file FSimpleplot.chm, also available at Silverfrost....interesting is that no information about the module for using Simpleplot with FNT90/95 is available there...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group