MODFLOW 6  version 6.8.0.dev0
USGS Modular Hydrologic Model
scratchfilebuffermodule Module Reference

Scratch-file particle event buffer module.

Data Types

type  scratchfilebuffertype
 Scratch-file particle event buffer. Records are written to an unformatted sequential scratch file that is rewound on discard and read back sequentially on flush. More...
 

Functions/Subroutines

subroutine scratch_init (this)
 
subroutine scratch_append (this, rec)
 
subroutine scratch_flush (this, files)
 
subroutine scratch_discard (this)
 
subroutine scratch_destroy (this)
 

Function/Subroutine Documentation

◆ scratch_append()

subroutine scratchfilebuffermodule::scratch_append ( class(scratchfilebuffertype this,
type(particletrackrecordtype), intent(in)  rec 
)
private

Definition at line 40 of file ScratchFileBuffer.f90.

41  class(ScratchFileBufferType) :: this
42  type(ParticleTrackRecordType), intent(in) :: rec
43  write (this%iun) rec
44  this%nrecords = this%nrecords + 1

◆ scratch_destroy()

subroutine scratchfilebuffermodule::scratch_destroy ( class(scratchfilebuffertype this)
private

Definition at line 72 of file ScratchFileBuffer.f90.

73  class(ScratchFileBufferType) :: this
74  if (this%iun > 0) then
75  close (this%iun)
76  this%iun = 0
77  end if
78  this%nrecords = 0

◆ scratch_discard()

subroutine scratchfilebuffermodule::scratch_discard ( class(scratchfilebuffertype this)
private

Definition at line 66 of file ScratchFileBuffer.f90.

67  class(ScratchFileBufferType) :: this
68  rewind(this%iun)
69  this%nrecords = 0

◆ scratch_flush()

subroutine scratchfilebuffermodule::scratch_flush ( class(scratchfilebuffertype this,
type(particletrackfiletype), dimension(:), intent(in)  files 
)
private

Definition at line 47 of file ScratchFileBuffer.f90.

48  class(ScratchFileBufferType) :: this
49  type(ParticleTrackFileType), intent(in) :: files(:)
50  integer(I4B) :: n, i
51  type(ParticleTrackRecordType) :: rec
52 
53  rewind(this%iun)
54  do n = 1, this%nrecords
55  read (this%iun) rec
56  do i = 1, size(files)
57  if (files(i)%iun > 0 .and. &
58  (files(i)%iprp == -1 .or. files(i)%iprp == rec%iprp)) &
59  call save_record(files(i)%iun, rec, files(i)%csv)
60  end do
61  end do
62  rewind(this%iun)
63  this%nrecords = 0
Here is the call graph for this function:

◆ scratch_init()

subroutine scratchfilebuffermodule::scratch_init ( class(scratchfilebuffertype this)
private

Definition at line 31 of file ScratchFileBuffer.f90.

32  class(ScratchFileBufferType) :: this
33  integer(I4B) :: istat
34  open (newunit=this%iun, status='scratch', form='unformatted', &
35  access='sequential', iostat=istat)
36  if (istat /= 0) &
37  call pstop(1, 'failed to open scratch track buffer file')
Here is the call graph for this function: