























































































































 


































































































































































 























































































































































































 



















































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                



















































































subroutine NullDecomp_Startup(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignment,cc&
  &tk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levfac,cctk_le&
  &voff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash2,cctk_a&
  &sh3, X0area,X0kern,X1area,X1kern,kern_length,area,kern, X0EG_mask,X0EQ_mask,X0EV_mask,X0NullGrParArrI,X0NullGrParArrR,X0RadCrd,X&
  &0StCmCrd,X0StCrd,X0guard_mask,X1EG_mask,X1EQ_mask,X1EV_mask,X1StCmCrd,X1StCrd,X1guard_mask,EG_mask,EQ_mask,EV_mask,guard_mask,nu&
  &ll_delta,null_dx,null_gsh,null_lbnd,null_lsh,null_rb,null_rbh,null_ubnd,null_xb,null_xbh,qsize,stereo_p,stereo_pp,stereo_q,zeta)
    use NullDecomp_Vars
    use NullDecomp_SpinDecomp

    implicit none

    TARGET:: area, kern

    interface
  integer*8 function CCTK_PointerTo (var)
  implicit none
  type(*),dimension(..),TARGET :: var
  end function CCTK_PointerTo
  end interface
  interface
  integer function CCTK_Equals (arg1, arg2)
  implicit none
  integer*8 arg1
  character(*) arg2
  end function CCTK_Equals
  integer function CCTK_MyProc (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_MyProc
  integer function CCTK_nProcs (cctkGH)
  implicit none
  integer*8 cctkGH
  end function CCTK_nProcs
  integer function CCTK_IsThornActive (name)
  implicit none
  character(*) name
  end function CCTK_IsThornActive
  integer*8 function CCTK_NullPointer ()
  implicit none
  end function CCTK_NullPointer
  end interface

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0area
  INTEGER X0kern
  INTEGER X1area
  INTEGER X1kern
  INTEGER kern_length
  REAL*8 area (X0area,X1area)
  integer, parameter :: cctki_use_area = kind(area)
  REAL*8 kern (X0kern,X1kern,kern_length)
  integer, parameter :: cctki_use_kern = kind(kern)
  INTEGER X0EG_mask
  INTEGER X0EQ_mask
  INTEGER X0EV_mask
  INTEGER X0NullGrParArrI
  INTEGER X0NullGrParArrR
  INTEGER X0RadCrd
  INTEGER X0StCmCrd
  INTEGER X0StCrd
  INTEGER X0guard_mask
  INTEGER X1EG_mask
  INTEGER X1EQ_mask
  INTEGER X1EV_mask
  INTEGER X1StCmCrd
  INTEGER X1StCrd
  INTEGER X1guard_mask
  INTEGER*4 EG_mask (X0EG_mask,X1EG_mask)
  integer, parameter :: cctki_use_EG_mask = kind(EG_mask)
  INTEGER*4 EQ_mask (X0EQ_mask,X1EQ_mask)
  integer, parameter :: cctki_use_EQ_mask = kind(EQ_mask)
  INTEGER*4 EV_mask (X0EV_mask,X1EV_mask)
  integer, parameter :: cctki_use_EV_mask = kind(EV_mask)
  INTEGER*4 guard_mask (X0guard_mask,X1guard_mask)
  integer, parameter :: cctki_use_guard_mask = kind(guard_mask)
  REAL*8 null_delta (X0NullGrParArrR)
  integer, parameter :: cctki_use_null_delta = kind(null_delta)
  REAL*8 null_dx
  integer, parameter :: cctki_use_null_dx = kind(null_dx)
  INTEGER*4 null_gsh (X0NullGrParArrI)
  integer, parameter :: cctki_use_null_gsh = kind(null_gsh)
  INTEGER*4 null_lbnd (X0NullGrParArrI)
  integer, parameter :: cctki_use_null_lbnd = kind(null_lbnd)
  INTEGER*4 null_lsh (X0NullGrParArrI)
  integer, parameter :: cctki_use_null_lsh = kind(null_lsh)
  REAL*8 null_rb (X0RadCrd)
  integer, parameter :: cctki_use_null_rb = kind(null_rb)
  REAL*8 null_rbh (X0RadCrd)
  integer, parameter :: cctki_use_null_rbh = kind(null_rbh)
  INTEGER*4 null_ubnd (X0NullGrParArrI)
  integer, parameter :: cctki_use_null_ubnd = kind(null_ubnd)
  REAL*8 null_xb (X0RadCrd)
  integer, parameter :: cctki_use_null_xb = kind(null_xb)
  REAL*8 null_xbh (X0RadCrd)
  integer, parameter :: cctki_use_null_xbh = kind(null_xbh)
  REAL*8 qsize
  integer, parameter :: cctki_use_qsize = kind(qsize)
  REAL*8 stereo_p (X0StCrd,X1StCrd)
  integer, parameter :: cctki_use_stereo_p = kind(stereo_p)
  REAL*8 stereo_pp (X0StCrd,X1StCrd)
  integer, parameter :: cctki_use_stereo_pp = kind(stereo_pp)
  REAL*8 stereo_q (X0StCrd,X1StCrd)
  integer, parameter :: cctki_use_stereo_q = kind(stereo_q)
  COMPLEX*16 zeta (X0StCmCrd,X1StCmCrd)
  integer, parameter :: cctki_use_zeta = kind(zeta)


    INTEGER*4 l_max
  integer, parameter :: cctki_use_l_max = kind(l_max)
  COMMON /NullDecomprest/l_max
  INTEGER*4 store_ylms
  integer, parameter :: cctki_use_store_ylms = kind(store_ylms)
  INTEGER*4 use_rsYlm
  integer, parameter :: cctki_use_use_rsYlm = kind(use_rsYlm)
  COMMON /NullDecomppriv/store_ylms, use_rsYlm
  REAL*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  REAL*8 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH31
  integer, parameter :: cctki_use_CCTKH31 = kind(CCTKH31)
  REAL*8 CCTKH33
  integer, parameter :: cctki_use_CCTKH33 = kind(CCTKH33)
  REAL*8 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  REAL*8 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  REAL*8 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  REAL*8 CCTKH41
  integer, parameter :: cctki_use_CCTKH41 = kind(CCTKH41)
  REAL*8 CCTKH43
  integer, parameter :: cctki_use_CCTKH43 = kind(CCTKH43)
  REAL*8 CCTKH45
  integer, parameter :: cctki_use_CCTKH45 = kind(CCTKH45)
  integer*8 CCTKH2
  integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
  integer*8 CCTKH3
  integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  integer*8 out_dir
  integer, parameter :: cctki_use_out_dir = kind(out_dir)
  integer*8 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  integer*8 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  integer*8 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  integer*8 CCTKH47
  integer, parameter :: cctki_use_CCTKH47 = kind(CCTKH47)
  integer*8 CCTKH49
  integer, parameter :: cctki_use_CCTKH49 = kind(CCTKH49)
  integer*8 CCTKH51
  integer, parameter :: cctki_use_CCTKH51 = kind(CCTKH51)
  integer*8 CCTKH53
  integer, parameter :: cctki_use_CCTKH53 = kind(CCTKH53)
  integer*8 CCTKH54
  integer, parameter :: cctki_use_CCTKH54 = kind(CCTKH54)
  integer*8 CCTKH57
  integer, parameter :: cctki_use_CCTKH57 = kind(CCTKH57)
  INTEGER*4 CCTKH0
  integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
  INTEGER*4 CCTKH1
  integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
  INTEGER*4 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  INTEGER*4 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  INTEGER*4 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  INTEGER*4 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  INTEGER*4 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  INTEGER*4 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  INTEGER*4 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  INTEGER*4 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  INTEGER*4 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  INTEGER*4 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  INTEGER*4 CCTKH32
  integer, parameter :: cctki_use_CCTKH32 = kind(CCTKH32)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH40
  integer, parameter :: cctki_use_CCTKH40 = kind(CCTKH40)
  INTEGER*4 CCTKH42
  integer, parameter :: cctki_use_CCTKH42 = kind(CCTKH42)
  INTEGER*4 CCTKH44
  integer, parameter :: cctki_use_CCTKH44 = kind(CCTKH44)
  INTEGER*4 CCTKH46
  integer, parameter :: cctki_use_CCTKH46 = kind(CCTKH46)
  INTEGER*4 CCTKH48
  integer, parameter :: cctki_use_CCTKH48 = kind(CCTKH48)
  INTEGER*4 CCTKH50
  integer, parameter :: cctki_use_CCTKH50 = kind(CCTKH50)
  INTEGER*4 CCTKH52
  integer, parameter :: cctki_use_CCTKH52 = kind(CCTKH52)
  INTEGER*4 CCTKH55
  integer, parameter :: cctki_use_CCTKH55 = kind(CCTKH55)
  INTEGER*4 CCTKH56
  integer, parameter :: cctki_use_CCTKH56 = kind(CCTKH56)
  COMMON /IOrest/CCTKH5, CCTKH19, CCTKH29, CCTKH31, CCTKH33, CCTKH35, CCTKH37, CCTKH39, CCTKH41, CCTKH43, CCTKH45, CCTKH2, CCTKH3, &
  &CCTKH6, CCTKH9, CCTKH10, CCTKH11, CCTKH15, out_dir, CCTKH21, CCTKH22, CCTKH23, CCTKH25, CCTKH47, CCTKH49, CCTKH51, CCTKH53, CCTK&
  &H54, CCTKH57, CCTKH0, CCTKH1, CCTKH4, CCTKH7, CCTKH8, CCTKH12, CCTKH13, CCTKH14, CCTKH16, CCTKH17, CCTKH18, CCTKH20, CCTKH24, CC&
  &TKH26, CCTKH27, CCTKH28, CCTKH30, CCTKH32, CCTKH34, CCTKH36, CCTKH38, CCTKH40, CCTKH42, CCTKH44, CCTKH46, CCTKH48, CCTKH50, CCTK&
  &H52, CCTKH55, CCTKH56
  REAL*8 CCTKH59
  integer, parameter :: cctki_use_CCTKH59 = kind(CCTKH59)
  REAL*8 CCTKH60
  integer, parameter :: cctki_use_CCTKH60 = kind(CCTKH60)
  INTEGER*4 N_ang_ev_outside_eq
  integer, parameter :: cctki_use_N_ang_ev_outside_eq = kind(N_ang_ev_outside_eq)
  INTEGER*4 N_ang_ghost_pts
  integer, parameter :: cctki_use_N_ang_ghost_pts = kind(N_ang_ghost_pts)
  INTEGER*4 N_ang_pts_inside_eq
  integer, parameter :: cctki_use_N_ang_pts_inside_eq = kind(N_ang_pts_inside_eq)
  INTEGER*4 N_ang_stencil_size
  integer, parameter :: cctki_use_N_ang_stencil_size = kind(N_ang_stencil_size)
  INTEGER*4 CCTKH58
  integer, parameter :: cctki_use_CCTKH58 = kind(CCTKH58)
  INTEGER*4 CCTKH61
  integer, parameter :: cctki_use_CCTKH61 = kind(CCTKH61)
  COMMON /NULLGRIDrest/CCTKH59, CCTKH60, N_ang_ev_outside_eq, N_ang_ghost_pts, N_ang_pts_inside_eq, N_ang_stencil_size, CCTKH58, CC&
  &TKH61

    MyProc = CCTK_MyProc( cctkGH )
    NumProcs = CCTK_nProcs( cctkGH )

    lmax = l_max

    call CCTK_ReductionArrayHandle(min_handle, "minimum")
    call CCTK_ReductionArrayHandle(max_handle, "maximum")
    call CCTK_ReductionArrayHandle(sum_handle, "sum")

    if (min_handle .lt. 0 .OR. max_handle .lt. 0.OR.sum_handle.lt.0) then
      call CCTK_Warn(0,33,"Startup.F90","NullDecomp", "Could not get reduction hadles")
    endif

  
    kern(:,:,1) = 4.0d0 / (1.0d0 + zeta*conjg(zeta))**2
    kern(:,:,2) = 4.0d0 / (1.0d0 + zeta*conjg(zeta))**2

    if (null_lbnd(1) .eq. 0) then
      lq = 1
    else
      lq = 1+N_ang_ghost_pts
    endif

    if (null_lbnd(2) .eq. 0) then
      lp = 1
    else
      lp = 1+N_ang_ghost_pts
    endif

    if (null_ubnd(1) .eq. null_gsh(1) - 1) then
      uq = null_lsh(1)
    else
      uq = null_lsh(1) - N_ang_ghost_pts + 1
    endif

    if (null_ubnd(2) .eq. null_gsh(2) - 1) then
      up = null_lsh(2)
    else
      up = null_lsh(2) - N_ang_ghost_pts + 1
    endif

    call wt_intarea(null_lsh(1), null_lsh(2), dble(zeta(:,1)), dimag(zeta(1,:)), area)

    area_p => area
    kern_p => kern

contains

subroutine wt_intarea(nq, np, q, p, area)

  implicit none
  INTEGER*4,          intent (in)  :: nq, np
  REAL*8, intent (out) :: area(nq,np)
  REAL*8, dimension(nq), intent (in) :: q
  REAL*8, dimension(np), intent (in) :: p

  INTEGER*4 ::  i, j
  REAL*8 :: dq, dp

  REAL*8 :: qp, qm, pp, pm
  REAL*8 :: rpp, rpm, rmp, rmm
  REAL*8 :: topd, bottomd, leftd, rightd



  dq = q(2) - q(1)   
  dp = p(2) - p(1)   

  area = 0.

  do j = 1, np-1
    do i = 1, nq-1
      qp = q(i+1)
      qm = q(i)
      pp = p(j+1)
      pm = p(j)

      

    
      rpp = (qp*qp + pp*pp) - 1.0d0
      rpm = (qp*qp + pm*pm) - 1.0d0
      rmp = (qm*qm + pp*pp) - 1.0d0
      rmm = (qm*qm + pm*pm) - 1.0d0

      
      if (abs(rpp) .lt. 1.0d-16) rpp = -1.0d-16
      if (abs(rpm) .lt. 1.0d-16) rpm = -1.0d-16
      if (abs(rmp) .lt. 1.0d-16) rmp = -1.0d-16
      if (abs(rmm) .lt. 1.0d-16) rmm = -1.0d-16

      if (rpp < 0.0 .AND. rpm < 0.0 .AND. rmp < 0.0 .AND. rmm < 0.0) then
        
        area(i,j) = dq*dp
      else if(rpp > 0.0 .AND. rpm > 0.0 .AND. rmp > 0.0 .AND. rmm > 0.0) then
         
         
        area(i,j) = 0
      else
        
        

        topd = 0
        bottomd=0
        leftd = 0
        rightd = 0
 
        if (rmp*rpp < 0.0) then 
          
          
          
          topd = abs(abs(qm) - dsqrt(1.0-pp*pp))/dq + 1.0d-30
        endif
        if (rmm*rpm < 0.0) then 
          
          bottomd = abs(abs(qm) - dsqrt(1.0-pm*pm))/dq + 1.0d-30
        endif
        if (rmm*rmp < 0.0) then 
          
          leftd = abs(abs(pm) - dsqrt(1.0-qm*qm))/dp + 1.0d-30
        endif
        if (rpm*rpp < 0.0) then 
          
          rightd = abs(abs(pm) - dsqrt(1.0-qp*qp))/dp + 1.0d-30
        endif

        if (bottomd .ne. 0 .AND. topd .ne. 0) then
          if (rmp < 0.0) then
            area(i,j) = dp*dq*topd -.5 * dp *dq* (topd - bottomd)
          else 
            area(i,j) = dp*dq*(1.-topd) +.5 * dp * dq* (topd - bottomd)
          endif
        else if(leftd .ne. 0 .AND. rightd .ne. 0) then
          if (rmm < 0.0) then
            area(i,j) = dq*dp*rightd -.5 * dq *dp* (rightd - leftd)
          else 
            area(i,j) = dq*dp*(1.0-rightd) +.5 * dq * dp* (rightd - leftd)
          endif
        else if(topd .ne. 0 .AND. leftd .ne. 0) then
          if (rmp < 0.0) then
            area(i,j) = .5*topd*dq*dp*(1.0 - leftd)
          else
            area(i,j) = dq*dp - .5*topd*dq*dp*(1.0 - leftd)
          endif
        else if(topd .ne. 0 .AND. rightd .ne. 0) then
          if (rpp < 0.0) then
            area(i,j) = .5*dq*(1.0-topd)*dp*(1.0 - rightd)
          else
            area(i,j) = dq*dp - .5*dq*(1.0-topd)*dp*(1.0 - rightd)
          endif
        else if(bottomd .ne. 0 .AND. leftd .ne. 0) then
          if (rmm < 0.0 ) then
            area(i,j) = .5*bottomd*leftd *dq*dp
          else
            area(i,j) = dq*dp - .5*bottomd*leftd*dq*dp
          endif
        else if (bottomd .ne. 0 .AND. rightd .ne. 0) then
          if (rpm < 0.0) then
            area(i,j) = .5*dq*(1.0 - bottomd)*dp*rightd
          else
            area(i,j) = dq*dp - .5*dq*(1.0 - bottomd)*dp*rightd
          endif
         else
            call CCTK_Warn(0,186,"Startup.F90","NullDecomp","something went horribly wrong")
        endif
      endif
    end do 
  end do 

end subroutine wt_intarea


end subroutine NullDecomp_Startup


