Author Message
Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Thu Apr 08, 2021 4:18 pm    Post subject: V8.71 %pl I would be grateful if somebody who has installed the updated version could test the following code. When I select the "half extents" button I see data points drawn in the left and right margins of the %pl region. I'm trying to decide if I've corrupted my FTN95 installation or not.

Thanks

Ken

 Code: module problem_mod use clrwin implicit none integer, parameter :: dp=kind(1.d0) integer, parameter :: npoints = 200 real(kind=dp) x(1:npoints), y(1:npoints)   contains integer function gen_data() integer i   do i = 1, npoints     x(i) = 2.d0*random@()-1.d0 ; y(i) = 2.d0*random@()-1.d0   end do   gen_data = 2 end function gen_data integer function plot_data() integer iw   iw = winio@('%2.1ob&')   call winop@('%pl[native, x_array, n_graphs=1, gridlines, link=none, symbol=6, frame, colour=blue, etched]')   iw = winio@('%pl&',1000,800,npoints,x,y)   iw = winio@('%cb&')   iw = winio@('This button sets xmin=-1, xmax=1, ymin=-1, ymax=1 &')   iw = winio@('%nl%^bt[Full extents]&', full_extents_cb)   iw = winio@('%2nlThis button sets xmin=-0.5, xmax=0.5, ymin=-0.5, ymax=0.5 &')   iw = winio@('%nlThis results in points being plotted in the left and right margins&')   iw = winio@('%nl%^bt[Half extents]&', half_extents_cb)   iw = winio@('%cb&')   iw = winio@(' ')   plot_data = 2 end function plot_data integer function full_extents_cb() integer i   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, -1.d0 )   i = CHANGE_PLOT_DBL@(0, 'x_max', 0,  1.d0 )   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, -1.d0 )   i = CHANGE_PLOT_DBL@(0, 'y_max', 0,  1.d0 )   call simpleplot_redraw@()   full_extents_cb = 2 end function full_extents_cb integer function half_extents_cb() integer i   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, -0.5d0 ) ; print*, i   i = CHANGE_PLOT_DBL@(0, 'x_max', 0,  0.5d0 ) ; print*, i   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, -0.5d0 ) ; print*, i   i = CHANGE_PLOT_DBL@(0, 'y_max', 0,  0.5d0 ) ; print*, i   call simpleplot_redraw@()   half_extents_cb = 2 end function half_extents_cb end module problem_mod program main use problem_mod implicit none integer i i = gen_data() i = plot_data() end program main    PaulLaidler
