47 'kper,kstp,imdl,iprp,irpt,ilay,icell,izone,&
48 &istatus,ireason,trelease,t,x,y,z,name'
51 '<i4,<i4,<i4,<i4,<i4,<i4,<i4,<i4,&
52 &<i4,<i4,<f8,<f8,<f8,<f8,<f8,|S40'
62 logical(LGP) :: subfexit
77 integer(I4B),
public :: iout = -1
78 integer(I4B),
public :: ntrackfiles = 0
99 integer(I4B),
intent(in) :: iun
100 logical(LGP),
intent(in),
optional :: csv
101 integer(I4B),
intent(in),
optional :: iprp
104 call this%expand_files(increment=1)
108 if (
present(csv)) file%csv = csv
109 if (
present(iprp)) file%iprp = iprp
110 this%ntrackfiles =
size(this%files)
111 this%files(this%ntrackfiles) = file
117 logical(LGP),
intent(in) :: scratch
119 if (.not.
allocated(this%files))
allocate (this%files(0))
125 call this%buffer%init()
131 call this%buffer%destroy()
137 integer(I4B),
optional,
intent(in) :: increment
138 integer(I4B) :: inclocal, isize, newsize
141 if (
present(increment))
then
147 if (
allocated(this%files))
then
148 isize =
size(this%files)
149 newsize = isize + inclocal
150 allocate (temp(newsize))
151 temp(1:isize) = this%files
152 deallocate (this%files)
153 call move_alloc(temp, this%files)
155 allocate (this%files(inclocal))
170 logical(LGP),
intent(in) :: release
171 logical(LGP),
intent(in) :: featexit
172 logical(LGP),
intent(in) :: timestep
173 logical(LGP),
intent(in) :: terminate
174 logical(LGP),
intent(in) :: weaksink
175 logical(LGP),
intent(in) :: usertime
176 logical(LGP),
intent(in) :: subfexit
177 logical(LGP),
intent(in) :: dropped
178 this%selected%release = release
179 this%selected%featexit = featexit
180 this%selected%timestep = timestep
181 this%selected%terminate = terminate
182 this%selected%weaksink = weaksink
183 this%selected%usertime = usertime
184 this%selected%subfexit = subfexit
185 this%selected%dropped = dropped
195 selected = this%selected%release
197 selected = this%selected%featexit
199 selected = this%selected%subfexit
201 selected = this%selected%timestep
203 selected = this%selected%terminate
205 selected = this%selected%weaksink
207 selected = this%selected%usertime
209 selected = this%selected%dropped
211 call pstop(1,
"unknown event type")
223 rec%kper = event%kper; rec%kstp = event%kstp
224 rec%imdl = event%imdl; rec%iprp = event%iprp
225 rec%irpt = event%irpt; rec%ilay = event%ilay
226 rec%icu = event%icu; rec%izone = event%izone
227 rec%istatus = event%istatus; rec%ireason = event%get_code()
228 rec%trelease = event%trelease; rec%ttrack = event%ttrack
229 rec%x = event%x; rec%y = event%y; rec%z = event%z
230 rec%name = trim(adjustl(particle%name))
232 call this%buffer%append(rec)
238 call this%buffer%flush(this%files)
244 call this%buffer%discard()
254 class(*),
pointer :: context
257 logical(LGP) :: handled
259 select type (context)
261 if (context%iout >= 0) &
262 call event%log(context%iout)
263 if (context%ntrackfiles > 0)
then
264 if (context%is_selected(event)) &
265 call context%buffer_event(particle, event)
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.
In-memory particle event buffer module.
@ usertime
user-specified tracking time
@ release
particle was released
@ terminate
particle terminated
@ timestep
time step ended
@ weaksink
particle entered a weak sink
@ dropped
particle dropped to the water table
@ featexit
particle exited a grid feature
subroutine destroy(this)
Destroy the dispatcher.
Particle event buffering strategies.
Particle track output module.
subroutine discard_buffer(this)
Discard buffered events without writing.
logical function is_selected(this, event)
Check if a given event code is selected for tracking.
subroutine init_file(this, iun, csv, iprp)
Initialize a binary or CSV output file.
subroutine buffer_event(this, particle, event)
Buffer an event for deferred write.
logical(lgp) function, public add_particle_event(context, particle, event)
Add a particle event to be written to eligible files and printed to an output file unit if requested....
character(len= *), parameter, public trackheader
subroutine flush_buffer(this)
Flush the event buffer to disk.
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.
subroutine init_buffer(this, scratch)
Initialize the event buffer strategy.
character(len= *), parameter, public trackdtypes
Scratch-file particle event buffer module.
In-memory particle event buffer. Records are held in a dynamically growing array that doubles in capa...
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.
Event buffering strategy.
Output file containing all or some particle pathlines.
Flat record of a particle track event.
Selection of particle events.
Particle track output manager. Handles printing as well as writing to files. One output unit can be c...
Scratch-file particle event buffer. Records are written to an unformatted sequential scratch file tha...