Debian Codegraph @

src/globaldata.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-2026 Daniel Price. All rights reserved.
19 ! Contact: [email protected]
20 !
21 !-----------------------------------------------------------------
22
23 !----------------------------------------------------------------------------
24 !
25 ! modules containing global variables
26 !
27 !----------------------------------------------------------------------------
28 !
29 !--global parameters
30 !
31 module params
32 implicit none
33 integer, parameter :: doub_prec = selected_real_kind(P=10,R=30)
34 integer, parameter :: sing_prec = selected_real_kind(P=5,R=15)
35 integer, parameter :: int1 = selected_int_kind(1)
36 integer, parameter :: int8 = selected_int_kind(10)
37 integer, parameter :: maxplot=512 ! maximum number of plots (for multiplot arrays)
38 integer, parameter :: maxparttypes = 24 ! max # of different particle types
39 integer, parameter :: ltag = 32 ! length of header tags
40 integer, parameter :: maxhdr = 256 ! maximum number of header variables stored
41
42 public
43
44 end module params
45 !
46 !--particle data
47 !
48 module particle_data
49 use params
50 implicit none
51 integer :: maxpart,maxstep,maxcol ! dimensions of dat array
52 integer, allocatable, dimension(:) :: icolourme
53 integer(kind=int1), allocatable, dimension(:,:) :: iamtype
54 integer, allocatable, dimension(:,:) :: npartoftype
55 real, allocatable, dimension(:,:) :: masstype
56 real, allocatable, dimension(:) :: time, gamma
57 real, allocatable, dimension(:,:) :: headervals
58 real, allocatable, dimension(:,:,:) :: dat
59 real, parameter :: time_not_read_val = -0.5*huge(0.)
60
61 public
62
63 contains
64
65 logical function time_was_read(t)
66 real, intent(in) :: t
67
68 time_was_read = .true.
69 if (t <= time_not_read_val) time_was_read = .false.
70
71 end function time_was_read
72
73 end module particle_data
74 !
75 !--filenames
76 !
77 module filenames
78 implicit none
79 integer, parameter :: maxfile = 10001
80 integer :: nfiles,nsteps,ifileopen,iposopen
81 character(len=120), dimension(maxfile) :: rootname
82 character(len=100) :: fileprefix
83 character(len=120) :: defaultsfile,limitsfile,unitsfile,coloursfile
84 integer, dimension(maxfile) :: nstepsinfile
85 character(len=*), parameter :: tagline = &
86 'SPLASH: A visualisation tool for SPH data (c)2004-2026 Daniel Price and contributors'
87
88 public
89
90 contains
91
92 subroutine set_filenames(prefix)
93 character(len=*), intent(in) :: prefix
94
95 fileprefix = trim(adjustl(prefix))
96 if (fileprefix(len_trim(fileprefix):len_trim(fileprefix))=='.') then
97 fileprefix = fileprefix(1:len_trim(fileprefix)-1)
98 endif
99 defaultsfile = trim(adjustl(fileprefix))//'.defaults'
100 limitsfile = trim(adjustl(fileprefix))//'.limits'
101 unitsfile = trim(adjustl(fileprefix))//'.units'
102 coloursfile = trim(adjustl(fileprefix))//'.colours'
103
104 return
105 end subroutine set_filenames
106
107 end module filenames
108
109 !------------------------------------
110 ! modules containing plot settings
111 !------------------------------------
112 !
113 !--data
114 !
115 module settings_data
116 use params
117 implicit none
118 integer :: numplot,ncalc,ncolumns,nextra
119 integer :: ndataplots
120 integer :: ndim, ndimv
121 integer :: ndusttypes
122 integer :: idustfrac_plot = 0
123 integer :: ideltav_plot = 0
124 integer :: iautorender
125 integer :: icoords,icoordsnew,iformat,ntypes,iexact
126 integer :: istartatstep,iendatstep,nfreq
127 integer :: iverbose
128 integer, dimension(10) :: isteplist
129 logical :: ivegotdata, DataIsBuffered, ipartialread
130 logical :: buffer_data,iUseStepList,iCalcQuantities,iRescale
131 logical :: idefaults_file_read,enforce_code_units
132 logical :: buffer_steps_in_file = .false.
133 !--required array is dimensioned 0:maxplot so that required(icol) = .true.
134 ! does nothing bad if icol = 0 (much safer that way)
135 logical :: lowmemorymode
136 logical :: debugmode
137 logical :: UseFakeDustParticles, UseFastRender
138 logical, dimension(0:maxplot) :: required
139 logical, dimension(maxparttypes) :: UseTypeInRenderings
140 real, dimension(3) :: xorigin
141 character(len=120) :: device
142 character(len=20) :: track_string
143
144 namelist /dataopts/ buffer_data,iCalcQuantities,iRescale,xorigin, &
145 track_string,idustfrac_plot,ideltav_plot,UseFakeDustParticles
146
147 public
148
149 end module settings_data
150 !
151 !--multiplot settings
152 !
153 module multiplot
154 use params
155 implicit none
156 integer :: nyplotmulti
157 integer, dimension(maxplot) :: multiplotx,multiploty
158 integer, dimension(maxplot) :: irendermulti,ivecplotmulti
159 integer, dimension(maxplot) :: itrans,icontourmulti
160 logical, dimension(maxplot) :: x_secmulti
161 real, dimension(maxplot) :: xsecposmulti
162 logical, dimension(maxplot) :: iusealltypesmulti
163 logical, dimension(maxparttypes,maxplot) :: iplotpartoftypemulti
164 !
165 !--sort these into a namelist for input/output
166 !
167 namelist /multi/ nyplotmulti, &
168 itrans,multiplotx,multiploty,irendermulti, &
169 ivecplotmulti,icontourmulti,x_secmulti,xsecposmulti, &
170 iusealltypesmulti,iplotpartoftypemulti
171
172 public
173
174 end module multiplot