Skip to content

Commit

Permalink
--movie flag alias for -dev /mp4; also render density if none specifi…
Browse files Browse the repository at this point in the history
…ed and try to sensibly adapt limits if none set
  • Loading branch information
danieljprice committed Nov 29, 2023
1 parent f854440 commit 0f0a3c5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
12 changes: 7 additions & 5 deletions src/interactive.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module interactive_routines
use colourbar, only:barisvertical,incolourbar,incolourbarlabel,adjustcolourbar
implicit none
public :: interactive_part,interactive_step,interactive_multi
private :: mvlegend,mvtitle,save_limits,save_rotation
public :: set_movie_mode,save_limits
private :: mvlegend,mvtitle,save_rotation
private :: get_vptxy
real, private :: xcursor = 0.5
real, private :: ycursor = 0.5
Expand Down Expand Up @@ -1257,7 +1258,7 @@ subroutine interactive_part(npart,iplotx,iploty,iplotz,irender,icontour,ivecx,iv
call unset_movie_mode()
in_movie_mode = .false.
else
call set_movie_mode()
call set_movie_mode(.true.)
in_movie_mode = .true.
endif
iadvance = 0
Expand Down Expand Up @@ -3127,7 +3128,7 @@ end subroutine change_colourmap
!
!--set movie mode
!
subroutine set_movie_mode()
subroutine set_movie_mode(live)
use settings_page, only:iaxis,papersizex,aspectratio,ipapersize,ipapersizeunits,iPageColours
use settings_limits, only:adjustlimitstodevice
use settings_render, only:iColourBarStyle
Expand All @@ -3136,6 +3137,7 @@ subroutine set_movie_mode()
use colourbar, only:set_floating_bar_style
use system_utils, only:get_copyright
use shapes, only:add_text
logical, intent(in) :: live

iaxis = -2
iPageColours = 2
Expand All @@ -3144,10 +3146,10 @@ subroutine set_movie_mode()
ipapersizeunits = 0
papersizex = 1280.
aspectratio = 0.5625
call plot_pap(papersizex,aspectratio,ipapersizeunits)
if (live) call plot_pap(papersizex,aspectratio,ipapersizeunits)
iColourBarStyle = 8
call set_floating_bar_style(iColourBarStyle,4)
call set_pagecolours(iPageColours)
if (live) call set_pagecolours(iPageColours)
adjustlimitstodevice = .true.
endif
call add_text(0.025,0.05,get_copyright())
Expand Down
5 changes: 5 additions & 0 deletions src/plotstep.f90
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
use geomutils, only:changecoords,changeveccoords
use legends, only:ipanelselect
use asciiutils, only:string_delete
use system_utils, only:get_command_flag
use plotlib, only:plot_sci,plot_page,plot_sch,plot_qci,plot_qls,&
plot_sls,plot_line,plot_pt1,plotlib_is_pgplot
integer, intent(inout) :: ipos,istepsonpage,irender_nomulti
Expand Down Expand Up @@ -1830,6 +1831,10 @@ subroutine plotstep(ipos,istep,istepsonpage,irender_nomulti,icontour_nomulti,ive
call transform_limits(contmin,contmax,itrans(icontourplot))
endif
endif
if (iadapt .and. get_command_flag('movie')) then
call save_limits(irenderplot,rendermin,rendermax)
iadapt = .false.
endif
endif
endif
if (iplotcont .and. .not.gotcontours) then
Expand Down
30 changes: 22 additions & 8 deletions src/splash.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ program splash
!
! -------------------------------------------------------------------------
! Version history/ Changelog:
! 3.10.0 : (29/11/23)
! --sort flag to sort filenames for comparison plots;
! --movie flag to automatically make movie from sequence of files
! 3.9.0 : (06/11/23)
! follow-the-label column choice, where if a label is selected for plotting
! from the first file, it will automagically shift to find the matching label
Expand Down Expand Up @@ -555,7 +558,7 @@ program splash
use geomutils, only:set_coordlabels
use defaults, only:defaults_set,defaults_read,defaults_set_360
use initialise,only:defaults_set_initial
use limits, only:read_limits,lim
use limits, only:read_limits,lim,set_limits
use kernels, only:ikernel,select_kernel_by_name,select_kernel
use mainmenu, only:menu,allowrendering,set_extracols
use mem_allocation, only:deallocate_all
Expand All @@ -567,7 +570,7 @@ program splash
use system_utils, only:lenvironment,renvironment,envlist, &
get_environment_or_flag,get_command_option,get_command_flag
use asciiutils, only:read_asciifile,basename,match_column,&
reorder_filenames_for_comparison,split,extension
sort_filenames_for_comparison,split,extension
use write_pixmap, only:isoutputformat,iwritepixmap,pixmapformat,isinputformat,ireadpixmap,readpixformat
use convert, only:convert_all
use write_sphdata, only:issphformat
Expand All @@ -584,16 +587,16 @@ program splash
use set_options_from_dataread, only:set_options_dataread
use exact, only:ispiral,nfiles_exact=>nfiles,filename_exact
use multiplot, only:itrans
use labels, only:lenlabel,label,unitslabel,shortlabel
use limits, only:set_limits
use labels, only:lenlabel,label,unitslabel,shortlabel,irho
use interactive_routines, only:set_movie_mode
implicit none
integer :: i,ierr,nargs,ipickx,ipicky,irender,icontour,ivecplot,il
logical :: ihavereadfilenames,evsplash,doconvert,useall,iexist,use_360,got_format,do_multiplot
logical :: using_default_options,got_exact
character(len=120) :: string,exactfile
character(len=12) :: convertformat
character(len=lenlabel) :: stringx,stringy,stringr,stringc,stringv
character(len=*), parameter :: version = 'v3.9.0 [6th Nov 2023]'
character(len=*), parameter :: version = 'v3.10.0 [29th Nov 2023]'

!
! initialise some basic code variables
Expand Down Expand Up @@ -678,6 +681,8 @@ program splash
case('dev','device')
i = i + 1
call get_argument(i,device)
case('movie','-movie')
device = '/mp4'
case('l')
i = i + 1
call get_argument(i,limitsfile)
Expand Down Expand Up @@ -938,8 +943,8 @@ program splash
call guess_format(nfiles,rootname,ierr)
endif

if (ihavereadfilenames .and. get_command_flag('interleave')) then
call reorder_filenames_for_comparison(nfiles,rootname)
if (ihavereadfilenames .and. get_command_flag('sort')) then
call sort_filenames_for_comparison(nfiles,rootname)
endif

if (ikernel==0) then
Expand Down Expand Up @@ -1021,7 +1026,14 @@ program splash
! read plot limits from file (overrides get_data limits settings)
!
if (ivegotdata) call read_limits(trim(limitsfile),ierr)

!
! if device is mp4 auto-render column density in Hollywood mode if nothing is set
!
if (device == '/mp4' .and. irender == 0) then
irender = irho
nomenu = .true.
if (using_default_options) call set_movie_mode(.false.)
endif
!
! use log colour bar by default if more than 3 orders of magnitude range
! (and no limits file and using default options)
Expand Down Expand Up @@ -1169,6 +1181,7 @@ subroutine print_usage(quit)
print "(a)",' -c[ontour] column : contoured quantity'
print "(a)",' -multi : multiplot'
print "(a)",' -dev device : specify plotting device on command line (e.g. -dev /xw)'
print "(a)",' --movie : shortcut for -dev /mp4 to make a movie from plot sequence'
print "(a)",' --xsec=1.0 : specify location of cross section slice'
print "(a)",' --kappa=1.0 : specify opacity, and turn on opacity rendering'
print "(a)",' --anglex=30 : rotate around x axis (similarly --angley, --anglez)'
Expand All @@ -1179,6 +1192,7 @@ subroutine print_usage(quit)
print "(a)",' --track=666 : track particle number 666'
print "(a)",' --track=maxdens : track particle at maximum density'
print "(a)",' --exact=file1,f2 : read and plot exact solution from ascii files file1 and f2'
print "(a)",' --sort : sort filenames for comparison (e.g. snap_000 snap1_000 snap2_000)'
call print_available_formats('short')
print "(a)"
ltemp = issphformat('none')
Expand Down

0 comments on commit 0f0a3c5

Please sign in to comment.