2D AMRCLAW
Functions/Subroutines
trimbd.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine trimbd (used, nrow, ncol, set, unset_rect)
 Examine the setting status of a patch. More...
 

Function/Subroutine Documentation

◆ trimbd()

subroutine trimbd ( integer(kind=1), dimension(nrow,ncol), intent(in)  used,
integer, intent(in)  nrow,
integer, intent(in)  ncol,
logical, intent(out)  set,
integer, dimension(4), intent(out)  unset_rect 
)

Examine the setting status of a patch.

If used array is completely set (=1.) then return set=true, otherwise return false, along with the dimensions of the smallest rectangle containing all unset points in unset_rect(4)

Input:

  • an array of flags for the patch
  • size of the patch

Output:

  • examine results
  • which region is not set
Parameters
usedflags for the whole patch
nrowsize of the patch in i direction
ncolsize of the patch in j direction
setoutput whether the patch is completely set
unset_rectthe smallest rectangle that contains all unset points. The rectangle is described by its lower left corner, (unset_rect(1), unset_rect(3)), and its upper right corner, (unset_rect(2), unset_rect(4)).

Definition at line 33 of file trimbd.f90.

Referenced by filrecur().

33 
34  implicit none
35 
36  ! Input
37  integer, intent(in) :: nrow, ncol
38  integer(kind=1), intent(in) :: used(nrow,ncol)
39 
40  ! Output
41  logical, intent(out) :: set
42 ! integer, intent(out) :: il, ir, jb, jt
43  integer, intent(out) :: unset_rect(4)
44 
45  ! Locals
46  integer :: i, j, utot
47  integer(kind=1) :: check
48 
49  utot = 0
50  do 100 j = 1,ncol
51  do 100 i = 1,nrow
52 100 utot = utot + used(i,j)
53 
54  if (utot .eq. nrow * ncol ) then
55  set = .true.
56  else
57  set = .false.
58 
59  check = 1
60  do i = 1,nrow
61  do j = 1,ncol
62  check = min(check,used(i,j))
63  enddo
64  unset_rect(1) = i
65  if (check == 0) exit
66  enddo
67 
68  check = 1
69  do i = 1,nrow
70  do j = 1,ncol
71  check = min(check,used(nrow - i + 1,j))
72  enddo
73  unset_rect(2) = nrow - i + 1
74  if (check == 0) exit
75  enddo
76 
77  check = 1
78  do j = 1,ncol
79  do i = 1,nrow
80  check = min(check,used(i,j))
81  enddo
82  unset_rect(3) = j
83  if (check == 0) exit
84  enddo
85 
86  check = 1
87  do j = 1,ncol
88  do i = 1,nrow
89  check = min(check,used(i,ncol - j + 1))
90  enddo
91  unset_rect(4) = ncol - j + 1
92  if (check == 0) exit
93  enddo
94 
95  endif
96 
subroutine check(nsteps, time, nvar, naux)
Definition: check.f:5
Here is the caller graph for this function: