From 0f0a3c5479cc17b1c685f21d8fff71d75916faf6 Mon Sep 17 00:00:00 2001 From: Daniel Price Date: Wed, 29 Nov 2023 21:52:56 +1100 Subject: [PATCH] --movie flag alias for -dev /mp4; also render density if none specified and try to sensibly adapt limits if none set --- src/interactive.f90 | 12 +++++++----- src/plotstep.f90 | 5 +++++ src/splash.f90 | 30 ++++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/interactive.f90 b/src/interactive.f90 index 0249d454..1c7ff3e3 100644 --- a/src/interactive.f90 +++ b/src/interactive.f90 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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()) diff --git a/src/plotstep.f90 b/src/plotstep.f90 index c1e0ceeb..4cbd331c 100644 --- a/src/plotstep.f90 +++ b/src/plotstep.f90 @@ -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 @@ -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 diff --git a/src/splash.f90 b/src/splash.f90 index 478de17b..89bbc172 100644 --- a/src/splash.f90 +++ b/src/splash.f90 @@ -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 @@ -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 @@ -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 @@ -584,8 +587,8 @@ 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 @@ -593,7 +596,7 @@ program splash 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 @@ -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) @@ -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 @@ -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) @@ -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)' @@ -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')