MODFLOW 6
version 6.8.0.dev0
USGS Modular Hydrologic Model
Main Page
Modules
Data Types List
Files
File List
File Members
MemoryBuffer.f90
Go to the documentation of this file.
1
!> @brief In-memory particle event buffer module.
2
!<
3
module
memorybuffermodule
4
5
use
kindmodule
,
only
: i4b
6
use
particletrackeventbuffermodule
,
only
:
particletrackeventbuffertype
, &
7
particletrackrecordtype
, &
8
particletrackfiletype
, &
9
save_record
10
11
implicit none
12
private
13
public
::
memorybuffertype
14
15
!> @brief In-memory particle event buffer. Records are held in a
16
!! dynamically growing array that doubles in capacity as needed.
17
type
,
extends
(
particletrackeventbuffertype
) ::
memorybuffertype
18
type
(
particletrackrecordtype
),
allocatable
:: records(:)
!< buffer
19
contains
20
procedure
:: append =>
memory_append
21
procedure
:: flush =>
memory_flush
22
procedure
:: discard =>
memory_discard
23
procedure
:: destroy =>
memory_destroy
24
end type
memorybuffertype
25
26
contains
27
28
subroutine
memory_append
(this, rec)
29
class
(
memorybuffertype
) :: this
30
type
(
particletrackrecordtype
),
intent(in)
:: rec
31
type
(
particletrackrecordtype
),
allocatable
:: tmp(:)
32
33
if
(.not.
allocated
(this%records))
then
34
allocate
(this%records(64))
35
else
if
(this%nrecords ==
size
(this%records))
then
36
allocate
(tmp(
size
(this%records) * 2))
37
tmp(1:this%nrecords) = this%records
38
call
move_alloc(tmp, this%records)
39
end if
40
this%nrecords = this%nrecords + 1
41
this%records(this%nrecords) = rec
42
end subroutine
memory_append
43
44
subroutine
memory_flush
(this, files)
45
class
(
memorybuffertype
) :: this
46
type
(
particletrackfiletype
),
intent(in)
:: files(:)
47
integer(I4B)
:: n, i
48
type
(
particletrackrecordtype
) :: rec
49
50
do
n = 1, this%nrecords
51
rec = this%records(n)
52
do
i = 1,
size
(files)
53
if
(files(i)%iun > 0 .and. &
54
(files(i)%iprp == -1 .or. files(i)%iprp == rec%iprp)) &
55
call
save_record
(files(i)%iun, rec, files(i)%csv)
56
end do
57
end do
58
this%nrecords = 0
59
end subroutine
memory_flush
60
61
subroutine
memory_discard
(this)
62
class
(
memorybuffertype
) :: this
63
this%nrecords = 0
64
end subroutine
memory_discard
65
66
subroutine
memory_destroy
(this)
67
class
(
memorybuffertype
) :: this
68
if
(
allocated
(this%records))
deallocate
(this%records)
69
end subroutine
memory_destroy
70
71
end module
memorybuffermodule
kindmodule
This module defines variable data types.
Definition:
kind.f90:8
memorybuffermodule
In-memory particle event buffer module.
Definition:
MemoryBuffer.f90:3
memorybuffermodule::memory_discard
subroutine memory_discard(this)
Definition:
MemoryBuffer.f90:62
memorybuffermodule::memory_append
subroutine memory_append(this, rec)
Definition:
MemoryBuffer.f90:29
memorybuffermodule::memory_destroy
subroutine memory_destroy(this)
Definition:
MemoryBuffer.f90:67
memorybuffermodule::memory_flush
subroutine memory_flush(this, files)
Definition:
MemoryBuffer.f90:45
particletrackeventbuffermodule
Particle event buffering strategies.
Definition:
ParticleTrackEventBuffer.f90:2
particletrackeventbuffermodule::save_record
subroutine save_record(iun, rec, csv)
Save an event record to a binary or CSV file.
Definition:
ParticleTrackEventBuffer.f90:68
memorybuffermodule::memorybuffertype
In-memory particle event buffer. Records are held in a dynamically growing array that doubles in capa...
Definition:
MemoryBuffer.f90:17
particletrackeventbuffermodule::particletrackeventbuffertype
Event buffering strategy.
Definition:
ParticleTrackEventBuffer.f90:30
particletrackeventbuffermodule::particletrackfiletype
Output file containing all or some particle pathlines.
Definition:
ParticleTrackEventBuffer.f90:22
particletrackeventbuffermodule::particletrackrecordtype
Flat record of a particle track event.
Definition:
ParticleTrackEventBuffer.f90:10
src
Solution
ParticleTracker
Particle
MemoryBuffer.f90
Generated on Fri Jun 26 2026 11:14:26 for MODFLOW 6 by
1.9.1