














































c











































































 


































































































































































 






























































































































































































 



















































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                



















































































c


      SUBROUTINE Extract(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,
     &cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alignment,cctk_alignment
     &_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk
     &_delta_space,cctk_origin_space,cctk_levfac,cctk_levoff,cctk_levoff
     &denom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cc
     &tk_iteration,cctkGH,cctk_ash1,cctk_ash2,cctk_ash3, g00,temp3d, SHR
     &E_alpha_e_length,SHRE_beta_e_length,SHRE_dalpha_e_length,SHRE_dbet
     &a_e_length,SHRE_dgij_e_length,SHRE_dgit_e_length,SHRE_gij_e_length
     &,SHRE_git_e_length,WT_r0_length,X0SHRE_alpha_e,X0SHRE_beta_e,X0SHR
     &E_dalpha_e,X0SHRE_dbeta_e,X0SHRE_dgij_e,X0SHRE_dgit_e,X0SHRE_gij_e
     &,X0SHRE_git_e,X0WT_r0,X0beta_l,X0beta_wt,X0j_l,X0j_wt,X0q_wt,X0u_l
     &,X0u_wt,X0u_x_wt,X0w_l,X0w_wt,X0x_wt,X1SHRE_alpha_e,X1SHRE_beta_e,
     &X1SHRE_dalpha_e,X1SHRE_dbeta_e,X1SHRE_dgij_e,X1SHRE_dgit_e,X1SHRE_
     &gij_e,X1SHRE_git_e,X1WT_r0,X1beta_l,X1beta_wt,X1j_l,X1j_wt,X1q_wt,
     &X1u_l,X1u_wt,X1u_x_wt,X1w_l,X1w_wt,X1x_wt,beta_l_length,beta_wt_le
     &ngth,j_l_length,j_wt_length,q_wt_length,u_l_length,u_wt_length,u_x
     &_wt_length,w_l_length,w_wt_length,x_wt_length,SHRE_alpha_e,SHRE_be
     &ta_e,SHRE_dpalpha_e,SHRE_dpbeta_e,SHRE_dpgij_e,SHRE_dpgit_e,SHRE_d
     &qalpha_e,SHRE_dqbeta_e,SHRE_dqgij_e,SHRE_dqgit_e,SHRE_dralpha_e,SH
     &RE_drbeta_e,SHRE_drgij_e,SHRE_drgit_e,SHRE_dtalpha_e,SHRE_dtbeta_e
     &,SHRE_dtgij_e,SHRE_dtgit_e,SHRE_gij_e,SHRE_git_e,WT_r0,beta_l,beta
     &_wt,beta_wt_p,j_l,j_wt,j_wt_p,q_wt,q_wt_p,u_l,u_wt,u_wt_p,u_x_wt,w
     &_l,w_wt,w_wt_p,x_wt,x_wt_p, alp,alp_p,alp_p_p,betax,betax_p,betax_
     &p_p,betay,betay_p,betay_p_p,betaz,betaz_p,betaz_p_p,coarse_dx,coar
     &se_dy,coarse_dz,conformal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dt
     &betax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_
     &p,dtbetaz_p_p,dtlapse_state,dtshift_state,gxx,gxx_p,gxx_p_p,gxy,gx
     &y_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,
     &gzz,gzz_p,gzz_p_p,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kx
     &z_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi,ps
     &ix,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,x,y
     &,z)

      USE D3_extract_int

      IMPLICIT NONE


      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_alignme
     &nt)
      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_orig
     &in_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_levof
     &fdenom)
      INTEGER cctk_timefac
      integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
      INTEGER cctk_convlevel
      integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlev
     &el)
      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_nghos
     &tzones)
      INTEGER cctk_iteration
      integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iterati
     &on)
      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)
      REAL*8 g00 (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_g00 = kind(g00)
      REAL*8 temp3d (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_temp3d = kind(temp3d)
      INTEGER SHRE_alpha_e_length
      INTEGER SHRE_beta_e_length
      INTEGER SHRE_dalpha_e_length
      INTEGER SHRE_dbeta_e_length
      INTEGER SHRE_dgij_e_length
      INTEGER SHRE_dgit_e_length
      INTEGER SHRE_gij_e_length
      INTEGER SHRE_git_e_length
      INTEGER WT_r0_length
      INTEGER X0SHRE_alpha_e
      INTEGER X0SHRE_beta_e
      INTEGER X0SHRE_dalpha_e
      INTEGER X0SHRE_dbeta_e
      INTEGER X0SHRE_dgij_e
      INTEGER X0SHRE_dgit_e
      INTEGER X0SHRE_gij_e
      INTEGER X0SHRE_git_e
      INTEGER X0WT_r0
      INTEGER X0beta_l
      INTEGER X0beta_wt
      INTEGER X0j_l
      INTEGER X0j_wt
      INTEGER X0q_wt
      INTEGER X0u_l
      INTEGER X0u_wt
      INTEGER X0u_x_wt
      INTEGER X0w_l
      INTEGER X0w_wt
      INTEGER X0x_wt
      INTEGER X1SHRE_alpha_e
      INTEGER X1SHRE_beta_e
      INTEGER X1SHRE_dalpha_e
      INTEGER X1SHRE_dbeta_e
      INTEGER X1SHRE_dgij_e
      INTEGER X1SHRE_dgit_e
      INTEGER X1SHRE_gij_e
      INTEGER X1SHRE_git_e
      INTEGER X1WT_r0
      INTEGER X1beta_l
      INTEGER X1beta_wt
      INTEGER X1j_l
      INTEGER X1j_wt
      INTEGER X1q_wt
      INTEGER X1u_l
      INTEGER X1u_wt
      INTEGER X1u_x_wt
      INTEGER X1w_l
      INTEGER X1w_wt
      INTEGER X1x_wt
      INTEGER beta_l_length
      INTEGER beta_wt_length
      INTEGER j_l_length
      INTEGER j_wt_length
      INTEGER q_wt_length
      INTEGER u_l_length
      INTEGER u_wt_length
      INTEGER u_x_wt_length
      INTEGER w_l_length
      INTEGER w_wt_length
      INTEGER x_wt_length
      REAL*8 SHRE_alpha_e (X0SHRE_alpha_e,X1SHRE_alpha_e,SHRE_alpha_e_le
     &ngth)
      integer, parameter :: cctki_use_SHRE_alpha_e = kind(SHRE_alpha_e)
      REAL*8 SHRE_beta_e (X0SHRE_beta_e,X1SHRE_beta_e,SHRE_beta_e_length
     &)
      integer, parameter :: cctki_use_SHRE_beta_e = kind(SHRE_beta_e)
      REAL*8 SHRE_dpalpha_e (X0SHRE_dalpha_e,X1SHRE_dalpha_e,SHRE_dalpha
     &_e_length)
      integer, parameter :: cctki_use_SHRE_dpalpha_e = kind(SHRE_dpalpha
     &_e)
      REAL*8 SHRE_dpbeta_e (X0SHRE_dbeta_e,X1SHRE_dbeta_e,SHRE_dbeta_e_l
     &ength)
      integer, parameter :: cctki_use_SHRE_dpbeta_e = kind(SHRE_dpbeta_e
     &)
      REAL*8 SHRE_dpgij_e (X0SHRE_dgij_e,X1SHRE_dgij_e,SHRE_dgij_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dpgij_e = kind(SHRE_dpgij_e)
      REAL*8 SHRE_dpgit_e (X0SHRE_dgit_e,X1SHRE_dgit_e,SHRE_dgit_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dpgit_e = kind(SHRE_dpgit_e)
      REAL*8 SHRE_dqalpha_e (X0SHRE_dalpha_e,X1SHRE_dalpha_e,SHRE_dalpha
     &_e_length)
      integer, parameter :: cctki_use_SHRE_dqalpha_e = kind(SHRE_dqalpha
     &_e)
      REAL*8 SHRE_dqbeta_e (X0SHRE_dbeta_e,X1SHRE_dbeta_e,SHRE_dbeta_e_l
     &ength)
      integer, parameter :: cctki_use_SHRE_dqbeta_e = kind(SHRE_dqbeta_e
     &)
      REAL*8 SHRE_dqgij_e (X0SHRE_dgij_e,X1SHRE_dgij_e,SHRE_dgij_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dqgij_e = kind(SHRE_dqgij_e)
      REAL*8 SHRE_dqgit_e (X0SHRE_dgit_e,X1SHRE_dgit_e,SHRE_dgit_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dqgit_e = kind(SHRE_dqgit_e)
      REAL*8 SHRE_dralpha_e (X0SHRE_dalpha_e,X1SHRE_dalpha_e,SHRE_dalpha
     &_e_length)
      integer, parameter :: cctki_use_SHRE_dralpha_e = kind(SHRE_dralpha
     &_e)
      REAL*8 SHRE_drbeta_e (X0SHRE_dbeta_e,X1SHRE_dbeta_e,SHRE_dbeta_e_l
     &ength)
      integer, parameter :: cctki_use_SHRE_drbeta_e = kind(SHRE_drbeta_e
     &)
      REAL*8 SHRE_drgij_e (X0SHRE_dgij_e,X1SHRE_dgij_e,SHRE_dgij_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_drgij_e = kind(SHRE_drgij_e)
      REAL*8 SHRE_drgit_e (X0SHRE_dgit_e,X1SHRE_dgit_e,SHRE_dgit_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_drgit_e = kind(SHRE_drgit_e)
      REAL*8 SHRE_dtalpha_e (X0SHRE_dalpha_e,X1SHRE_dalpha_e,SHRE_dalpha
     &_e_length)
      integer, parameter :: cctki_use_SHRE_dtalpha_e = kind(SHRE_dtalpha
     &_e)
      REAL*8 SHRE_dtbeta_e (X0SHRE_dbeta_e,X1SHRE_dbeta_e,SHRE_dbeta_e_l
     &ength)
      integer, parameter :: cctki_use_SHRE_dtbeta_e = kind(SHRE_dtbeta_e
     &)
      REAL*8 SHRE_dtgij_e (X0SHRE_dgij_e,X1SHRE_dgij_e,SHRE_dgij_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dtgij_e = kind(SHRE_dtgij_e)
      REAL*8 SHRE_dtgit_e (X0SHRE_dgit_e,X1SHRE_dgit_e,SHRE_dgit_e_lengt
     &h)
      integer, parameter :: cctki_use_SHRE_dtgit_e = kind(SHRE_dtgit_e)
      REAL*8 SHRE_gij_e (X0SHRE_gij_e,X1SHRE_gij_e,SHRE_gij_e_length)
      integer, parameter :: cctki_use_SHRE_gij_e = kind(SHRE_gij_e)
      REAL*8 SHRE_git_e (X0SHRE_git_e,X1SHRE_git_e,SHRE_git_e_length)
      integer, parameter :: cctki_use_SHRE_git_e = kind(SHRE_git_e)
      REAL*8 WT_r0 (X0WT_r0,X1WT_r0,WT_r0_length)
      integer, parameter :: cctki_use_WT_r0 = kind(WT_r0)
      REAL*8 beta_l (X0beta_l,X1beta_l,beta_l_length)
      integer, parameter :: cctki_use_beta_l = kind(beta_l)
      REAL*8 beta_wt (X0beta_wt,X1beta_wt,beta_wt_length)
      integer, parameter :: cctki_use_beta_wt = kind(beta_wt)
      REAL*8 beta_wt_p (X0beta_wt,X1beta_wt,beta_wt_length)
      integer, parameter :: cctki_use_beta_wt_p = kind(beta_wt_p)
      COMPLEX*16 j_l (X0j_l,X1j_l,j_l_length)
      integer, parameter :: cctki_use_j_l = kind(j_l)
      COMPLEX*16 j_wt (X0j_wt,X1j_wt,j_wt_length)
      integer, parameter :: cctki_use_j_wt = kind(j_wt)
      COMPLEX*16 j_wt_p (X0j_wt,X1j_wt,j_wt_length)
      integer, parameter :: cctki_use_j_wt_p = kind(j_wt_p)
      COMPLEX*16 q_wt (X0q_wt,X1q_wt,q_wt_length)
      integer, parameter :: cctki_use_q_wt = kind(q_wt)
      COMPLEX*16 q_wt_p (X0q_wt,X1q_wt,q_wt_length)
      integer, parameter :: cctki_use_q_wt_p = kind(q_wt_p)
      COMPLEX*16 u_l (X0u_l,X1u_l,u_l_length)
      integer, parameter :: cctki_use_u_l = kind(u_l)
      COMPLEX*16 u_wt (X0u_wt,X1u_wt,u_wt_length)
      integer, parameter :: cctki_use_u_wt = kind(u_wt)
      COMPLEX*16 u_wt_p (X0u_wt,X1u_wt,u_wt_length)
      integer, parameter :: cctki_use_u_wt_p = kind(u_wt_p)
      COMPLEX*16 u_x_wt (X0u_x_wt,X1u_x_wt,u_x_wt_length)
      integer, parameter :: cctki_use_u_x_wt = kind(u_x_wt)
      REAL*8 w_l (X0w_l,X1w_l,w_l_length)
      integer, parameter :: cctki_use_w_l = kind(w_l)
      REAL*8 w_wt (X0w_wt,X1w_wt,w_wt_length)
      integer, parameter :: cctki_use_w_wt = kind(w_wt)
      REAL*8 w_wt_p (X0w_wt,X1w_wt,w_wt_length)
      integer, parameter :: cctki_use_w_wt_p = kind(w_wt_p)
      REAL*8 x_wt (X0x_wt,X1x_wt,x_wt_length)
      integer, parameter :: cctki_use_x_wt = kind(x_wt)
      REAL*8 x_wt_p (X0x_wt,X1x_wt,x_wt_length)
      integer, parameter :: cctki_use_x_wt_p = kind(x_wt_p)
      REAL*8 alp (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_alp = kind(alp)
      REAL*8 alp_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_alp_p = kind(alp_p)
      REAL*8 alp_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_alp_p_p = kind(alp_p_p)
      REAL*8 betax (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betax = kind(betax)
      REAL*8 betax_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betax_p = kind(betax_p)
      REAL*8 betax_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betax_p_p = kind(betax_p_p)
      REAL*8 betay (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betay = kind(betay)
      REAL*8 betay_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betay_p = kind(betay_p)
      REAL*8 betay_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betay_p_p = kind(betay_p_p)
      REAL*8 betaz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betaz = kind(betaz)
      REAL*8 betaz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betaz_p = kind(betaz_p)
      REAL*8 betaz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_betaz_p_p = kind(betaz_p_p)
      REAL*8 coarse_dx
      integer, parameter :: cctki_use_coarse_dx = kind(coarse_dx)
      REAL*8 coarse_dy
      integer, parameter :: cctki_use_coarse_dy = kind(coarse_dy)
      REAL*8 coarse_dz
      integer, parameter :: cctki_use_coarse_dz = kind(coarse_dz)
      INTEGER*4 conformal_state
      integer, parameter :: cctki_use_conformal_state = kind(conformal_s
     &tate)
      REAL*8 dtalp (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtalp = kind(dtalp)
      REAL*8 dtalp_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtalp_p = kind(dtalp_p)
      REAL*8 dtalp_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtalp_p_p = kind(dtalp_p_p)
      REAL*8 dtbetax (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetax = kind(dtbetax)
      REAL*8 dtbetax_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetax_p = kind(dtbetax_p)
      REAL*8 dtbetax_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetax_p_p = kind(dtbetax_p_p)
      REAL*8 dtbetay (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetay = kind(dtbetay)
      REAL*8 dtbetay_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetay_p = kind(dtbetay_p)
      REAL*8 dtbetay_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetay_p_p = kind(dtbetay_p_p)
      REAL*8 dtbetaz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetaz = kind(dtbetaz)
      REAL*8 dtbetaz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetaz_p = kind(dtbetaz_p)
      REAL*8 dtbetaz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_dtbetaz_p_p = kind(dtbetaz_p_p)
      INTEGER*4 dtlapse_state
      integer, parameter :: cctki_use_dtlapse_state = kind(dtlapse_state
     &)
      INTEGER*4 dtshift_state
      integer, parameter :: cctki_use_dtshift_state = kind(dtshift_state
     &)
      REAL*8 gxx (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxx = kind(gxx)
      REAL*8 gxx_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxx_p = kind(gxx_p)
      REAL*8 gxx_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxx_p_p = kind(gxx_p_p)
      REAL*8 gxy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxy = kind(gxy)
      REAL*8 gxy_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxy_p = kind(gxy_p)
      REAL*8 gxy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxy_p_p = kind(gxy_p_p)
      REAL*8 gxz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxz = kind(gxz)
      REAL*8 gxz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxz_p = kind(gxz_p)
      REAL*8 gxz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gxz_p_p = kind(gxz_p_p)
      REAL*8 gyy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyy = kind(gyy)
      REAL*8 gyy_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyy_p = kind(gyy_p)
      REAL*8 gyy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyy_p_p = kind(gyy_p_p)
      REAL*8 gyz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyz = kind(gyz)
      REAL*8 gyz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyz_p = kind(gyz_p)
      REAL*8 gyz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gyz_p_p = kind(gyz_p_p)
      REAL*8 gzz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gzz = kind(gzz)
      REAL*8 gzz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gzz_p = kind(gzz_p)
      REAL*8 gzz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_gzz_p_p = kind(gzz_p_p)
      REAL*8 kxx (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxx = kind(kxx)
      REAL*8 kxx_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxx_p = kind(kxx_p)
      REAL*8 kxx_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxx_p_p = kind(kxx_p_p)
      REAL*8 kxy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxy = kind(kxy)
      REAL*8 kxy_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxy_p = kind(kxy_p)
      REAL*8 kxy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxy_p_p = kind(kxy_p_p)
      REAL*8 kxz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxz = kind(kxz)
      REAL*8 kxz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxz_p = kind(kxz_p)
      REAL*8 kxz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kxz_p_p = kind(kxz_p_p)
      REAL*8 kyy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyy = kind(kyy)
      REAL*8 kyy_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyy_p = kind(kyy_p)
      REAL*8 kyy_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyy_p_p = kind(kyy_p_p)
      REAL*8 kyz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyz = kind(kyz)
      REAL*8 kyz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyz_p = kind(kyz_p)
      REAL*8 kyz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kyz_p_p = kind(kyz_p_p)
      REAL*8 kzz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kzz = kind(kzz)
      REAL*8 kzz_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kzz_p = kind(kzz_p)
      REAL*8 kzz_p_p (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_kzz_p_p = kind(kzz_p_p)
      REAL*8 psi (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psi = kind(psi)
      REAL*8 psix (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psix = kind(psix)
      REAL*8 psixx (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psixx = kind(psixx)
      REAL*8 psixy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psixy = kind(psixy)
      REAL*8 psixz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psixz = kind(psixz)
      REAL*8 psiy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psiy = kind(psiy)
      REAL*8 psiyy (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psiyy = kind(psiyy)
      REAL*8 psiyz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psiyz = kind(psiyz)
      REAL*8 psiz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psiz = kind(psiz)
      REAL*8 psizz (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_psizz = kind(psizz)
      REAL*8 r (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_r = kind(r)
      INTEGER*4 shift_state
      integer, parameter :: cctki_use_shift_state = kind(shift_state)
      REAL*8 x (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_x = kind(x)
      REAL*8 y (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_y = kind(y)
      REAL*8 z (cctk_ash1,cctk_ash2,cctk_ash3)
      integer, parameter :: cctki_use_z = kind(z)
      REAL*8 Cauchy_dr
      integer, parameter :: cctki_use_Cauchy_dr = kind(Cauchy_dr)
      REAL*8 Cauchy_r1
      integer, parameter :: cctki_use_Cauchy_r1 = kind(Cauchy_r1)
      REAL*8 detector1
      integer, parameter :: cctki_use_detector1 = kind(detector1)
      REAL*8 detector2
      integer, parameter :: cctki_use_detector2 = kind(detector2)
      REAL*8 detector3
      integer, parameter :: cctki_use_detector3 = kind(detector3)
      REAL*8 detector4
      integer, parameter :: cctki_use_detector4 = kind(detector4)
      REAL*8 detector5
      integer, parameter :: cctki_use_detector5 = kind(detector5)
      REAL*8 detector6
      integer, parameter :: cctki_use_detector6 = kind(detector6)
      REAL*8 detector7
      integer, parameter :: cctki_use_detector7 = kind(detector7)
      REAL*8 detector8
      integer, parameter :: cctki_use_detector8 = kind(detector8)
      REAL*8 detector9
      integer, parameter :: cctki_use_detector9 = kind(detector9)
      REAL*8 origin_x
      integer, parameter :: cctki_use_origin_x = kind(origin_x)
      REAL*8 origin_y
      integer, parameter :: cctki_use_origin_y = kind(origin_y)
      REAL*8 origin_z
      integer, parameter :: cctki_use_origin_z = kind(origin_z)
      integer*8 interpolation_operator
      integer, parameter :: cctki_use_interpolation_operator = kind(inte
     &rpolation_operator)
      integer*8 timecoord
      integer, parameter :: cctki_use_timecoord = kind(timecoord)
      INTEGER*4 Cauchy
      integer, parameter :: cctki_use_Cauchy = kind(Cauchy)
      INTEGER*4 Cauchy_timestep
      integer, parameter :: cctki_use_Cauchy_timestep = kind(Cauchy_time
     &step)
      INTEGER*4 Np
      integer, parameter :: cctki_use_Np = kind(Np)
      INTEGER*4 Nt
      integer, parameter :: cctki_use_Nt = kind(Nt)
      INTEGER*4 all_modes
      integer, parameter :: cctki_use_all_modes = kind(all_modes)
      INTEGER*4 doADMmass
      integer, parameter :: cctki_use_doADMmass = kind(doADMmass)
      INTEGER*4 do_momentum
      integer, parameter :: cctki_use_do_momentum = kind(do_momentum)
      INTEGER*4 do_spin
      integer, parameter :: cctki_use_do_spin = kind(do_spin)
      INTEGER*4 interpolation_order
      integer, parameter :: cctki_use_interpolation_order = kind(interpo
     &lation_order)
      INTEGER*4 itout
      integer, parameter :: cctki_use_itout = kind(itout)
      INTEGER*4 l_mode
      integer, parameter :: cctki_use_l_mode = kind(l_mode)
      INTEGER*4 m_mode
      integer, parameter :: cctki_use_m_mode = kind(m_mode)
      INTEGER*4 num_detectors
      integer, parameter :: cctki_use_num_detectors = kind(num_detectors
     &)
      INTEGER*4 verbose
      integer, parameter :: cctki_use_verbose = kind(verbose)
      COMMON /Extractpriv/Cauchy_dr, Cauchy_r1, detector1, detector2, de
     &tector3, detector4, detector5, detector6, detector7, detector8, de
     &tector9, origin_x, origin_y, origin_z, interpolation_operator, tim
     &ecoord, Cauchy, Cauchy_timestep, Np, Nt, all_modes, doADMmass, do_
     &momentum, do_spin, interpolation_order, itout, l_mode, m_mode, num
     &_detectors, verbose
      integer*8 CCTKH0
      integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
      integer*8 CCTKH1
      integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
      integer*8 CCTKH2
      integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
      integer*8 CCTKH3
      integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
      integer*8 CCTKH4
      integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
      integer*8 CCTKH5
      integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
      integer*8 CCTKH6
      integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
      integer*8 CCTKH7
      integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
      integer*8 CCTKH8
      integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
      integer*8 CCTKH9
      integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
      integer*8 CCTKH10
      integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
      integer*8 CCTKH12
      integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
      integer*8 metric_type
      integer, parameter :: cctki_use_metric_type = kind(metric_type)
      integer*8 CCTKH14
      integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
      integer*8 CCTKH15
      integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
      INTEGER*4 CCTKH11
      integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
      INTEGER*4 CCTKH13
      integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
      INTEGER*4 CCTKH16
      integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
      COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, CCTKH4, CCTKH5
     &, CCTKH6, CCTKH7, CCTKH8, CCTKH9, CCTKH10, CCTKH12, metric_type, C
     &CTKH14, CCTKH15, CCTKH11, CCTKH13, CCTKH16
      REAL*8 CCTKH18
      integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
      REAL*8 CCTKH19
      integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
      REAL*8 CCTKH20
      integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
      REAL*8 CCTKH21
      integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
      REAL*8 CCTKH31
      integer, parameter :: cctki_use_CCTKH31 = kind(CCTKH31)
      REAL*8 CCTKH32
      integer, parameter :: cctki_use_CCTKH32 = kind(CCTKH32)
      REAL*8 CCTKH33
      integer, parameter :: cctki_use_CCTKH33 = kind(CCTKH33)
      REAL*8 CCTKH34
      integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
      REAL*8 CCTKH35
      integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
      REAL*8 CCTKH36
      integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
      REAL*8 CCTKH37
      integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
      REAL*8 CCTKH38
      integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
      integer*8 CCTKH17
      integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
      integer*8 domain
      integer, parameter :: cctki_use_domain = kind(domain)
      integer*8 CCTKH22
      integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
      integer*8 CCTKH23
      integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
      integer*8 CCTKH30
      integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
      INTEGER*4 CCTKH24
      integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
      INTEGER*4 CCTKH25
      integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
      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 CCTKH29
      integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
      COMMON /GRIDrest/CCTKH18, CCTKH19, CCTKH20, CCTKH21, CCTKH31, CCTK
     &H32, CCTKH33, CCTKH34, CCTKH35, CCTKH36, CCTKH37, CCTKH38, CCTKH17
     &, domain, CCTKH22, CCTKH23, CCTKH30, CCTKH24, CCTKH25, CCTKH26, CC
     &TKH27, CCTKH28, CCTKH29
      REAL*8 CCTKH44
      integer, parameter :: cctki_use_CCTKH44 = kind(CCTKH44)
      REAL*8 CCTKH58
      integer, parameter :: cctki_use_CCTKH58 = kind(CCTKH58)
      REAL*8 CCTKH68
      integer, parameter :: cctki_use_CCTKH68 = kind(CCTKH68)
      REAL*8 CCTKH70
      integer, parameter :: cctki_use_CCTKH70 = kind(CCTKH70)
      REAL*8 CCTKH72
      integer, parameter :: cctki_use_CCTKH72 = kind(CCTKH72)
      REAL*8 CCTKH74
      integer, parameter :: cctki_use_CCTKH74 = kind(CCTKH74)
      REAL*8 CCTKH76
      integer, parameter :: cctki_use_CCTKH76 = kind(CCTKH76)
      REAL*8 CCTKH78
      integer, parameter :: cctki_use_CCTKH78 = kind(CCTKH78)
      REAL*8 CCTKH80
      integer, parameter :: cctki_use_CCTKH80 = kind(CCTKH80)
      REAL*8 CCTKH82
      integer, parameter :: cctki_use_CCTKH82 = kind(CCTKH82)
      REAL*8 CCTKH84
      integer, parameter :: cctki_use_CCTKH84 = kind(CCTKH84)
      integer*8 CCTKH41
      integer, parameter :: cctki_use_CCTKH41 = kind(CCTKH41)
      integer*8 CCTKH42
      integer, parameter :: cctki_use_CCTKH42 = kind(CCTKH42)
      integer*8 CCTKH45
      integer, parameter :: cctki_use_CCTKH45 = kind(CCTKH45)
      integer*8 CCTKH48
      integer, parameter :: cctki_use_CCTKH48 = kind(CCTKH48)
      integer*8 CCTKH49
      integer, parameter :: cctki_use_CCTKH49 = kind(CCTKH49)
      integer*8 CCTKH50
      integer, parameter :: cctki_use_CCTKH50 = kind(CCTKH50)
      integer*8 CCTKH54
      integer, parameter :: cctki_use_CCTKH54 = kind(CCTKH54)
      integer*8 out_dir
      integer, parameter :: cctki_use_out_dir = kind(out_dir)
      integer*8 CCTKH60
      integer, parameter :: cctki_use_CCTKH60 = kind(CCTKH60)
      integer*8 CCTKH61
      integer, parameter :: cctki_use_CCTKH61 = kind(CCTKH61)
      integer*8 CCTKH62
      integer, parameter :: cctki_use_CCTKH62 = kind(CCTKH62)
      integer*8 CCTKH64
      integer, parameter :: cctki_use_CCTKH64 = kind(CCTKH64)
      integer*8 CCTKH86
      integer, parameter :: cctki_use_CCTKH86 = kind(CCTKH86)
      integer*8 CCTKH88
      integer, parameter :: cctki_use_CCTKH88 = kind(CCTKH88)
      integer*8 CCTKH90
      integer, parameter :: cctki_use_CCTKH90 = kind(CCTKH90)
      integer*8 CCTKH92
      integer, parameter :: cctki_use_CCTKH92 = kind(CCTKH92)
      integer*8 CCTKH93
      integer, parameter :: cctki_use_CCTKH93 = kind(CCTKH93)
      integer*8 CCTKH96
      integer, parameter :: cctki_use_CCTKH96 = kind(CCTKH96)
      INTEGER*4 CCTKH39
      integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
      INTEGER*4 CCTKH40
      integer, parameter :: cctki_use_CCTKH40 = kind(CCTKH40)
      INTEGER*4 CCTKH43
      integer, parameter :: cctki_use_CCTKH43 = kind(CCTKH43)
      INTEGER*4 CCTKH46
      integer, parameter :: cctki_use_CCTKH46 = kind(CCTKH46)
      INTEGER*4 CCTKH47
      integer, parameter :: cctki_use_CCTKH47 = kind(CCTKH47)
      INTEGER*4 CCTKH51
      integer, parameter :: cctki_use_CCTKH51 = kind(CCTKH51)
      INTEGER*4 CCTKH52
      integer, parameter :: cctki_use_CCTKH52 = kind(CCTKH52)
      INTEGER*4 CCTKH53
      integer, parameter :: cctki_use_CCTKH53 = kind(CCTKH53)
      INTEGER*4 CCTKH55
      integer, parameter :: cctki_use_CCTKH55 = kind(CCTKH55)
      INTEGER*4 CCTKH56
      integer, parameter :: cctki_use_CCTKH56 = kind(CCTKH56)
      INTEGER*4 CCTKH57
      integer, parameter :: cctki_use_CCTKH57 = kind(CCTKH57)
      INTEGER*4 CCTKH59
      integer, parameter :: cctki_use_CCTKH59 = kind(CCTKH59)
      INTEGER*4 CCTKH63
      integer, parameter :: cctki_use_CCTKH63 = kind(CCTKH63)
      INTEGER*4 CCTKH65
      integer, parameter :: cctki_use_CCTKH65 = kind(CCTKH65)
      INTEGER*4 CCTKH66
      integer, parameter :: cctki_use_CCTKH66 = kind(CCTKH66)
      INTEGER*4 CCTKH67
      integer, parameter :: cctki_use_CCTKH67 = kind(CCTKH67)
      INTEGER*4 CCTKH69
      integer, parameter :: cctki_use_CCTKH69 = kind(CCTKH69)
      INTEGER*4 CCTKH71
      integer, parameter :: cctki_use_CCTKH71 = kind(CCTKH71)
      INTEGER*4 CCTKH73
      integer, parameter :: cctki_use_CCTKH73 = kind(CCTKH73)
      INTEGER*4 CCTKH75
      integer, parameter :: cctki_use_CCTKH75 = kind(CCTKH75)
      INTEGER*4 CCTKH77
      integer, parameter :: cctki_use_CCTKH77 = kind(CCTKH77)
      INTEGER*4 CCTKH79
      integer, parameter :: cctki_use_CCTKH79 = kind(CCTKH79)
      INTEGER*4 CCTKH81
      integer, parameter :: cctki_use_CCTKH81 = kind(CCTKH81)
      INTEGER*4 CCTKH83
      integer, parameter :: cctki_use_CCTKH83 = kind(CCTKH83)
      INTEGER*4 CCTKH85
      integer, parameter :: cctki_use_CCTKH85 = kind(CCTKH85)
      INTEGER*4 CCTKH87
      integer, parameter :: cctki_use_CCTKH87 = kind(CCTKH87)
      INTEGER*4 CCTKH89
      integer, parameter :: cctki_use_CCTKH89 = kind(CCTKH89)
      INTEGER*4 CCTKH91
      integer, parameter :: cctki_use_CCTKH91 = kind(CCTKH91)
      INTEGER*4 CCTKH94
      integer, parameter :: cctki_use_CCTKH94 = kind(CCTKH94)
      INTEGER*4 CCTKH95
      integer, parameter :: cctki_use_CCTKH95 = kind(CCTKH95)
      COMMON /IOrest/CCTKH44, CCTKH58, CCTKH68, CCTKH70, CCTKH72, CCTKH7
     &4, CCTKH76, CCTKH78, CCTKH80, CCTKH82, CCTKH84, CCTKH41, CCTKH42, 
     &CCTKH45, CCTKH48, CCTKH49, CCTKH50, CCTKH54, out_dir, CCTKH60, CCT
     &KH61, CCTKH62, CCTKH64, CCTKH86, CCTKH88, CCTKH90, CCTKH92, CCTKH9
     &3, CCTKH96, CCTKH39, CCTKH40, CCTKH43, CCTKH46, CCTKH47, CCTKH51, 
     &CCTKH52, CCTKH53, CCTKH55, CCTKH56, CCTKH57, CCTKH59, CCTKH63, CCT
     &KH65, CCTKH66, CCTKH67, CCTKH69, CCTKH71, CCTKH73, CCTKH75, CCTKH7
     &7, CCTKH79, CCTKH81, CCTKH83, CCTKH85, CCTKH87, CCTKH89, CCTKH91, 
     &CCTKH94, CCTKH95
      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

c

      INTEGER ::
     &     igrid,lmode,mmode,Psi_power=1
      INTEGER ::
     &     do_ADMmass(2)
      REAL*8 ::
     &     orig(3),radius
      REAL*8 ::
     &     x_1d(cctk_lsh(1)),y_1d(cctk_lsh(2)),z_1d(cctk_lsh(3))


c

      REAL*8 ::
     &     dtaudt,ADMmass(2),mass,rsch,momentum(3),spin(3)
      REAL*8,ALLOCATABLE ::
     &     Qodd(:,:,:), Qeven(:,:,:)


c

      INTEGER ::
     &     ix,iy,iz,fn1,fn2,lmin,lmax,mmin,mmax,lstep,mstep,
     &     il,im,it,ndet,idet,ioutput
      INTEGER,SAVE :: openfile = 1
      INTEGER,PARAMETER ::
     &     max_detectors = 9,number_timecoords = 2
      REAL*8,PARAMETER ::
     &     two = 2.0D0
      REAL*8 ::
     &     time,r1,r2,dr,r_max,xmin,xmax,ymin,ymax,zmin,zmax
      REAL*8 ::
     &     detector(max_detectors)
      CHARACTER*100 ::
     &     out1,out2,massfile,rschfile,ADMmassfile1,ADMmassfile2,
     &     momentumfile1,momentumfile2,momentumfile3,spinfile1,spinfile2
     &,spinfile3
      CHARACTER*3 ::
     &     timestring

      LOGICAL :: use_proper,use_coordinate,do_output
      REAL*8,DIMENSION(10),SAVE :: proper_time
      REAL*8,SAVE :: last_time
      INTEGER, save :: open_file_level(10) = 0

      INTEGER myproc,ierr
      REAL*8 dx,dy,dz
      INTEGER*4 :: nx, ny, nz

      character*80 infoline

c

      myproc = CCTK_MyProc(cctkGH)
      dx = cctk_delta_space(1)
      dy = cctk_delta_space(2)
      dz = cctk_delta_space(3)

      nx = cctk_lsh(1)
      ny = cctk_lsh(2)
      nz = cctk_lsh(3)

c
c
c
c
c

      IF ((itout) .LE. 0) RETURN
      IF(MOD(int(cctk_iteration),int(itout)) .NE. 0) RETURN

      if (verbose == 1) then
         write(infoline,'(A24,G14.7)')
     &        'Calling Extract at time ',cctk_time
         call CCTK_Info("Extract",infoline)
      end if

c
c
c
c
c


c

      IF (MOD(int(Nt),2) == 1 .OR. MOD(int(Np),2) == 1 .OR.
     &     Nt < 0 .OR. Np < 0) THEN
        call CCTK_Warn(0,128,"Extract.F","Extract","Error in Nt or Np in
     & Extract")
      END IF


c

      orig(1) = origin_x
      orig(2) = origin_y
      orig(3) = origin_z


c

      IF ((CCTK_Equals(domain,"octant") .ne. 0)) THEN
         igrid = 1
      ELSEIF ((CCTK_Equals(domain,"bitant") .ne. 0)) THEN
         igrid = 3
      ELSE
         igrid = 0
      END IF








c

      do ix = 1, nx
        x_1d(ix) = x(ix,1,1)
      enddo
      do iy = 1, ny
        y_1d(iy) = y(1,iy,1)
      enddo
      do iz = 1, nz
        z_1d(iz) = z(1,1,iz)
      enddo

c
      IF (doADMmass == 1) THEN
         do_ADMmass(1) = 1
         IF (conformal_state == 1) THEN
            do_ADMmass(2) = 1
         ELSE
            do_ADMmass(2) = 0
         ENDIF
      ELSE
         do_ADMmass(:) = 0
      END IF

c
c
      g00 = alp

c
      if ((CCTK_Equals(timecoord,"both") .ne. 0)) then
         use_proper = .true.
         use_coordinate = .true.
         if (cctk_iteration == 0) then
            proper_time = 0
            last_time = cctk_time
         end if
      elseif ((CCTK_Equals(timecoord,"proper") .ne. 0)) then
         use_proper = .true.
         use_coordinate = .false.
         if (cctk_iteration == 0) then
            proper_time = 0
            last_time = cctk_time
         end if
      elseif ((CCTK_Equals(timecoord,"coord") .ne. 0)) then
         use_proper = .false.
         use_coordinate = .true.
      else
         use_proper = .false.
         use_coordinate = .true.
      endif

c
c
c
c
c

      lmode  = l_mode

      IF (all_modes == 1) THEN
         lmin = 2
         lmax = lmode
c
         mmode = 0
         ALLOCATE(Qodd(2,2:lmode,0:lmode),Qeven(2,2:lmode,0:lmode))
      ELSE
         lmin = lmode
         lmax = lmode
         mmode = m_mode
         ALLOCATE(Qodd(2,2:lmode,0:mmode),Qeven(2,2:lmode,0:mmode))
      ENDIF
c
c
c


c

      IF (lmode < 2 .OR. mmode > lmode .OR. mmode < 0) THEN
         call CCTK_Warn(0,235,"Extract.F","Extract","Error in lmode,mmod
     &e in Extract")
      END IF
      IF (lmode > 9) THEN
         call CCTK_Warn(4,238,"Extract.F","Extract","Filenames will prob
     &ably be crazy in Extract")
      END IF

c

      IF (igrid == 1 .OR. igrid == 2) THEN
         lstep = 2 ; mstep = 2
      ELSE
         lstep = 1 ; mstep = 1
      END IF

c
      IF (igrid == 2) mstep = lmode+1


c
c
c
c
c

      call CCTK_CoordRange(ierr,cctkGH,xmin,xmax,-1,"x","cart3d")
      call CCTK_CoordRange(ierr,cctkGH,ymin,ymax,-1,"y","cart3d")
      call CCTK_CoordRange(ierr,cctkGH,zmin,zmax,-1,"z","cart3d")

      IF (igrid == 2) THEN
         r_max = MIN(xmax-two*Dx-orig(1),
     &        zmax-two*Dz-orig(3))
      ELSE IF (igrid == 1) THEN
         r_max = MIN(zmax-two*Dx-orig(1),
     &        ymax-two*Dy-orig(2),
     &        zmax-two*Dz-orig(3))
      ELSE IF (igrid == 3) THEN
         r_max = MIN(xmax-two*Dx-orig(1),
     &        ymax-two*Dy-orig(2),
     &        zmax-two*Dz-orig(3),
     &        ABS(xmin+two*Dx-orig(1)),
     &        ABS(ymin+two*Dy-orig(2)))
      ELSE
         r_max = MIN(xmax-two*Dx-orig(1),
     &        ymax-two*Dy-orig(2),
     &        zmax-two*Dz-orig(3),
     &        ABS(xmin+two*Dx-orig(1)),
     &        ABS(ymin+two*Dy-orig(2)),
     &        ABS(zmin+two*Dz-orig(3)))
      END IF




c
c
c
c
c

      test_Cauchy: IF (Cauchy == 1) THEN

      it = Cauchy_timestep


c

      check_timestep: IF (open_file_level(1) .eq. 0) THEN

c
            write (*,*) "Open output file on level ", 1
            open_file_level(1)=1;

            test_myproc1: IF (CCTK_MyProc(cctkGH) == 0 ) THEN

               out1 = "rsch_ini.rl"
               call Extract_open(cctkGH,0,out1,77)

               out1 = "mass_ini.rl"
               call Extract_open(cctkGH,0,out1,78)

               IF (do_ADMmass(1) == 1) THEN
                  out1 = "ADMmass_ini.rl"
                  call Extract_open(cctkGH,0,out1,79)
               ENDIF
               IF (do_ADMmass(2) == 1) THEN
                  out1 = "ADMmassc_ini.rl"
                  call Extract_open(cctkGH,0,out1,80)
               ENDIF

               IF (do_momentum == 1) THEN
                  out1 = "momentum_x_ini.rl"
                  call Extract_open(cctkGH,0,out1,781)
                  out1 = "momentum_y_ini.rl"
                  call Extract_open(cctkGH,0,out1,782)
                  out1 = "momentum_z_ini.rl"
                  call Extract_open(cctkGH,0,out1,783)
               ENDIF
               IF (do_spin == 1) THEN
                  out1 = "spin_x_ini.rl"
                  call Extract_open(cctkGH,0,out1,784)
                  out1 = "spin_y_ini.rl"
                  call Extract_open(cctkGH,0,out1,785)
                  out1 = "spin_z_ini.rl"
                  call Extract_open(cctkGH,0,out1,786)
               ENDIF

               loop_l1: DO il = lmin,lmax,lstep

                  IF (all_modes == 0) THEN
                     mmin = mmode ; mmax = mmode
                  ELSE
                     mmin = 0 ; mmax = il
                  END IF

                  loop_m1: DO im = mmin,mmax,lstep

                     fn1 = il*10+im
                     out1 = "Qeven_ini_"//
     &                    CHAR(il+48)//CHAR(im+48)//".rl"
                     call Extract_open(cctkGH,0,out1,fn1)

c
                     IF (igrid == 0) THEN
                        fn2 = 100+il*10+im
                        out2 = "Qodd_ini_"//
     &                       CHAR(il+48)//CHAR(im+48)//".rl"
                        call Extract_open(cctkGH,0,out2,fn2)
                     END IF

                  END DO loop_m1

               END DO loop_l1

            END IF test_myproc1


c

            r1 = Cauchy_r1
            r2 = r_max
            dr = Cauchy_dr


c

            IF (verbose == 1) THEN
               WRITE(*,*) "Extracting Cauchy initial data"
               WRITE(*,*) "  r = ",r1," to ",r2," step ",dr
            END IF

            radius = r1

            extract_at_each_radius: DO WHILE (radius < r2)

c
c
               CALL D3_extract(cctkGH,conformal_state,do_ADMmass,do_mome
     &ntum,do_spin,
     &           igrid,orig,myproc,interpolation_operator,interpolation_
     &order,
     &           Nt,Np,nx,ny,nz,all_modes,lmode,
     &           mmode,x_1d,y_1d,z_1d,Dx,Dy,Dz,Psi_power,Psi,g00,
     &           gxx,gxy,gxz,gyy,gyz,gzz,kxx,kxy,kxz,kyy,kyz,kzz,
     &           radius,ADMmass,momentum,spin,mass,rsch,
     &           Qodd,Qeven,temp3d,dtaudt)
c
c

               IF (verbose == 1) THEN
                  WRITE(*,*) "Extracted at r =",radius
                  WRITE(*,*) " Sch radius/mass =",rsch,mass
               ENDIF

c

               test_myproc2: IF (CCTK_MyProc(cctkGH) == 0) THEN

                  WRITE( 77,*) radius,rsch
                  WRITE( 78,*) radius,mass
                  IF (do_ADMmass(1) == 1) WRITE( 79,*) radius,ADMmass(1)
     &
                  IF (do_ADMmass(2) == 1) WRITE( 80,*) radius,ADMmass(2)
     &
                  IF (do_momentum == 1) then
                     WRITE(781,*) radius,momentum(1)
                     WRITE(782,*) radius,momentum(2)
                     WRITE(783,*) radius,momentum(3)
                  end if

                  IF (do_spin == 1) THEN
                     WRITE(784,*) radius,spin(1)
                     WRITE(785,*) radius,spin(2)
                     WRITE(786,*) radius,spin(3)
                  END IF

                  loop_l2: DO il = lmin,lmax,lstep

                     IF (all_modes == 0) THEN
                        mmin = mmode ; mmax = mmode
                     ELSE
                        mmin = 0 ; mmax = il
                     END IF

                     loop_m2: DO im = mmin,mmax,mstep

                        fn1 = il*10+im
                        WRITE(fn1,*) rsch,Qeven(:,il,im)

c
                        IF (igrid == 0) THEN
                           fn2 = 100+il*10+im
                           WRITE(fn2,*) rsch,Qeven(:,il,im)
                        END IF

                     END DO loop_m2

                  END DO loop_l2

               END IF test_myproc2

               radius = radius+dr

            END DO extract_at_each_radius


c

            test_myproc3: IF (myproc == 0) THEN

               CLOSE( 77)   ! Schwarzschild radius
               CLOSE( 78)   ! Schwarzschild mass
               IF (do_ADMmass(1) == 1) CLOSE( 79)   ! ADM mass
               IF (do_ADMmass(2) == 1) CLOSE( 80)   ! ADM mass

               IF (do_momentum == 1) THEN
                  CLOSE(781)    ! momentum
                  CLOSE(782)    ! momentum
                  CLOSE(783)    ! momentum
               end if

               IF (do_spin == 1) THEN
                  CLOSE(784)    ! spin
                  CLOSE(785)    ! spin
                  CLOSE(786)    ! spin
               END IF

               loop_l3: DO il = lmin,lmax,lstep

                  IF (all_modes == 0) THEN
                     mmin = mmode ; mmax = mmode
                  ELSE
                     mmin = 0 ; mmax = il
                  END IF

                  loop_m3: DO im = mmin,mmax,mstep

                     fn1 = il*10+im
                     CLOSE(fn1) ! Qeven_ini_lm.dat

                     IF (igrid == 0) THEN
                        fn2 = 100+il*10+im
                        CLOSE(fn2) ! Qodd_ini_lm.dat
                     END IF

                  END DO loop_m3

               END DO loop_l3

            END IF test_myproc3

         END IF check_timestep

      END IF test_Cauchy


c
c
c
c
c

c
      do_ADMmass(2) = 0

      ndet = num_detectors

      test_detectors: IF (ndet > 0) THEN

         IF (ndet > 9) THEN
            call CCTK_Warn(0,520,"Extract.F","Extract","Too many detecto
     &rs in Extract")
         END IF

         detector(1) = detector1
         detector(2) = detector2
         detector(3) = detector3
         detector(4) = detector4
         detector(5) = detector5
         detector(6) = detector6
         detector(7) = detector7
         detector(8) = detector8
         detector(9) = detector9

         DO idet = ndet+1, max_detectors
            detector(idet) = 0.0D0
         END DO

         DO idet = 1, ndet
            IF (detector(idet) > r_max) THEN
               IF (openfile == 1 .OR. cctk_iteration == it) THEN
                  call CCTK_Warn(8,540,"Extract.F","Extract","Removing d
     &etectors outside coordinate range")
               END IF
               ndet =idet-1
               GOTO 404
            ENDIF
         END DO
 404     CONTINUE

         IF (verbose == 1) THEN
            IF (openfile == 1) THEN
               WRITE(*,*) "Extracting at ",ndet," detectors "
               DO idet=1,ndet
                  WRITE(*,*) "  r = ",detector(idet)
               ENDDO
            END IF
         END IF

         detector_loop: DO idet = 1,ndet

            radius = detector(idet)

            IF (verbose == 1) THEN
              WRITE(*,*) "Calling extract at radius ... ",radius
            END IF

            CALL D3_extract(cctkGH,conformal_state,do_ADMmass,do_momentu
     &m,do_spin,
     &           igrid,orig,myproc,interpolation_operator,interpolation_
     &order,
     &           Nt,Np,nx,ny,nz,all_modes,
     &           lmode,mmode,x_1d,y_1d,z_1d,
     &           Dx,Dy,Dz,Psi_power,Psi,g00,gxx,gxy,gxz,gyy,gyz,gzz,kxx,
     &kxy,kxz,
     &           kyy,kyz,kzz,radius,ADMmass,momentum,spin,mass,rsch,
     &           Qodd,Qeven,temp3d,dtaudt)

            IF (verbose == 1) THEN
                   WRITE(*,*) "Detector ",idet," ..."
                   WRITE(*,*) " Sch radius/mass =",rsch,mass
            END IF

c

            test_myproc4: IF (myproc == 0) THEN

               DO ioutput=1,number_timecoords

                  do_output = .false.
                  timestring = "ERR"
                  time = 0D0
                  IF (ioutput == 1 .AND. use_coordinate) THEN
                     timestring = ".tl"
                     do_output = .true.
                     time = cctk_time
                  ELSEIF (ioutput == 2 .AND. use_proper) THEN
                     timestring = ".ul"
                     do_output = .true.
                     time = proper_time(idet) + (cctk_time-last_time)*dt
     &audt
                     proper_time(idet) = time
                     if (idet == ndet) last_time = cctk_time
                  ENDIF

                  IF (do_output) THEN

c
                     rschfile = "rsch_"//"R"//
     &                    CHAR(idet+48)//timestring
                     massfile = "mass_"//"R"//
     &                    CHAR(idet+48)//timestring
                     ADMmassfile1 = "ADMmass_"//"R"//
     &                    CHAR(idet+48)//timestring
                     ADMmassfile2 = "ADMmassc_"//"R"//
     &                    CHAR(idet+48)//timestring
                     momentumfile1 = "momentum_x_"//"R"//
     &                    CHAR(idet+48)//timestring
                     momentumfile2 = "momentum_y_"//"R"//
     &                    CHAR(idet+48)//timestring
                     momentumfile3 = "momentum_z_"//"R"//
     &                    CHAR(idet+48)//timestring
                     spinfile1 = "spin_x_"//"R"//
     &                    CHAR(idet+48)//timestring
                     spinfile2 = "spin_y_"//"R"//
     &                    CHAR(idet+48)//timestring
                     spinfile3 = "spin_z_"//"R"//
     &                    CHAR(idet+48)//timestring

                     call Extract_write(cctkGH,openfile,rschfile,time,rs
     &ch)
                     call Extract_write(cctkGH,openfile,massfile,time,ma
     &ss)
                     IF (do_ADMmass(1) == 1) THEN
                        call Extract_write(cctkGH,openfile,ADMmassfile1,
     &time,ADMmass(1))
                     END IF
                     IF (do_ADMmass(2) == 1) THEN
                        call Extract_write(cctkGH,openfile,ADMmassfile2,
     &time,ADMmass(2))
                     END IF
                     IF (do_momentum == 1) THEN
                        call Extract_write(cctkGH,openfile,momentumfile1
     &,time,momentum(1))
                        call Extract_write(cctkGH,openfile,momentumfile2
     &,time,momentum(2))
                        call Extract_write(cctkGH,openfile,momentumfile3
     &,time,momentum(3))
                     END IF
                     IF (do_spin == 1) THEN
                        call Extract_write(cctkGH,openfile,spinfile1,cct
     &k_time,spin(1))
                        call Extract_write(cctkGH,openfile,spinfile2,cct
     &k_time,spin(2))
                        call Extract_write(cctkGH,openfile,spinfile3,cct
     &k_time,spin(3))
                     END IF


c

                     loop_l5: DO il = lmin,lmax,lstep

                       IF (all_modes == 0) THEN
                          mmin = mmode ; mmax = mmode
                       ELSE
                          mmin = 0 ; mmax = il
                       END IF

                       loop_m5: DO im = mmin,mmax,mstep

                         out1 = "Qeven_"//"R"
     &                        //CHAR(idet+48)//"_"//CHAR(il+48)//
     &                        CHAR(im+48)//timestring
                         out2 = "Qodd_"//"R"
     &                        //CHAR(idet+48)//"_"//CHAR(il+48)//
     &                        CHAR(im+48)//timestring

c
                         call Extract_write2(cctkGH,openfile,out1,time,Q
     &even(:,il,im))

c
                         IF (igrid == 0) THEN
                            call Extract_write2(cctkGH,openfile,out2,tim
     &e,Qodd(:,il,im))
                         END IF

                      END DO loop_m5

                   END DO loop_l5

                ENDIF
             END DO
          END IF test_myproc4

       END DO detector_loop

      END IF test_detectors

      DEALLOCATE(Qodd,Qeven)

      openfile = 0

      END SUBROUTINE Extract


      SUBROUTINE Extract_open(cctkGH,openfile,filename,filehandle)

      implicit none

      REAL*8 Cauchy_dr
      integer, parameter :: cctki_use_Cauchy_dr = kind(Cauchy_dr)
      REAL*8 Cauchy_r1
      integer, parameter :: cctki_use_Cauchy_r1 = kind(Cauchy_r1)
      REAL*8 detector1
      integer, parameter :: cctki_use_detector1 = kind(detector1)
      REAL*8 detector2
      integer, parameter :: cctki_use_detector2 = kind(detector2)
      REAL*8 detector3
      integer, parameter :: cctki_use_detector3 = kind(detector3)
      REAL*8 detector4
      integer, parameter :: cctki_use_detector4 = kind(detector4)
      REAL*8 detector5
      integer, parameter :: cctki_use_detector5 = kind(detector5)
      REAL*8 detector6
      integer, parameter :: cctki_use_detector6 = kind(detector6)
      REAL*8 detector7
      integer, parameter :: cctki_use_detector7 = kind(detector7)
      REAL*8 detector8
      integer, parameter :: cctki_use_detector8 = kind(detector8)
      REAL*8 detector9
      integer, parameter :: cctki_use_detector9 = kind(detector9)
      REAL*8 origin_x
      integer, parameter :: cctki_use_origin_x = kind(origin_x)
      REAL*8 origin_y
      integer, parameter :: cctki_use_origin_y = kind(origin_y)
      REAL*8 origin_z
      integer, parameter :: cctki_use_origin_z = kind(origin_z)
      integer*8 interpolation_operator
      integer, parameter :: cctki_use_interpolation_operator = kind(inte
     &rpolation_operator)
      integer*8 timecoord
      integer, parameter :: cctki_use_timecoord = kind(timecoord)
      INTEGER*4 Cauchy
      integer, parameter :: cctki_use_Cauchy = kind(Cauchy)
      INTEGER*4 Cauchy_timestep
      integer, parameter :: cctki_use_Cauchy_timestep = kind(Cauchy_time
     &step)
      INTEGER*4 Np
      integer, parameter :: cctki_use_Np = kind(Np)
      INTEGER*4 Nt
      integer, parameter :: cctki_use_Nt = kind(Nt)
      INTEGER*4 all_modes
      integer, parameter :: cctki_use_all_modes = kind(all_modes)
      INTEGER*4 doADMmass
      integer, parameter :: cctki_use_doADMmass = kind(doADMmass)
      INTEGER*4 do_momentum
      integer, parameter :: cctki_use_do_momentum = kind(do_momentum)
      INTEGER*4 do_spin
      integer, parameter :: cctki_use_do_spin = kind(do_spin)
      INTEGER*4 interpolation_order
      integer, parameter :: cctki_use_interpolation_order = kind(interpo
     &lation_order)
      INTEGER*4 itout
      integer, parameter :: cctki_use_itout = kind(itout)
      INTEGER*4 l_mode
      integer, parameter :: cctki_use_l_mode = kind(l_mode)
      INTEGER*4 m_mode
      integer, parameter :: cctki_use_m_mode = kind(m_mode)
      INTEGER*4 num_detectors
      integer, parameter :: cctki_use_num_detectors = kind(num_detectors
     &)
      INTEGER*4 verbose
      integer, parameter :: cctki_use_verbose = kind(verbose)
      COMMON /Extractpriv/Cauchy_dr, Cauchy_r1, detector1, detector2, de
     &tector3, detector4, detector5, detector6, detector7, detector8, de
     &tector9, origin_x, origin_y, origin_z, interpolation_operator, tim
     &ecoord, Cauchy, Cauchy_timestep, Np, Nt, all_modes, doADMmass, do_
     &momentum, do_spin, interpolation_order, itout, l_mode, m_mode, num
     &_detectors, verbose
      integer*8 CCTKH0
      integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
      integer*8 CCTKH1
      integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
      integer*8 CCTKH2
      integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
      integer*8 CCTKH3
      integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
      integer*8 CCTKH4
      integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
      integer*8 CCTKH5
      integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
      integer*8 CCTKH6
      integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
      integer*8 CCTKH7
      integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
      integer*8 CCTKH8
      integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
      integer*8 CCTKH9
      integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
      integer*8 CCTKH10
      integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
      integer*8 CCTKH12
      integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
      integer*8 metric_type
      integer, parameter :: cctki_use_metric_type = kind(metric_type)
      integer*8 CCTKH14
      integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
      integer*8 CCTKH15
      integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
      INTEGER*4 CCTKH11
      integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
      INTEGER*4 CCTKH13
      integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
      INTEGER*4 CCTKH16
      integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
      COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, CCTKH4, CCTKH5
     &, CCTKH6, CCTKH7, CCTKH8, CCTKH9, CCTKH10, CCTKH12, metric_type, C
     &CTKH14, CCTKH15, CCTKH11, CCTKH13, CCTKH16
      REAL*8 CCTKH18
      integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
      REAL*8 CCTKH19
      integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
      REAL*8 CCTKH20
      integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
      REAL*8 CCTKH21
      integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
      REAL*8 CCTKH31
      integer, parameter :: cctki_use_CCTKH31 = kind(CCTKH31)
      REAL*8 CCTKH32
      integer, parameter :: cctki_use_CCTKH32 = kind(CCTKH32)
      REAL*8 CCTKH33
      integer, parameter :: cctki_use_CCTKH33 = kind(CCTKH33)
      REAL*8 CCTKH34
      integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
      REAL*8 CCTKH35
      integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
      REAL*8 CCTKH36
      integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
      REAL*8 CCTKH37
      integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
      REAL*8 CCTKH38
      integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
      integer*8 CCTKH17
      integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
      integer*8 domain
      integer, parameter :: cctki_use_domain = kind(domain)
      integer*8 CCTKH22
      integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
      integer*8 CCTKH23
      integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
      integer*8 CCTKH30
      integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
      INTEGER*4 CCTKH24
      integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
      INTEGER*4 CCTKH25
      integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
      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 CCTKH29
      integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
      COMMON /GRIDrest/CCTKH18, CCTKH19, CCTKH20, CCTKH21, CCTKH31, CCTK
     &H32, CCTKH33, CCTKH34, CCTKH35, CCTKH36, CCTKH37, CCTKH38, CCTKH17
     &, domain, CCTKH22, CCTKH23, CCTKH30, CCTKH24, CCTKH25, CCTKH26, CC
     &TKH27, CCTKH28, CCTKH29
      REAL*8 CCTKH44
      integer, parameter :: cctki_use_CCTKH44 = kind(CCTKH44)
      REAL*8 CCTKH58
      integer, parameter :: cctki_use_CCTKH58 = kind(CCTKH58)
      REAL*8 CCTKH68
      integer, parameter :: cctki_use_CCTKH68 = kind(CCTKH68)
      REAL*8 CCTKH70
      integer, parameter :: cctki_use_CCTKH70 = kind(CCTKH70)
      REAL*8 CCTKH72
      integer, parameter :: cctki_use_CCTKH72 = kind(CCTKH72)
      REAL*8 CCTKH74
      integer, parameter :: cctki_use_CCTKH74 = kind(CCTKH74)
      REAL*8 CCTKH76
      integer, parameter :: cctki_use_CCTKH76 = kind(CCTKH76)
      REAL*8 CCTKH78
      integer, parameter :: cctki_use_CCTKH78 = kind(CCTKH78)
      REAL*8 CCTKH80
      integer, parameter :: cctki_use_CCTKH80 = kind(CCTKH80)
      REAL*8 CCTKH82
      integer, parameter :: cctki_use_CCTKH82 = kind(CCTKH82)
      REAL*8 CCTKH84
      integer, parameter :: cctki_use_CCTKH84 = kind(CCTKH84)
      integer*8 CCTKH41
      integer, parameter :: cctki_use_CCTKH41 = kind(CCTKH41)
      integer*8 CCTKH42
      integer, parameter :: cctki_use_CCTKH42 = kind(CCTKH42)
      integer*8 CCTKH45
      integer, parameter :: cctki_use_CCTKH45 = kind(CCTKH45)
      integer*8 CCTKH48
      integer, parameter :: cctki_use_CCTKH48 = kind(CCTKH48)
      integer*8 CCTKH49
      integer, parameter :: cctki_use_CCTKH49 = kind(CCTKH49)
      integer*8 CCTKH50
      integer, parameter :: cctki_use_CCTKH50 = kind(CCTKH50)
      integer*8 CCTKH54
      integer, parameter :: cctki_use_CCTKH54 = kind(CCTKH54)
      integer*8 out_dir
      integer, parameter :: cctki_use_out_dir = kind(out_dir)
      integer*8 CCTKH60
      integer, parameter :: cctki_use_CCTKH60 = kind(CCTKH60)
      integer*8 CCTKH61
      integer, parameter :: cctki_use_CCTKH61 = kind(CCTKH61)
      integer*8 CCTKH62
      integer, parameter :: cctki_use_CCTKH62 = kind(CCTKH62)
      integer*8 CCTKH64
      integer, parameter :: cctki_use_CCTKH64 = kind(CCTKH64)
      integer*8 CCTKH86
      integer, parameter :: cctki_use_CCTKH86 = kind(CCTKH86)
      integer*8 CCTKH88
      integer, parameter :: cctki_use_CCTKH88 = kind(CCTKH88)
      integer*8 CCTKH90
      integer, parameter :: cctki_use_CCTKH90 = kind(CCTKH90)
      integer*8 CCTKH92
      integer, parameter :: cctki_use_CCTKH92 = kind(CCTKH92)
      integer*8 CCTKH93
      integer, parameter :: cctki_use_CCTKH93 = kind(CCTKH93)
      integer*8 CCTKH96
      integer, parameter :: cctki_use_CCTKH96 = kind(CCTKH96)
      INTEGER*4 CCTKH39
      integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
      INTEGER*4 CCTKH40
      integer, parameter :: cctki_use_CCTKH40 = kind(CCTKH40)
      INTEGER*4 CCTKH43
      integer, parameter :: cctki_use_CCTKH43 = kind(CCTKH43)
      INTEGER*4 CCTKH46
      integer, parameter :: cctki_use_CCTKH46 = kind(CCTKH46)
      INTEGER*4 CCTKH47
      integer, parameter :: cctki_use_CCTKH47 = kind(CCTKH47)
      INTEGER*4 CCTKH51
      integer, parameter :: cctki_use_CCTKH51 = kind(CCTKH51)
      INTEGER*4 CCTKH52
      integer, parameter :: cctki_use_CCTKH52 = kind(CCTKH52)
      INTEGER*4 CCTKH53
      integer, parameter :: cctki_use_CCTKH53 = kind(CCTKH53)
      INTEGER*4 CCTKH55
      integer, parameter :: cctki_use_CCTKH55 = kind(CCTKH55)
      INTEGER*4 CCTKH56
      integer, parameter :: cctki_use_CCTKH56 = kind(CCTKH56)
      INTEGER*4 CCTKH57
      integer, parameter :: cctki_use_CCTKH57 = kind(CCTKH57)
      INTEGER*4 CCTKH59
      integer, parameter :: cctki_use_CCTKH59 = kind(CCTKH59)
      INTEGER*4 CCTKH63
      integer, parameter :: cctki_use_CCTKH63 = kind(CCTKH63)
      INTEGER*4 CCTKH65
      integer, parameter :: cctki_use_CCTKH65 = kind(CCTKH65)
      INTEGER*4 CCTKH66
      integer, parameter :: cctki_use_CCTKH66 = kind(CCTKH66)
      INTEGER*4 CCTKH67
      integer, parameter :: cctki_use_CCTKH67 = kind(CCTKH67)
      INTEGER*4 CCTKH69
      integer, parameter :: cctki_use_CCTKH69 = kind(CCTKH69)
      INTEGER*4 CCTKH71
      integer, parameter :: cctki_use_CCTKH71 = kind(CCTKH71)
      INTEGER*4 CCTKH73
      integer, parameter :: cctki_use_CCTKH73 = kind(CCTKH73)
      INTEGER*4 CCTKH75
      integer, parameter :: cctki_use_CCTKH75 = kind(CCTKH75)
      INTEGER*4 CCTKH77
      integer, parameter :: cctki_use_CCTKH77 = kind(CCTKH77)
      INTEGER*4 CCTKH79
      integer, parameter :: cctki_use_CCTKH79 = kind(CCTKH79)
      INTEGER*4 CCTKH81
      integer, parameter :: cctki_use_CCTKH81 = kind(CCTKH81)
      INTEGER*4 CCTKH83
      integer, parameter :: cctki_use_CCTKH83 = kind(CCTKH83)
      INTEGER*4 CCTKH85
      integer, parameter :: cctki_use_CCTKH85 = kind(CCTKH85)
      INTEGER*4 CCTKH87
      integer, parameter :: cctki_use_CCTKH87 = kind(CCTKH87)
      INTEGER*4 CCTKH89
      integer, parameter :: cctki_use_CCTKH89 = kind(CCTKH89)
      INTEGER*4 CCTKH91
      integer, parameter :: cctki_use_CCTKH91 = kind(CCTKH91)
      INTEGER*4 CCTKH94
      integer, parameter :: cctki_use_CCTKH94 = kind(CCTKH94)
      INTEGER*4 CCTKH95
      integer, parameter :: cctki_use_CCTKH95 = kind(CCTKH95)
      COMMON /IOrest/CCTKH44, CCTKH58, CCTKH68, CCTKH70, CCTKH72, CCTKH7
     &4, CCTKH76, CCTKH78, CCTKH80, CCTKH82, CCTKH84, CCTKH41, CCTKH42, 
     &CCTKH45, CCTKH48, CCTKH49, CCTKH50, CCTKH54, out_dir, CCTKH60, CCT
     &KH61, CCTKH62, CCTKH64, CCTKH86, CCTKH88, CCTKH90, CCTKH92, CCTKH9
     &3, CCTKH96, CCTKH39, CCTKH40, CCTKH43, CCTKH46, CCTKH47, CCTKH51, 
     &CCTKH52, CCTKH53, CCTKH55, CCTKH56, CCTKH57, CCTKH59, CCTKH63, CCT
     &KH65, CCTKH66, CCTKH67, CCTKH69, CCTKH71, CCTKH73, CCTKH75, CCTKH7
     &7, CCTKH79, CCTKH81, CCTKH83, CCTKH85, CCTKH87, CCTKH89, CCTKH91, 
     &CCTKH94, CCTKH95

      integer filehandle,openfile
      INTEGER*4 nchar
      character*(*) filename
      integer*8 cctkGH

      character*200 fullname
      character*200 filestr

c
      call CCTK_FortranString(nchar,out_dir,filestr)
      fullname = filestr(1:nchar)//"/"//filename

      if (openfile==1) then
         OPEN(UNIT= filehandle,FILE=fullname,STATUS="unknown")
         write(filehandle,101) char(34),filename
 101     format(a1,a14)
         call Extract_Advertise(cctkGH,fullname)
      else
         OPEN(UNIT=filehandle,FILE=fullname,STATUS="old",
     .        POSITION="append")
      end if


      END SUBROUTINE Extract_open


      SUBROUTINE Extract_write(cctkGH, openfile,filename,value1,value2)

      implicit none

      REAL*8 Cauchy_dr
      integer, parameter :: cctki_use_Cauchy_dr = kind(Cauchy_dr)
      REAL*8 Cauchy_r1
      integer, parameter :: cctki_use_Cauchy_r1 = kind(Cauchy_r1)
      REAL*8 detector1
      integer, parameter :: cctki_use_detector1 = kind(detector1)
      REAL*8 detector2
      integer, parameter :: cctki_use_detector2 = kind(detector2)
      REAL*8 detector3
      integer, parameter :: cctki_use_detector3 = kind(detector3)
      REAL*8 detector4
      integer, parameter :: cctki_use_detector4 = kind(detector4)
      REAL*8 detector5
      integer, parameter :: cctki_use_detector5 = kind(detector5)
      REAL*8 detector6
      integer, parameter :: cctki_use_detector6 = kind(detector6)
      REAL*8 detector7
      integer, parameter :: cctki_use_detector7 = kind(detector7)
      REAL*8 detector8
      integer, parameter :: cctki_use_detector8 = kind(detector8)
      REAL*8 detector9
      integer, parameter :: cctki_use_detector9 = kind(detector9)
      REAL*8 origin_x
      integer, parameter :: cctki_use_origin_x = kind(origin_x)
      REAL*8 origin_y
      integer, parameter :: cctki_use_origin_y = kind(origin_y)
      REAL*8 origin_z
      integer, parameter :: cctki_use_origin_z = kind(origin_z)
      integer*8 interpolation_operator
      integer, parameter :: cctki_use_interpolation_operator = kind(inte
     &rpolation_operator)
      integer*8 timecoord
      integer, parameter :: cctki_use_timecoord = kind(timecoord)
      INTEGER*4 Cauchy
      integer, parameter :: cctki_use_Cauchy = kind(Cauchy)
      INTEGER*4 Cauchy_timestep
      integer, parameter :: cctki_use_Cauchy_timestep = kind(Cauchy_time
     &step)
      INTEGER*4 Np
      integer, parameter :: cctki_use_Np = kind(Np)
      INTEGER*4 Nt
      integer, parameter :: cctki_use_Nt = kind(Nt)
      INTEGER*4 all_modes
      integer, parameter :: cctki_use_all_modes = kind(all_modes)
      INTEGER*4 doADMmass
      integer, parameter :: cctki_use_doADMmass = kind(doADMmass)
      INTEGER*4 do_momentum
      integer, parameter :: cctki_use_do_momentum = kind(do_momentum)
      INTEGER*4 do_spin
      integer, parameter :: cctki_use_do_spin = kind(do_spin)
      INTEGER*4 interpolation_order
      integer, parameter :: cctki_use_interpolation_order = kind(interpo
     &lation_order)
      INTEGER*4 itout
      integer, parameter :: cctki_use_itout = kind(itout)
      INTEGER*4 l_mode
      integer, parameter :: cctki_use_l_mode = kind(l_mode)
      INTEGER*4 m_mode
      integer, parameter :: cctki_use_m_mode = kind(m_mode)
      INTEGER*4 num_detectors
      integer, parameter :: cctki_use_num_detectors = kind(num_detectors
     &)
      INTEGER*4 verbose
      integer, parameter :: cctki_use_verbose = kind(verbose)
      COMMON /Extractpriv/Cauchy_dr, Cauchy_r1, detector1, detector2, de
     &tector3, detector4, detector5, detector6, detector7, detector8, de
     &tector9, origin_x, origin_y, origin_z, interpolation_operator, tim
     &ecoord, Cauchy, Cauchy_timestep, Np, Nt, all_modes, doADMmass, do_
     &momentum, do_spin, interpolation_order, itout, l_mode, m_mode, num
     &_detectors, verbose
      integer*8 CCTKH0
      integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
      integer*8 CCTKH1
      integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
      integer*8 CCTKH2
      integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
      integer*8 CCTKH3
      integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
      integer*8 CCTKH4
      integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
      integer*8 CCTKH5
      integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
      integer*8 CCTKH6
      integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
      integer*8 CCTKH7
      integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
      integer*8 CCTKH8
      integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
      integer*8 CCTKH9
      integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
      integer*8 CCTKH10
      integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
      integer*8 CCTKH12
      integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
      integer*8 metric_type
      integer, parameter :: cctki_use_metric_type = kind(metric_type)
      integer*8 CCTKH14
      integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
      integer*8 CCTKH15
      integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
      INTEGER*4 CCTKH11
      integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
      INTEGER*4 CCTKH13
      integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
      INTEGER*4 CCTKH16
      integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
      COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, CCTKH4, CCTKH5
     &, CCTKH6, CCTKH7, CCTKH8, CCTKH9, CCTKH10, CCTKH12, metric_type, C
     &CTKH14, CCTKH15, CCTKH11, CCTKH13, CCTKH16
      REAL*8 CCTKH18
      integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
      REAL*8 CCTKH19
      integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
      REAL*8 CCTKH20
      integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
      REAL*8 CCTKH21
      integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
      REAL*8 CCTKH31
      integer, parameter :: cctki_use_CCTKH31 = kind(CCTKH31)
      REAL*8 CCTKH32
      integer, parameter :: cctki_use_CCTKH32 = kind(CCTKH32)
      REAL*8 CCTKH33
      integer, parameter :: cctki_use_CCTKH33 = kind(CCTKH33)
      REAL*8 CCTKH34
      integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
      REAL*8 CCTKH35
      integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
      REAL*8 CCTKH36
      integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
      REAL*8 CCTKH37
      integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
      REAL*8 CCTKH38
      integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
      integer*8 CCTKH17
      integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
      integer*8 domain
      integer, parameter :: cctki_use_domain = kind(domain)
      integer*8 CCTKH22
      integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
      integer*8 CCTKH23
      integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
      integer*8 CCTKH30
      integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
      INTEGER*4 CCTKH24
      integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
      INTEGER*4 CCTKH25
      integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
      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 CCTKH29
      integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
      COMMON /GRIDrest/CCTKH18, CCTKH19, CCTKH20, CCTKH21, CCTKH31, CCTK
     &H32, CCTKH33, CCTKH34, CCTKH35, CCTKH36, CCTKH37, CCTKH38, CCTKH17
     &, domain, CCTKH22, CCTKH23, CCTKH30, CCTKH24, CCTKH25, CCTKH26, CC
     &TKH27, CCTKH28, CCTKH29
      REAL*8 CCTKH44
      integer, parameter :: cctki_use_CCTKH44 = kind(CCTKH44)
      REAL*8 CCTKH58
      integer, parameter :: cctki_use_CCTKH58 = kind(CCTKH58)
      REAL*8 CCTKH68
      integer, parameter :: cctki_use_CCTKH68 = kind(CCTKH68)
      REAL*8 CCTKH70
      integer, parameter :: cctki_use_CCTKH70 = kind(CCTKH70)
      REAL*8 CCTKH72
      integer, parameter :: cctki_use_CCTKH72 = kind(CCTKH72)
      REAL*8 CCTKH74
      integer, parameter :: cctki_use_CCTKH74 = kind(CCTKH74)
      REAL*8 CCTKH76
      integer, parameter :: cctki_use_CCTKH76 = kind(CCTKH76)
      REAL*8 CCTKH78
      integer, parameter :: cctki_use_CCTKH78 = kind(CCTKH78)
      REAL*8 CCTKH80
      integer, parameter :: cctki_use_CCTKH80 = kind(CCTKH80)
      REAL*8 CCTKH82
      integer, parameter :: cctki_use_CCTKH82 = kind(CCTKH82)
      REAL*8 CCTKH84
      integer, parameter :: cctki_use_CCTKH84 = kind(CCTKH84)
      integer*8 CCTKH41
      integer, parameter :: cctki_use_CCTKH41 = kind(CCTKH41)
      integer*8 CCTKH42
      integer, parameter :: cctki_use_CCTKH42 = kind(CCTKH42)
      integer*8 CCTKH45
      integer, parameter :: cctki_use_CCTKH45 = kind(CCTKH45)
      integer*8 CCTKH48
      integer, parameter :: cctki_use_CCTKH48 = kind(CCTKH48)
      integer*8 CCTKH49
      integer, parameter :: cctki_use_CCTKH49 = kind(CCTKH49)
      integer*8 CCTKH50
      integer, parameter :: cctki_use_CCTKH50 = kind(CCTKH50)
      integer*8 CCTKH54
      integer, parameter :: cctki_use_CCTKH54 = kind(CCTKH54)
      integer*8 out_dir
      integer, parameter :: cctki_use_out_dir = kind(out_dir)
      integer*8 CCTKH60
      integer, parameter :: cctki_use_CCTKH60 = kind(CCTKH60)
      integer*8 CCTKH61
      integer, parameter :: cctki_use_CCTKH61 = kind(CCTKH61)
      integer*8 CCTKH62
      integer, parameter :: cctki_use_CCTKH62 = kind(CCTKH62)
      integer*8 CCTKH64
      integer, parameter :: cctki_use_CCTKH64 = kind(CCTKH64)
      integer*8 CCTKH86
      integer, parameter :: cctki_use_CCTKH86 = kind(CCTKH86)
      integer*8 CCTKH88
      integer, parameter :: cctki_use_CCTKH88 = kind(CCTKH88)
      integer*8 CCTKH90
      integer, parameter :: cctki_use_CCTKH90 = kind(CCTKH90)
      integer*8 CCTKH92
      integer, parameter :: cctki_use_CCTKH92 = kind(CCTKH92)
      integer*8 CCTKH93
      integer, parameter :: cctki_use_CCTKH93 = kind(CCTKH93)
      integer*8 CCTKH96
      integer, parameter :: cctki_use_CCTKH96 = kind(CCTKH96)
      INTEGER*4 CCTKH39
      integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
      INTEGER*4 CCTKH40
      integer, parameter :: cctki_use_CCTKH40 = kind(CCTKH40)
      INTEGER*4 CCTKH43
      integer, parameter :: cctki_use_CCTKH43 = kind(CCTKH43)
      INTEGER*4 CCTKH46
      integer, parameter :: cctki_use_CCTKH46 = kind(CCTKH46)
      INTEGER*4 CCTKH47
      integer, parameter :: cctki_use_CCTKH47 = kind(CCTKH47)
      INTEGER*4 CCTKH51
      integer, parameter :: cctki_use_CCTKH51 = kind(CCTKH51)
      INTEGER*4 CCTKH52
      integer, parameter :: cctki_use_CCTKH52 = kind(CCTKH52)
      INTEGER*4 CCTKH53
      integer, parameter :: cctki_use_CCTKH53 = kind(CCTKH53)
      INTEGER*4 CCTKH55
      integer, parameter :: cctki_use_CCTKH55 = kind(CCTKH55)
      INTEGER*4 CCTKH56
      integer, parameter :: cctki_use_CCTKH56 = kind(CCTKH56)
      INTEGER*4 CCTKH57
      integer, parameter :: cctki_use_CCTKH57 = kind(CCTKH57)
      INTEGER*4 CCTKH59
      integer, parameter :: cctki_use_CCTKH59 = kind(CCTKH59)
      INTEGER*4 CCTKH63
      integer, parameter :: cctki_use_CCTKH63 = kind(CCTKH63)
      INTEGER*4 CCTKH65
      integer, parameter :: cctki_use_CCTKH65 = kind(CCTKH65)
      INTEGER*4 CCTKH66
      integer, parameter :: cctki_use_CCTKH66 = kind(CCTKH66)
      INTEGER*4 CCTKH67
      integer, parameter :: cctki_use_CCTKH67 = kind(CCTKH67)
      INTEGER*4 CCTKH69
      integer, parameter :: cctki_use_CCTKH69 = kind(CCTKH69)
      INTEGER*4 CCTKH71
      integer, parameter :: cctki_use_CCTKH71 = kind(CCTKH71)
      INTEGER*4 CCTKH73
      integer, parameter :: cctki_use_CCTKH73 = kind(CCTKH73)
      INTEGER*4 CCTKH75
      integer, parameter :: cctki_use_CCTKH75 = kind(CCTKH75)
      INTEGER*4 CCTKH77
      integer, parameter :: cctki_use_CCTKH77 = kind(CCTKH77)
      INTEGER*4 CCTKH79
      integer, parameter :: cctki_use_CCTKH79 = kind(CCTKH79)
      INTEGER*4 CCTKH81
      integer, parameter :: cctki_use_CCTKH81 = kind(CCTKH81)
      INTEGER*4 CCTKH83
      integer, parameter :: cctki_use_CCTKH83 = kind(CCTKH83)
      INTEGER*4 CCTKH85
      integer, parameter :: cctki_use_CCTKH85 = kind(CCTKH85)
      INTEGER*4 CCTKH87
      integer, parameter :: cctki_use_CCTKH87 = kind(CCTKH87)
      INTEGER*4 CCTKH89
      integer, parameter :: cctki_use_CCTKH89 = kind(CCTKH89)
      INTEGER*4 CCTKH91
      integer, parameter :: cctki_use_CCTKH91 = kind(CCTKH91)
      INTEGER*4 CCTKH94
      integer, parameter :: cctki_use_CCTKH94 = kind(CCTKH94)
      INTEGER*4 CCTKH95
      integer, parameter :: cctki_use_CCTKH95 = kind(CCTKH95)
      COMMON /IOrest/CCTKH44, CCTKH58, CCTKH68, CCTKH70, CCTKH72, CCTKH7
     &4, CCTKH76, CCTKH78, CCTKH80, CCTKH82, CCTKH84, CCTKH41, CCTKH42, 
     &CCTKH45, CCTKH48, CCTKH49, CCTKH50, CCTKH54, out_dir, CCTKH60, CCT
     &KH61, CCTKH62, CCTKH64, CCTKH86, CCTKH88, CCTKH90, CCTKH92, CCTKH9
     &3, CCTKH96, CCTKH39, CCTKH40, CCTKH43, CCTKH46, CCTKH47, CCTKH51, 
     &CCTKH52, CCTKH53, CCTKH55, CCTKH56, CCTKH57, CCTKH59, CCTKH63, CCT
     &KH65, CCTKH66, CCTKH67, CCTKH69, CCTKH71, CCTKH73, CCTKH75, CCTKH7
     &7, CCTKH79, CCTKH81, CCTKH83, CCTKH85, CCTKH87, CCTKH89, CCTKH91, 
     &CCTKH94, CCTKH95

      integer*8 cctkGH
      REAL*8 value1,value2
      integer openfile
      INTEGER*4 nchar
      character*(*) filename

      character*200 fullname
      character*200 filestr

c
      call CCTK_FortranString(nchar,out_dir,filestr)
      fullname = filestr(1:nchar)//"/"//filename

      if (openfile==1) then
         OPEN(UNIT= 444,FILE=fullname,STATUS="unknown")
         write(444,101) char(34),filename
 101     format(a1,a14)
         call Extract_Advertise(cctkGH,fullname)
      else
         OPEN(UNIT=444,FILE=fullname,STATUS="old",POSITION="append")
      end if

      write(444,*) value1,value2

      close(444)

      END SUBROUTINE Extract_write


      SUBROUTINE Extract_write2(cctkGH, openfile,filename,value1,value2)
     &

      implicit none

      REAL*8 Cauchy_dr
      integer, parameter :: cctki_use_Cauchy_dr = kind(Cauchy_dr)
      REAL*8 Cauchy_r1
      integer, parameter :: cctki_use_Cauchy_r1 = kind(Cauchy_r1)
      REAL*8 detector1
      integer, parameter :: cctki_use_detector1 = kind(detector1)
      REAL*8 detector2
      integer, parameter :: cctki_use_detector2 = kind(detector2)
      REAL*8 detector3
      integer, parameter :: cctki_use_detector3 = kind(detector3)
      REAL*8 detector4
      integer, parameter :: cctki_use_detector4 = kind(detector4)
      REAL*8 detector5
      integer, parameter :: cctki_use_detector5 = kind(detector5)
      REAL*8 detector6
      integer, parameter :: cctki_use_detector6 = kind(detector6)
      REAL*8 detector7
      integer, parameter :: cctki_use_detector7 = kind(detector7)
      REAL*8 detector8
      integer, parameter :: cctki_use_detector8 = kind(detector8)
      REAL*8 detector9
      integer, parameter :: cctki_use_detector9 = kind(detector9)
      REAL*8 origin_x
      integer, parameter :: cctki_use_origin_x = kind(origin_x)
      REAL*8 origin_y
      integer, parameter :: cctki_use_origin_y = kind(origin_y)
      REAL*8 origin_z
      integer, parameter :: cctki_use_origin_z = kind(origin_z)
      integer*8 interpolation_operator
      integer, parameter :: cctki_use_interpolation_operator = kind(inte
     &rpolation_operator)
      integer*8 timecoord
      integer, parameter :: cctki_use_timecoord = kind(timecoord)
      INTEGER*4 Cauchy
      integer, parameter :: cctki_use_Cauchy = kind(Cauchy)
      INTEGER*4 Cauchy_timestep
      integer, parameter :: cctki_use_Cauchy_timestep = kind(Cauchy_time
     &step)
      INTEGER*4 Np
      integer, parameter :: cctki_use_Np = kind(Np)
      INTEGER*4 Nt
      integer, parameter :: cctki_use_Nt = kind(Nt)
      INTEGER*4 all_modes
      integer, parameter :: cctki_use_all_modes = kind(all_modes)
      INTEGER*4 doADMmass
      integer, parameter :: cctki_use_doADMmass = kind(doADMmass)
      INTEGER*4 do_momentum
      integer, parameter :: cctki_use_do_momentum = kind(do_momentum)
      INTEGER*4 do_spin
      integer, parameter :: cctki_use_do_spin = kind(do_spin)
      INTEGER*4 interpolation_order
      integer, parameter :: cctki_use_interpolation_order = kind(interpo
     &lation_order)
      INTEGER*4 itout
      integer, parameter :: cctki_use_itout = kind(itout)
      INTEGER*4 l_mode
      integer, parameter :: cctki_use_l_mode = kind(l_mode)
      INTEGER*4 m_mode
      integer, parameter :: cctki_use_m_mode = kind(m_mode)
      INTEGER*4 num_detectors
      integer, parameter :: cctki_use_num_detectors = kind(num_detectors
     &)
      INTEGER*4 verbose
      integer, parameter :: cctki_use_verbose = kind(verbose)
      COMMON /Extractpriv/Cauchy_dr, Cauchy_r1, detector1, detector2, de
     &tector3, detector4, detector5, detector6, detector7, detector8, de
     &tector9, origin_x, origin_y, origin_z, interpolation_operator, tim
     &ecoord, Cauchy, Cauchy_timestep, Np, Nt, all_modes, doADMmass, do_
     &momentum, do_spin, interpolation_order, itout, l_mode, m_mode, num
     &_detectors, verbose
      integer*8 CCTKH0
      integer, parameter :: cctki_use_CCTKH0 = kind(CCTKH0)
      integer*8 CCTKH1
      integer, parameter :: cctki_use_CCTKH1 = kind(CCTKH1)
      integer*8 CCTKH2
      integer, parameter :: cctki_use_CCTKH2 = kind(CCTKH2)
      integer*8 CCTKH3
      integer, parameter :: cctki_use_CCTKH3 = kind(CCTKH3)
      integer*8 CCTKH4
      integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
      integer*8 CCTKH5
      integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
      integer*8 CCTKH6
      integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
      integer*8 CCTKH7
      integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
      integer*8 CCTKH8
      integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
      integer*8 CCTKH9
      integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
      integer*8 CCTKH10
      integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
      integer*8 CCTKH12
      integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
      integer*8 metric_type
      integer, parameter :: cctki_use_metric_type = kind(metric_type)
      integer*8 CCTKH14
      integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
      integer*8 CCTKH15
      integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
      INTEGER*4 CCTKH11
      integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
      INTEGER*4 CCTKH13
      integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
      INTEGER*4 CCTKH16
      integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
      COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, CCTKH4, CCTKH5
     &, CCTKH6, CCTKH7, CCTKH8, CCTKH9, CCTKH10, CCTKH12, metric_type, C
     &CTKH14, CCTKH15, CCTKH11, CCTKH13, CCTKH16
      REAL*8 CCTKH18
      integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
      REAL*8 CCTKH19
      integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
      REAL*8 CCTKH20
      integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
      REAL*8 CCTKH21
      integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
      REAL*8 CCTKH31
      integer, parameter :: cctki_use_CCTKH31 = kind(CCTKH31)
      REAL*8 CCTKH32
      integer, parameter :: cctki_use_CCTKH32 = kind(CCTKH32)
      REAL*8 CCTKH33
      integer, parameter :: cctki_use_CCTKH33 = kind(CCTKH33)
      REAL*8 CCTKH34
      integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
      REAL*8 CCTKH35
      integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
      REAL*8 CCTKH36
      integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
      REAL*8 CCTKH37
      integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
      REAL*8 CCTKH38
      integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
      integer*8 CCTKH17
      integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
      integer*8 domain
      integer, parameter :: cctki_use_domain = kind(domain)
      integer*8 CCTKH22
      integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
      integer*8 CCTKH23
      integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
      integer*8 CCTKH30
      integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
      INTEGER*4 CCTKH24
      integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
      INTEGER*4 CCTKH25
      integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
      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 CCTKH29
      integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
      COMMON /GRIDrest/CCTKH18, CCTKH19, CCTKH20, CCTKH21, CCTKH31, CCTK
     &H32, CCTKH33, CCTKH34, CCTKH35, CCTKH36, CCTKH37, CCTKH38, CCTKH17
     &, domain, CCTKH22, CCTKH23, CCTKH30, CCTKH24, CCTKH25, CCTKH26, CC
     &TKH27, CCTKH28, CCTKH29
      REAL*8 CCTKH44
      integer, parameter :: cctki_use_CCTKH44 = kind(CCTKH44)
      REAL*8 CCTKH58
      integer, parameter :: cctki_use_CCTKH58 = kind(CCTKH58)
      REAL*8 CCTKH68
      integer, parameter :: cctki_use_CCTKH68 = kind(CCTKH68)
      REAL*8 CCTKH70
      integer, parameter :: cctki_use_CCTKH70 = kind(CCTKH70)
      REAL*8 CCTKH72
      integer, parameter :: cctki_use_CCTKH72 = kind(CCTKH72)
      REAL*8 CCTKH74
      integer, parameter :: cctki_use_CCTKH74 = kind(CCTKH74)
      REAL*8 CCTKH76
      integer, parameter :: cctki_use_CCTKH76 = kind(CCTKH76)
      REAL*8 CCTKH78
      integer, parameter :: cctki_use_CCTKH78 = kind(CCTKH78)
      REAL*8 CCTKH80
      integer, parameter :: cctki_use_CCTKH80 = kind(CCTKH80)
      REAL*8 CCTKH82
      integer, parameter :: cctki_use_CCTKH82 = kind(CCTKH82)
      REAL*8 CCTKH84
      integer, parameter :: cctki_use_CCTKH84 = kind(CCTKH84)
      integer*8 CCTKH41
      integer, parameter :: cctki_use_CCTKH41 = kind(CCTKH41)
      integer*8 CCTKH42
      integer, parameter :: cctki_use_CCTKH42 = kind(CCTKH42)
      integer*8 CCTKH45
      integer, parameter :: cctki_use_CCTKH45 = kind(CCTKH45)
      integer*8 CCTKH48
      integer, parameter :: cctki_use_CCTKH48 = kind(CCTKH48)
      integer*8 CCTKH49
      integer, parameter :: cctki_use_CCTKH49 = kind(CCTKH49)
      integer*8 CCTKH50
      integer, parameter :: cctki_use_CCTKH50 = kind(CCTKH50)
      integer*8 CCTKH54
      integer, parameter :: cctki_use_CCTKH54 = kind(CCTKH54)
      integer*8 out_dir
      integer, parameter :: cctki_use_out_dir = kind(out_dir)
      integer*8 CCTKH60
      integer, parameter :: cctki_use_CCTKH60 = kind(CCTKH60)
      integer*8 CCTKH61
      integer, parameter :: cctki_use_CCTKH61 = kind(CCTKH61)
      integer*8 CCTKH62
      integer, parameter :: cctki_use_CCTKH62 = kind(CCTKH62)
      integer*8 CCTKH64
      integer, parameter :: cctki_use_CCTKH64 = kind(CCTKH64)
      integer*8 CCTKH86
      integer, parameter :: cctki_use_CCTKH86 = kind(CCTKH86)
      integer*8 CCTKH88
      integer, parameter :: cctki_use_CCTKH88 = kind(CCTKH88)
      integer*8 CCTKH90
      integer, parameter :: cctki_use_CCTKH90 = kind(CCTKH90)
      integer*8 CCTKH92
      integer, parameter :: cctki_use_CCTKH92 = kind(CCTKH92)
      integer*8 CCTKH93
      integer, parameter :: cctki_use_CCTKH93 = kind(CCTKH93)
      integer*8 CCTKH96
      integer, parameter :: cctki_use_CCTKH96 = kind(CCTKH96)
      INTEGER*4 CCTKH39
      integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
      INTEGER*4 CCTKH40
      integer, parameter :: cctki_use_CCTKH40 = kind(CCTKH40)
      INTEGER*4 CCTKH43
      integer, parameter :: cctki_use_CCTKH43 = kind(CCTKH43)
      INTEGER*4 CCTKH46
      integer, parameter :: cctki_use_CCTKH46 = kind(CCTKH46)
      INTEGER*4 CCTKH47
      integer, parameter :: cctki_use_CCTKH47 = kind(CCTKH47)
      INTEGER*4 CCTKH51
      integer, parameter :: cctki_use_CCTKH51 = kind(CCTKH51)
      INTEGER*4 CCTKH52
      integer, parameter :: cctki_use_CCTKH52 = kind(CCTKH52)
      INTEGER*4 CCTKH53
      integer, parameter :: cctki_use_CCTKH53 = kind(CCTKH53)
      INTEGER*4 CCTKH55
      integer, parameter :: cctki_use_CCTKH55 = kind(CCTKH55)
      INTEGER*4 CCTKH56
      integer, parameter :: cctki_use_CCTKH56 = kind(CCTKH56)
      INTEGER*4 CCTKH57
      integer, parameter :: cctki_use_CCTKH57 = kind(CCTKH57)
      INTEGER*4 CCTKH59
      integer, parameter :: cctki_use_CCTKH59 = kind(CCTKH59)
      INTEGER*4 CCTKH63
      integer, parameter :: cctki_use_CCTKH63 = kind(CCTKH63)
      INTEGER*4 CCTKH65
      integer, parameter :: cctki_use_CCTKH65 = kind(CCTKH65)
      INTEGER*4 CCTKH66
      integer, parameter :: cctki_use_CCTKH66 = kind(CCTKH66)
      INTEGER*4 CCTKH67
      integer, parameter :: cctki_use_CCTKH67 = kind(CCTKH67)
      INTEGER*4 CCTKH69
      integer, parameter :: cctki_use_CCTKH69 = kind(CCTKH69)
      INTEGER*4 CCTKH71
      integer, parameter :: cctki_use_CCTKH71 = kind(CCTKH71)
      INTEGER*4 CCTKH73
      integer, parameter :: cctki_use_CCTKH73 = kind(CCTKH73)
      INTEGER*4 CCTKH75
      integer, parameter :: cctki_use_CCTKH75 = kind(CCTKH75)
      INTEGER*4 CCTKH77
      integer, parameter :: cctki_use_CCTKH77 = kind(CCTKH77)
      INTEGER*4 CCTKH79
      integer, parameter :: cctki_use_CCTKH79 = kind(CCTKH79)
      INTEGER*4 CCTKH81
      integer, parameter :: cctki_use_CCTKH81 = kind(CCTKH81)
      INTEGER*4 CCTKH83
      integer, parameter :: cctki_use_CCTKH83 = kind(CCTKH83)
      INTEGER*4 CCTKH85
      integer, parameter :: cctki_use_CCTKH85 = kind(CCTKH85)
      INTEGER*4 CCTKH87
      integer, parameter :: cctki_use_CCTKH87 = kind(CCTKH87)
      INTEGER*4 CCTKH89
      integer, parameter :: cctki_use_CCTKH89 = kind(CCTKH89)
      INTEGER*4 CCTKH91
      integer, parameter :: cctki_use_CCTKH91 = kind(CCTKH91)
      INTEGER*4 CCTKH94
      integer, parameter :: cctki_use_CCTKH94 = kind(CCTKH94)
      INTEGER*4 CCTKH95
      integer, parameter :: cctki_use_CCTKH95 = kind(CCTKH95)
      COMMON /IOrest/CCTKH44, CCTKH58, CCTKH68, CCTKH70, CCTKH72, CCTKH7
     &4, CCTKH76, CCTKH78, CCTKH80, CCTKH82, CCTKH84, CCTKH41, CCTKH42, 
     &CCTKH45, CCTKH48, CCTKH49, CCTKH50, CCTKH54, out_dir, CCTKH60, CCT
     &KH61, CCTKH62, CCTKH64, CCTKH86, CCTKH88, CCTKH90, CCTKH92, CCTKH9
     &3, CCTKH96, CCTKH39, CCTKH40, CCTKH43, CCTKH46, CCTKH47, CCTKH51, 
     &CCTKH52, CCTKH53, CCTKH55, CCTKH56, CCTKH57, CCTKH59, CCTKH63, CCT
     &KH65, CCTKH66, CCTKH67, CCTKH69, CCTKH71, CCTKH73, CCTKH75, CCTKH7
     &7, CCTKH79, CCTKH81, CCTKH83, CCTKH85, CCTKH87, CCTKH89, CCTKH91, 
     &CCTKH94, CCTKH95

      integer*8 cctkGH
      REAL*8 value1
      REAL*8 value2(2)
      integer openfile
      INTEGER*4 nchar
      character*(*) filename

      character*200 fullname
      character*200 filestr

c
      call CCTK_FortranString(nchar,out_dir,filestr)
      fullname = filestr(1:nchar)//"/"//filename

      if (openfile==1) then
         OPEN(UNIT= 444,FILE=fullname,STATUS="unknown")
         write(444,101) char(34),filename
 101     format(a1,a14)
         call Extract_Advertise(cctkGH,fullname)
      else
         OPEN(UNIT=444,FILE=fullname,STATUS="old",POSITION="append")
      end if

      write(444,*) value1,value2(1),value2(2)

      close(444)

      END SUBROUTINE Extract_write2
