44 'kper,kstp,imdl,iprp,irpt,ilay,icell,izone,&
45 &istatus,ireason,trelease,t,x,y,z,name'
48 '<i4,<i4,<i4,<i4,<i4,<i4,<i4,<i4,&
49 &<i4,<i4,<f8,<f8,<f8,<f8,<f8,|S40'
58 integer(I4B),
public :: iun = 0
59 logical(LGP),
public :: csv = .false.
60 integer(I4B),
public :: iprp = -1
65 logical(LGP) :: release
66 logical(LGP) :: featexit
67 logical(LGP) :: timestep
68 logical(LGP) :: terminate
69 logical(LGP) :: weaksink
70 logical(LGP) :: usertime
71 logical(LGP) :: subfexit
72 logical(LGP) :: dropped
83 integer(I4B),
public :: iout = -1
84 integer(I4B),
public :: ntrackfiles
103 integer(I4B),
intent(in) :: iun
104 logical(LGP),
intent(in),
optional :: csv
105 integer(I4B),
intent(in),
optional :: iprp
109 if (.not.
allocated(this%files))
then
110 allocate (this%files(1))
112 call this%expand_files(increment=1)
117 if (
present(csv)) file%csv = csv
118 if (
present(iprp)) file%iprp = iprp
119 this%ntrackfiles =
size(this%files)
120 this%files(this%ntrackfiles) = file
126 if (
allocated(this%files))
deallocate (this%files)
133 integer(I4B),
optional,
intent(in) :: increment
135 integer(I4B) :: inclocal
136 integer(I4B) :: isize
137 integer(I4B) :: newsize
140 if (
present(increment))
then
146 if (
allocated(this%files))
then
147 isize =
size(this%files)
148 newsize = isize + inclocal
149 allocate (temp(newsize))
150 temp(1:isize) = this%files
151 deallocate (this%files)
152 call move_alloc(temp, this%files)
154 allocate (this%files(inclocal))
169 logical(LGP),
intent(in) :: release
170 logical(LGP),
intent(in) :: featexit
171 logical(LGP),
intent(in) :: timestep
172 logical(LGP),
intent(in) :: terminate
173 logical(LGP),
intent(in) :: weaksink
174 logical(LGP),
intent(in) :: usertime
175 logical(LGP),
intent(in) :: subfexit
176 logical(LGP),
intent(in) :: dropped
177 this%selected%release = release
178 this%selected%featexit = featexit
179 this%selected%timestep = timestep
180 this%selected%terminate = terminate
181 this%selected%weaksink = weaksink
182 this%selected%usertime = usertime
183 this%selected%subfexit = subfexit
184 this%selected%dropped = dropped
194 selected = this%selected%release
196 selected = this%selected%featexit
198 selected = this%selected%subfexit
200 selected = this%selected%timestep
202 selected = this%selected%terminate
204 selected = this%selected%weaksink
206 selected = this%selected%usertime
208 selected = this%selected%dropped
210 call pstop(1,
"unknown event type")
222 save = (file%iun > 0 .and. &
223 (file%iprp == -1 .or. file%iprp == particle%iprp))
229 integer(I4B),
intent(in) :: iun
232 logical(LGP),
intent(in) :: csv
235 write (iun,
'(*(G0,:,","))') &
251 trim(adjustl(particle%name))
285 class(*),
pointer :: context
288 logical(LGP) :: handled
293 select type (context)
295 if (context%should_print()) &
296 call event%log(context%iout)
297 if (context%is_selected(event))
then
298 do i = 1, context%ntrackfiles
299 file = context%files(i)
300 if (context%should_save(particle, file)) &
301 call save_event(file%iun, particle, event, csv=file%csv)
This module contains simulation constants.
real(dp), parameter dpio180
real constant
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
subroutine, public transform(xin, yin, zin, xout, yout, zout, xorigin, yorigin, zorigin, sinrot, cosrot, invert)
Apply a 3D translation and optional 2D rotation to coordinates.
This module defines variable data types.
Particle track output module.
logical function is_selected(this, event)
Check if a given event code is selected for tracking.
subroutine destroy(this)
Destroy the particle track manager.
subroutine init_file(this, iun, csv, iprp)
Initialize a binary or CSV file.
character(len= *), parameter, public trackheader
subroutine select_events(this, release, featexit, timestep, terminate, weaksink, usertime, subfexit, dropped)
Pick events to track.
subroutine expand_files(this, increment)
Grow the array of track files.
logical function should_print(this)
Is the output unit valid?
subroutine, private save_event(iun, particle, event, csv)
Save an event to a binary or CSV file.
logical(lgp) function, public write_particle_event(context, particle, event)
Write a particle event to files for which the particle is eligible, and print the event to output uni...
character(len= *), parameter, public trackdtypes
logical function should_save(this, particle, file)
Check whether a particle belongs in a given file i.e. if the file is enabled and its group matches th...
Base type for particle events.
Dispatcher for particle events. Consumers subscribe handlers to the dispatcher. Events may be dispatc...
Particle tracked by the PRT model.
Selection of particle events.
Output file containing all or some particle pathlines.
Particle track output manager. Handles printing as well as writing to files. One output unit can be c...