Site Admin Joined: 21 Feb 2005
Posts: 6836
Location: Salford, UK Posted: Thu Apr 08, 2021 4:46 pm    Post subject: Ken Is it 32 bits or 64 bits and does it make a difference?    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Thu Apr 08, 2021 5:08 pm    Post subject: Paul, It makes no difference, both 32 and 64 bit versions give the same response. What is interesting (or perhaps I mean frustrating) is that other code using this technique continues to run as expected, but I cannot see a reason why this simple example fails. Here is a screenshot: https://www.dropbox.com/s/ecs6wzkjb02y5su/pl_pic2.jpg?dl=0 PS Putting my installation back to a clean copy of FTN95 version 8.70 the code runs as expected. When I then install the April 6 2021 DLLs (newDLLs 77) and Clearwin+ mod files etc, the code does not run correctly.    DanRRight Joined: 10 Mar 2008
Posts: 2285
Location: South Pole, Antarctica Posted: Fri Apr 09, 2021 1:47 am    Post subject: Ken Yes, "half" makes dots drawn on the border. I installed Apr 6 update   Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Fri Apr 09, 2021 9:16 am    Post subject: Dan, Thanks for confirming this issue.    PaulLaidler
Site Admin Joined: 21 Feb 2005
Posts: 6836
Location: Salford, UK Posted: Fri Apr 09, 2021 10:38 am    Post subject: This failure has now been fixed and I have provided a new download via the sticlky post.    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Fri Apr 09, 2021 1:36 pm    Post subject: Paul, Thanks for this. I can confirm that this works for the sample above. Unfortunately I can still replicate the error in the more complex code I was looking at yesterday (under certain specific scenarios). I will look again at the this code for errors. It's only 180 lines of code, but the logic is complex and I'm pushing the envelope a bit in terms of my previous %pl usage. Ken    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Fri Apr 09, 2021 2:10 pm    Post subject: Paul,
This sample demonstrates the issue. If the first adjustment is *only* to the range of x values I still see points drawn in the left and right margins.
 Code: winapp module problem_mod use clrwin implicit none integer, parameter :: dp=kind(1.d0) integer, parameter :: npoints = 200 real(kind=dp) x(1:npoints), y(1:npoints)   contains integer function gen_data() integer i   do i = 1, npoints     x(i) = 2.d0*random@()-1.d0 ; y(i) = 2.d0*random@()-1.d0   end do   gen_data = 2 end function gen_data integer function plot_data() integer iw   iw = winio@('%2.1ob&')   call winop@('%pl[native, x_array, n_graphs=1, gridlines, link=none, symbol=6, frame, colour=blue, etched]')   iw = winio@('%pl&',1000,800,npoints,x,y)   iw = winio@('%cb&')   iw = winio@('This button sets xmin=-1, xmax=1, ymin=-1, ymax=1 &')   iw = winio@('%nl%^bt[Full extents]&', full_extents_cb)   iw = winio@('%2nlThis button sets xmin=-0.5, xmax=0.5 &')   iw = winio@('%nl%^bt[Half x extents]&', half_x_extents_cb)   iw = winio@('%2nlThis button sets ymin=-0.5, ymax=0.5 &')   iw = winio@('%nl%^bt[Half y extents]&', half_y_extents_cb)   iw = winio@('%bf%2nl After the window is initially displayed if&')   iw = winio@('%nl the first user action is to select "Half x extents"&')   iw = winio@('%nl points are displayed in the left and right margins&')   iw = winio@('%nl If "Half x extents" is selected after another button&')   iw = winio@('%nl the problem does not occur&')   iw = winio@('%cb&')   iw = winio@(' ')   plot_data = 2 end function plot_data integer function half_x_extents_cb() integer i   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, -0.5d0 )   i = CHANGE_PLOT_DBL@(0, 'x_max', 0,  0.5d0 )   call simpleplot_redraw@()   half_x_extents_cb =1 end function half_x_extents_cb integer function half_y_extents_cb() integer i   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, -0.5d0 )   i = CHANGE_PLOT_DBL@(0, 'y_max', 0,  0.5d0 )   call simpleplot_redraw@()   half_y_extents_cb =1 end function half_y_extents_cb integer function full_extents_cb() integer i   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, -1.d0 )   i = CHANGE_PLOT_DBL@(0, 'x_max', 0,  1.d0 )   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, -1.d0 )   i = CHANGE_PLOT_DBL@(0, 'y_max', 0,  1.d0 )   call simpleplot_redraw@()   full_extents_cb = 1 end function full_extents_cb end module problem_mod program main use problem_mod implicit none integer i i = gen_data() i = plot_data() end program main    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Fri Apr 09, 2021 11:22 pm    Post subject: Paul, I did a little more digging into this issue this evening. The second example I posted also fails with V8.70 The difference between the second example and earlier applications I have coded is that in the earlier codes there are always four calls to CHANGE_PLOT_DBL@ before the call to simpleplot_redraw@, i.e. I updated all four extent limits even when only two actually required to be changed. As a consequence, this issue was undetected until I deliberately started to avoid unnecessary calls to CHANGE_PLOT_DBL@ in the code I am presently working with. Below is a slightly modified version of my second example. If you remove the two lines commented out in the function half_extents_cb, then the problem when the user first clicks on the "half_extents" button does not occur.    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Fri Apr 09, 2021 11:48 pm    Post subject: Code: winapp module problem_mod use clrwin implicit none integer, parameter :: dp=kind(1.d0) integer, parameter :: npoints = 200 real(kind=dp) x(1:npoints), y(1:npoints) real(kind=dp) :: x_min = -1.d0, x_max = 1.d0, y_min = -1.d0, y_max = 1.d0 contains integer function gen_data() integer i   do i = 1, npoints     x(i) = 2.d0*random@()-1.d0 ; y(i) = 2.d0*random@()-1.d0   end do   gen_data = 2 end function gen_data integer function plot_data() integer iw   iw = winio@('%2.1ob&')   call winop@('%pl[native, x_array, n_graphs=1, gridlines, link=none, symbol=6, frame, colour=blue, etched]')   iw = winio@('%pl&',1000,800,npoints,x,y)   iw = winio@('%cb&')   iw = winio@('This button sets xmin=-1, xmax=1, ymin=-1, ymax=1 &')   iw = winio@('%nl%^bt[Full extents]&', full_extents_cb)   iw = winio@('%2nlThis button sets xmin=-0.5, xmax=0.5 &')   iw = winio@('%nl%^bt[Half x extents]&', half_x_extents_cb)   iw = winio@('%2nlThis button sets ymin=-0.5, ymax=0.5 &')   iw = winio@('%nl%^bt[Half y extents]&', half_y_extents_cb)   iw = winio@('%bf%2nl After the window is initially displayed if&')   iw = winio@('%nl the first user action is to select "Half x extents"&')   iw = winio@('%nl points are displayed in the left and right margins&')   iw = winio@('%nl If "Half x extents" is selected after another button&')   iw = winio@('%nl the problem does not occur&')   iw = winio@('%cb&')   iw = winio@(' ')   plot_data = 2 end function plot_data integer function half_x_extents_cb() integer i   x_min = -0.5d0   x_max =  0.5d0   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, x_min ) ;   i = CHANGE_PLOT_DBL@(0, 'x_max', 0, x_max ) !  i = CHANGE_PLOT_DBL@(0, 'y_min', 0, y_min )        !Uncomment these two lines and there is no issue !  i = CHANGE_PLOT_DBL@(0, 'y_max', 0, y_max )   call simpleplot_redraw@()   half_x_extents_cb =1 end function half_x_extents_cb integer function half_y_extents_cb() integer i   y_min = -0.5d0 ;   y_max =  0.5d0   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, y_min ) ;   i = CHANGE_PLOT_DBL@(0, 'y_max', 0, y_max)   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, x_min ) ;   i = CHANGE_PLOT_DBL@(0, 'x_max', 0, x_max)   call simpleplot_redraw@()   half_y_extents_cb =1 end function half_y_extents_cb integer function full_extents_cb() integer i   x_min = -1.d0 ;   x_max =  1.d0 ;   y_min = -1.d0 ;   y_max =  1.d0   i = CHANGE_PLOT_DBL@(0, 'x_min', 0, x_min ) ;   i = CHANGE_PLOT_DBL@(0, 'x_max', 0, x_max )   i = CHANGE_PLOT_DBL@(0, 'y_min', 0, y_min ) ;   i = CHANGE_PLOT_DBL@(0, 'y_max', 0, y_max )   call simpleplot_redraw@()   full_extents_cb = 1 end function full_extents_cb end module problem_mod program main use problem_mod implicit none integer i i = gen_data() ; i = plot_data() end program main    PaulLaidler
