MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
memorybuffermodule Module Reference

In-memory particle event buffer module.

Data Types

type  memorybuffertype
 In-memory particle event buffer. Records are held in a dynamically growing array that doubles in capacity as needed. More...

Functions/Subroutines

subroutine memory_append (this, rec)
subroutine memory_flush (this, files)
subroutine memory_discard (this)
subroutine memory_destroy (this)

Function/Subroutine Documentation

◆ memory_append()

subroutine memorybuffermodule::memory_append ( class(memorybuffertype) this,
type(particletrackrecordtype), intent(in) rec )

Definition at line 28 of file MemoryBuffer.f90.

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

◆ memory_destroy()

subroutine memorybuffermodule::memory_destroy ( class(memorybuffertype) this)
private

Definition at line 66 of file MemoryBuffer.f90.

67 class(MemoryBufferType) :: this
68 if (allocated(this%records)) deallocate (this%records)

◆ memory_discard()

subroutine memorybuffermodule::memory_discard ( class(memorybuffertype) this)
private

Definition at line 61 of file MemoryBuffer.f90.

62 class(MemoryBufferType) :: this
63 this%nrecords = 0

◆ memory_flush()

subroutine memorybuffermodule::memory_flush ( class(memorybuffertype) this,
type(particletrackfiletype), dimension(:), intent(in) files )
private

Definition at line 44 of file MemoryBuffer.f90.

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
Here is the call graph for this function: