2D AMRCLAW
moment.f
Go to the documentation of this file.
1 
13 c
14 c ----------------------------------------------------------
15 c
16  subroutine moment (intrect,badpts,npt,usage)
17 c
18  use amr_module
19  implicit double precision (a-h,o-z)
20 
21 
22  dimension intrect(nsize),badpts(2,npt)
23 c
24 c :::::::::::::::::::::::: moment ::::::::::::::::::::::::::::::::::
25 c moment = compute enclosing rectangle around flagged points.
26 c save some info., even tho. usage might be low and rect. scrapped.
27 
28 c input parameters:
29 c badpts = x,y coords of flagged badpts grouped into clusters
30 c are in the first two rows
31 c npt = num. of badpts. in the cluster.
32 c
33 c output parameters:
34 c usage = ratio of flagged to unflagged badpts. in new grid
35 c measures goodness of fit and clustering
36 c intrect( ) = stores some info. for grid created herein.
37 c sometimes rect = rnode, sometimes = temp. array.
38 c sometimes intrect = node.
39 c depending on calling prog. (grdfit or expand)
40 c
41 c
42 c :::::::::::::::::::::::: moment ::::::::::::::::::::::::::::::::::
43 c
44  rn = dble(npt)
45 c
46 c compute length of enclosing rectangles to include all flagged badpts.
47 c
48  emx1 = badpts(1,1)
49  emn1 = emx1
50  emx2 = badpts(2,1)
51  emn2 = emx2
52  do 80 ipt = 1, npt
53  if (badpts(1,ipt) .gt. emx1) emx1 = badpts(1,ipt)
54  if (badpts(1,ipt) .lt. emn1) emn1 = badpts(1,ipt)
55  if (badpts(2,ipt) .gt. emx2) emx2 = badpts(2,ipt)
56  if (badpts(2,ipt) .lt. emn2) emn2 = badpts(2,ipt)
57  80 continue
58 c
59 c from length of the sides determine rect. corners.
60 c transform to cell numbers(subtract .5)
61 c
62  intrect(ndilo) = nint(emn1 - .5)
63  intrect(ndjlo) = nint(emn2 - .5)
64  intrect(ndihi) = nint(emx1 - .5)
65  intrect(ndjhi) = nint(emx2 - .5)
66 c
67 c compute usage
68 c
69  iside1 = intrect(ndihi) - intrect(ndilo) + 1
70  iside2 = intrect(ndjhi) - intrect(ndjlo) + 1
71  gpall = iside1 * iside2
72  usage = rn / gpall
73 c
74  return
75  end
integer, parameter ndihi
global i index of right border of this grid
Definition: amr_module.f90:111
integer, dimension(nsize, maxgr) node
Definition: amr_module.f90:198
real(kind=8), dimension(rsize, maxgr) rnode
Definition: amr_module.f90:193
integer, parameter nsize
Definition: amr_module.f90:31
subroutine moment(intrect, badpts, npt, usage)
Compute enclosing rectangle around flagged points.
Definition: moment.f:17
integer, parameter ndilo
global i index of left border of this grid
Definition: amr_module.f90:108
integer, parameter ndjlo
global j index of lower border of this grid
Definition: amr_module.f90:114
subroutine grdfit(lbase, lcheck, nvar, naux, cut, time, start_time)
This subroutine is called by setgrd and regrid to actually fit the new grids on each level...
Definition: grdfit2.f:22
integer, parameter ndjhi
global j index of upper border of this grid
Definition: amr_module.f90:117
The module contains the definition of a "node descriptor" as well as other global variables used duri...
Definition: amr_module.f90:21