Site Admin Joined: 21 Feb 2005
Posts: 6836
Location: Salford, UK Posted: Sat Apr 10, 2021 9:05 am    Post subject: Ken

I am not sure that there is anything for me to fix here.

The ClearWin+ code does not always handle the case where the min and max values are not set initially but are then changed dynamically.

It may be possible to get ClearWin+ to handle this case but the logic does get more and more complex.

Try initialising these values to see if that works for you....

 Code: call winop_flt@('%pl[x_min]', x_min)   call winop_flt@('%pl[x_max]', x_max)   call winop_flt@('%pl[y_min]', y_min)   call winop_flt@('%pl[y_max]', y_max)    Kenneth_Smith Joined: 18 May 2012
Posts: 473
Location: Hamilton, Lanarkshire, Scotland. Posted: Sat Apr 10, 2021 12:21 pm    Post subject: As ever, thanks Paul, You have provided the missing link i.e. "The ClearWin+ code does not always handle the case where the min and max values are not set initially but are then changed dynamically." What I am trying to achieve is an auxiliary Fortran module with data and routes which when used in conjunction with %pl allow the application of %pv, %hx, %hv and a zoom function without any further processing of the raw input x, y data. This has the potential to simplify the writing of future code requiring these features. My idea was to let %pl choose the initial limits, then once the %pl region is formed as you know the %pl initial graphics width and graphics height (or can now deduce them following a resize), and have specified the margins, all the coordinate data required for a scroll or zoom operation can be deduced via calls to GET_PLOT_DATA@. This requires two callbacks to be attached to the %pl via '+'; one to process the scrollbar movements and one to annotate the plot via "PLOT_ADJUST" if required. At the moment the have %pv and %hv working correctly, with only %hv causing a problem if it is the first action of the user is to select the x-axis scroll bar. I think I have enough information now to complete the task, based on what you have told me and my observations. I will share the code if I am successful.    Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 Hour Page 1 of 1

 Jump to: Select a forum Admin----------------Announcements FTN95----------------GeneralKBaseSupportSuggestionsClearWin+Plato64-bit FTN77----------------Support
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