Debian Codegraph @

src/options_vecplot.f90

raw
1 !-----------------------------------------------------------------
2 !
3 ! This file is (or was) part of SPLASH, a visualisation tool
4 ! for Smoothed Particle Hydrodynamics written by Daniel Price:
5 !
6 ! http://users.monash.edu.au/~dprice/splash
7 !
8 ! SPLASH comes with ABSOLUTELY NO WARRANTY.
9 ! This is free software; and you are welcome to redistribute
10 ! it under the terms of the GNU General Public License
11 ! (see LICENSE file for details) and the provision that
12 ! this notice remains intact. If you modify this file, please
13 ! note section 2a) of the GPLv2 states that:
14 !
15 ! a) You must cause the modified files to carry prominent notices
16 ! stating that you changed the files and the date of any change.
17 !
18 ! Copyright (C) 2005-2013 Daniel Price. All rights reserved.
19 ! Contact: [email protected]
20 !
21 !-----------------------------------------------------------------
22
23 !-------------------------------------------------------------------------
24 ! Module containing settings and options relating to vector plots
25 ! includes default values of these options and submenu for changing them
26 !-------------------------------------------------------------------------
27 module settings_vecplot
28 implicit none
29 integer :: npixvec,minpartforarrow,iVecLegendOnPanel
30 logical :: UseBackgndColorVecplot, iplotpartvec
31 logical :: iVecplotLegend,iplotstreamlines,iplotarrowheads
32 logical :: iplotsynchrotron,ihidearrowswherenoparts,iallarrowssamelength
33 real :: hposlegendvec,vposlegendvec
34 real :: rcrit,zcrit,synchrotronspecindex,uthermcutoff
35
36 namelist /vectoropts/ npixvec, UseBackgndColorVecplot,iplotpartvec,&
37 iVecplotLegend,hposlegendvec,vposlegendvec,iplotstreamlines, &
38 iplotarrowheads,iplotsynchrotron,rcrit,zcrit,synchrotronspecindex, &
39 uthermcutoff,ihidearrowswherenoparts,minpartforarrow,iallarrowssamelength,&
40 iVecLegendOnPanel
41
42 contains
43
44 !---------------------------------------------
45 ! set default values for these options
46 !---------------------------------------------
47 subroutine defaults_set_vecplot
48
49 npixvec = 40 ! pixels in x direction on vector plots
50 UseBackgndColorVecplot = .false. ! plot vector plot using black/white
51 iplotpartvec = .true. ! whether to plot particles on vector plot
52 iVecplotLegend = .true.
53 iVecLegendOnPanel = 0 ! all panels
54 hposlegendvec = 0.02
55 vposlegendvec = -1.5
56 iplotstreamlines = .false. ! plot stream lines instead of arrows
57 iplotarrowheads = .true.
58 iplotsynchrotron = .false.
59 zcrit = 2.5 ! kpc
60 rcrit = 13. ! kpc
61 synchrotronspecindex = 0.8
62 uthermcutoff = -1. ! flags this as uninitialised
63 ihidearrowswherenoparts = .false.
64 minpartforarrow = 1
65 iallarrowssamelength = .false.
66
67 return
68 end subroutine defaults_set_vecplot
69
70 !----------------------------------------------------------------------
71 ! sets options relating to vector plots
72 !----------------------------------------------------------------------
73 subroutine submenu_vecplot(ichoose)
74 use prompting, only:prompt,print_logical
75 use settings_data, only:ndim,numplot
76 use labels, only:iutherm
77 use limits, only:lim
78 use legends, only:prompt_panelselect
79 integer, intent(in) :: ichoose
80 integer :: ians
81
82 ians = ichoose
83 print "(a)",'--------------- vector plot options -------------------'
84
85 if (ians <= 0 .or. ians > 7) then
86 print 10,npixvec,print_logical(UseBackgndColorVecplot), &
87 print_logical(iVecplotLegend),print_logical(iplotstreamlines), &
88 print_logical(iplotarrowheads), &
89 print_logical(ihidearrowswherenoparts), &
90 print_logical(iallarrowssamelength)
91 10 format( &
92 ' 0) exit ',/, &
93 ' 1) change number of pixels (',i4,' )',/, &
94 ' 2) use background colour for arrows ( ',a,' )',/, &
95 ' 3) vector plot legend settings ( ',a,' )',/, &
96 ' 4) plot stream/field lines instead of arrows ( ',a,' )',/, &
97 ' 5) turn arrow heads on/off ( ',a,' )',/, &
98 ' 6) hide arrows where there are no particles ( ',a,' )',/, &
99 ' 7) all arrows same length - ie. direction only ( ',a,' )')
100 call prompt('enter option',ians,0,7)
101 endif
102 !
103 !--options
104 !
105 select case(ians)
106 !------------------------------------------------------------------------
107 case(1)
108 call prompt('enter number of pixels',npixvec,1,1000)
109 !------------------------------------------------------------------------
110 case(2)
111 UseBackgndColorVecplot = .not.UseBackgndColorVecplot
112 print*,'use background colour on vector plots = ', &
113 print_logical(UseBackgndColorVecplot)
114 !------------------------------------------------------------------------
115 case(3)
116 call prompt('plot vector legend?',iVecplotLegend)
117 if (iVecplotLegend) then
118 print*,'note: H key in interactive mode can also be used to set positions'
119 call prompt('Enter horizontal position as fraction of viewport', &
120 hposlegendvec,0.0,1.0)
121 call prompt('Enter vertical position in character heights from top', &
122 vposlegendvec)
123 call prompt_panelselect('vector legend',iVecLegendOnPanel)
124 endif
125 !------------------------------------------------------------------------
126 case(4)
127 iplotstreamlines = .not.iplotstreamlines
128 print "(2(a,/))",' Note: the number of stream lines plotted is determined by', &
129 ' the "change number of contours" option in the r)ender menu'
130 call prompt('use stream lines instead of arrows? ',iplotstreamlines)
131 !------------------------------------------------------------------------
132 case(5)
133 iplotarrowheads = .not.iplotarrowheads
134 call prompt('plot arrow heads? ',iplotarrowheads)
135 if (ndim==3 .and. .not.iplotarrowheads) then
136 call prompt(' plot synchrotron map? ',iplotsynchrotron)
137 if (iplotsynchrotron) then
138 if (iutherm < 0 .or. iutherm > numplot) then
139 print "(a)",' Warning: cannot use thermal energy cutoff in synchrotron plots'
140 print "(a)",' (could not locate thermal energy in data columns)'
141 endif
142 call prompt(' enter rcrit for cosmic ray electron distribution exp(-r/rcrit -z/zcrit)',rcrit,0.)
143 call prompt(' enter zcrit for cosmic ray electron distribution exp(-r/rcrit -z/zcrit)',zcrit,0.)
144 call prompt(' enter synchrotron spectral index I_nu = nu^-alpha ',synchrotronspecindex,0.)
145 if (iutherm > 0 .and. iutherm <= numplot) then
146 !--set sensible default value for uthermcutoff
147 if (uthermcutoff < -tiny(uthermcutoff)) then
148 uthermcutoff = 0.5*(lim(iutherm,1) + lim(iutherm,2))
149 endif
150 call prompt(' enter threshold thermal energy in current units (u < utherm not used) ',uthermcutoff,0.)
151 endif
152 endif
153 endif
154 !------------------------------------------------------------------------
155 case(6)
156 call prompt('hide vector arrows where there are no particles ? ',ihidearrowswherenoparts)
157 if (ihidearrowswherenoparts) then
158 call prompt(' enter minimum number of particles in pixel cell for arrow to be plotted ',minpartforarrow,1)
159 endif
160 !------------------------------------------------------------------------
161 case(7)
162 iallarrowssamelength = .not.iallarrowssamelength
163 call prompt('make all arrows same length (ie. only show direction, not magnitude) ?',iallarrowssamelength)
164 end select
165
166 return
167 end subroutine submenu_vecplot
168
169 end module settings_vecplot