2D AMRCLAW
moment.f
Go to the documentation of this file.
1 c
2 c ----------------------------------------------------------
3 c
4  subroutine moment (intrect,badpts,npt,usage)
5 c
6  use amr_module
7  implicit double precision (a-h,o-z)
8 
9 
10  dimension intrect(nsize),badpts(2,npt)
11 c
12 c :::::::::::::::::::::::: MOMENT ::::::::::::::::::::::::::::::::::
13 c moment = compute enclosing rectangle around flagged points.
14 c save some info., even tho. usage might be low and rect. scrapped.
15 
16 c input parameters:
17 c badpts = x,y coords of flagged badpts grouped into clusters
18 c are in the first two rows
19 c npt = num. of badpts. in the cluster.
20 c
21 c output parameters:
22 c usage = ratio of flagged to unflagged badpts. in new grid
23 c measures goodness of fit and clustering
24 c intrect( ) = stores some info. for grid created herein.
25 c sometimes rect = rnode, sometimes = temp. array.
26 c sometimes intrect = node.
27 c depending on calling prog. (grdfit or expand)
28 c
29 c
30 c :::::::::::::::::::::::: MOMENT ::::::::::::::::::::::::::::::::::
31 c
32  rn = dble(npt)
33 c
34 c compute length of enclosing rectangles to include all flagged badpts.
35 c
36  emx1 = badpts(1,1)
37  emn1 = emx1
38  emx2 = badpts(2,1)
39  emn2 = emx2
40  do 80 ipt = 1, npt
41  if (badpts(1,ipt) .gt. emx1) emx1 = badpts(1,ipt)
42  if (badpts(1,ipt) .lt. emn1) emn1 = badpts(1,ipt)
43  if (badpts(2,ipt) .gt. emx2) emx2 = badpts(2,ipt)
44  if (badpts(2,ipt) .lt. emn2) emn2 = badpts(2,ipt)
45  80 continue
46 c
47 c from length of the sides determine rect. corners.
48 c transform to cell numbers (subtract .5)
49 c
50  intrect(ndilo) = nint(emn1 - .5)
51  intrect(ndjlo) = nint(emn2 - .5)
52  intrect(ndihi) = nint(emx1 - .5)
53  intrect(ndjhi) = nint(emx2 - .5)
54 c
55 c compute usage
56 c
57  iside1 = intrect(ndihi) - intrect(ndilo) + 1
58  iside2 = intrect(ndjhi) - intrect(ndjlo) + 1
59  gpall = iside1 * iside2
60  usage = rn / gpall
61 c
62  return
63  end
subroutine moment(intrect, badpts, npt, usage)
Definition: moment.f:4