2D AMRCLAW
Functions/Subroutines
reclam.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine reclam (index, nwords)
 

Function/Subroutine Documentation

◆ reclam()

subroutine reclam (   index,
  nwords 
)

return of space. add to free list.

iplace points to next item on free list with larger index than the item reclaiming, unless said item is greater then everything on the list.

Definition at line 5 of file reclam.f.

References amr_module::lenf, amr_module::lentot, amr_module::lfdim, amr_module::lfree, amr_module::outunit, and amr_module::sprint.

Referenced by basecheck(), bufnst2(), cleanup(), colate2(), freeflags(), gfixup(), grdfit(), putsp(), restrt(), and saveqc().

5 c
6 c ::::::::::::::::::::::::: RECLAM :::::::::::::::::::::::::::
7 c
13 c
14 c ::::::::::::::::::::::::::::::::::;:::::::::::::::::::::::::
15 c
16  use amr_module
17  implicit double precision (a-h,o-z)
18 
19 
20 !$OMP CRITICAL (MemMgmt)
21 
22 c
23  do 20 i = 1, lenf
24  iplace = i
25  if (lfree(i,1) .gt. index) go to 30
26  20 continue
27  write(outunit,902)
28  write(*,902)
29  902 format(' no insertion pointer into freelist. error stop')
30  stop
31 c
32 c check previous segment for merging
33 c
34  30 iprev = iplace - 1
35  if (lfree(iprev,1)+lfree(iprev,2) .lt. index) go to 40
36  lfree(iprev,2) = lfree(iprev,2) + nwords
37  go to 50
38 c
39 c check after segment - no previous merge case
40 c
41  40 nexti = index + nwords
42  if (lfree(iplace,1).ne. nexti) go to 70
43  lfree(iplace,1) = index
44  lfree(iplace,2) = lfree(iplace,2) + nwords
45  go to 99
46 c
47 c check following segment - yes previous merge case
48 c
49  50 nexti = index + nwords
50  if (lfree(iplace,1) .ne. nexti) go to 99
51 c
52 c forward merge as well, bump all down 1
53 c
54  lfree(iprev,2) = lfree(iprev,2)+lfree(iplace,2)
55  ipp1 = iplace + 1
56  do 60 i = ipp1, lenf
57  lfree(i-1,1) = lfree(i,1)
58  60 lfree(i-1,2) = lfree(i,2)
59  lenf = lenf - 1
60  go to 99
61 c
62 c no merges case - insert and bump future segments up to make room
63 c
64  70 if (lenf .eq. lfdim) go to 900
65  do 80 ii = iplace, lenf
66  i = lenf + 1 - ii + iplace
67  lfree(i,1) = lfree(i-1,1)
68  80 lfree(i,2) = lfree(i-1,2)
69  lenf = lenf + 1
70  lfree(iplace,1) = index
71  lfree(iplace,2) = nwords
72  go to 99
73 c
74  900 write(outunit,901) lfdim
75  write(*,901) lfdim
76  901 format(' free list full with ',i5,' items')
77  stop
78 c
79  99 lentot = lentot - nwords
80  if (sprint) write(outunit,100) nwords, index, lentot
81  100 format(' reclaiming ',i8,' words at loc. ',i8,' lentot ',i10)
82 
83 !$OMP END CRITICAL (MemMgmt)
84 
85  return
logical sprint
Definition: amr_module.f90:297
integer, parameter lfdim
Definition: amr_module.f90:224
integer lentot
Definition: amr_module.f90:247
integer, parameter outunit
Definition: amr_module.f90:290
integer, dimension(lfdim, 2) lfree
Definition: amr_module.f90:225
integer lenf
Definition: amr_module.f90:225
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21
Here is the caller graph for this function: