























































































































 


































































































































































 






























































































































































































































































 



















































 










 








































































































































































































































 










                                
                                

                                
                                

                                
                                

                                





















































































subroutine EHFinder_ReInitializeControl(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_al&
  &ignment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_levf&
  &ac,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_a&
  &sh2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,X0e&
  &h_centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0generato&
  &r_arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_arr&
  &ays,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1sur&
  &face_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_length,&
  &dxg_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_len&
  &gth,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length,eh&
  &_circ_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_length,t&
  &m_mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,bet&
  &azg2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,dfzg2&
  &,dlphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_z,e&
  &h_centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_inter&
  &p,fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyyg,g&
  &yyg2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelsets,m&
  &ore_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init_co&
  &ntrol,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p_p,&
  &xg2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicing_h&
  &andle,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,coarse_dy,coarse_dz,co&
  &nformal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p,&
  &dtlapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_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,kxz_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,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface
 
  REAL*8, dimension(eh_number_level_sets) :: fmin, fmax
  INTEGER*4 :: i, j, l 
  character(len=128) :: info_message, variable_name
  character(11) :: form(4) = (/ '(a12,i1,a1)', '(a12,i2,a1)', &
                                '(a12,i3,a1)', '(a12,i4,a1)' /)


  re_init_control = 0



  if ( re_initialize_every > 0 ) then
    if ( mod(cctk_iteration,re_initialize_every) == 0 ) then
      re_init_control = 1
    end if 
  end if 
    
  if ( re_init_control == 1 ) then

  
    call CCTK_ReductionHandle ( max_handle, 'maximum' )
    if ( max_handle < 0 ) then
      call CCTK_Warn(0,43,"EHFinder_ReInitialize.F90","EHFinder",'Could not obtain a handle for maximum reduction')
    end if
    call CCTK_ReductionHandle ( min_handle, 'minimum' )
    if ( min_handle < 0 ) then
      call CCTK_Warn(0,47,"EHFinder_ReInitialize.F90","EHFinder",'Could not obtain a handle for minimum reduction')
    end if

    do l = 1, eh_number_level_sets
      select case (l)
      case (1:9)
        j = 1
      case(10:99)
        j = 2
      case(100:999)
        j = 3
      case(1000:9999)
        j = 4
      case(10000:)
        call CCTK_Warn(0,61,"EHFinder_ReInitialize.F90","EHFinder",'To many simultaneous level set functions')
      end select
      write (variable_name,form(j)) 'ehfinder::f[',l-1,']'
      call CCTK_VarIndex ( i, variable_name )
      if ( i < 0 ) then
        write (info_message,'(a9,a14,a16)') 'Variable ',variable_name, &
                                            ' does not exist'
        call CCTK_Warn(0,68,"EHFinder_ReInitialize.F90","EHFinder",info_message)
      end if
      call CCTK_Reduce ( ierr, cctkGH, -1, max_handle, 1, &
                         130, fmax(l), 1, i) 
      if ( ierr .ne. 0 ) then
        call CCTK_Warn(0,73,"EHFinder_ReInitialize.F90","EHFinder",'Reduction of fmax failed')
      end if
      call CCTK_Reduce ( ierr, cctkGH, -1, min_handle, 1, &
                         130, fmin(l), 1, i) 
      if ( ierr .ne. 0 ) then
        call CCTK_Warn(0,78,"EHFinder_ReInitialize.F90","EHFinder",'Reduction of fmin failed')
      end if
    end do

    re_init_this_level_set = .true.

  
  
    do l = 1, eh_number_level_sets
      if ( fmin(l) * fmax(l) > zero ) then
        re_init_this_level_set(l) = .false.
      end if
    end do

  
  
    if ( all ( .not. re_init_this_level_set ) ) then
      re_init_control = 0
      info_message = 'No zero-points of the level set functions.'
      info_message = trim(info_message)//' No re-initialization performed.'
      call CCTK_Info("EHFinder", trim(info_message) )
    end if

  end if

  if ( re_init_control == 1 ) then




    if ( cctk_iteration == last_called_at_iteration ) then
      re_init_control = 0
    else
      last_called_at_iteration = cctk_iteration
    end if
  end if 

  if ( re_init_control == 1 ) then

  
    if ( (CCTK_Equals( re_init_int_method, 'Euler' ) .ne. 0) ) then
      hfac = one / four
    end if

  
    if ( (CCTK_Equals( re_init_int_method, 'rk2' ) .ne. 0) ) then
      hfac = half
    end if

    niter_reinit = 0

    call CCTK_Info("EHFinder",'Re-Initialization started')
  end if

end subroutine EHFinder_ReInitializeControl

subroutine EHFinder_ReInitializeInitialize(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_l&
  &evfac,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cct&
  &k_ash2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,&
  &X0eh_centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0gener&
  &ator_arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_&
  &arrays,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1&
  &surface_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_leng&
  &th,dxg_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_&
  &length,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length&
  &,eh_circ_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_lengt&
  &h,tm_mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,&
  &betazg2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,df&
  &zg2,dlphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_&
  &z,eh_centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_in&
  &terp,fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyy&
  &g,gyyg2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelset&
  &s,more_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init&
  &_control,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p&
  &_p,xg2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicin&
  &g_handle,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,coarse_dy,coarse_dz&
  &,conformal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p&
  &_p,dtlapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,g&
  &zz,gzz_p,gzz_p_p,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi&
  &,psix,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface


  if ( re_init_control == 1 ) then

  
  
  
    ftmp = f
    fbak = f
    eh_mask_bak = eh_mask

  end if
end subroutine EHFinder_ReInitializeInitialize

subroutine EHFinder_ReInitializeRK2_1(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,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_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,X0eh_&
  &centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0generator_&
  &arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_array&
  &s,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1surfa&
  &ce_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_length,dx&
  &g_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_lengt&
  &h,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length,eh_c&
  &irc_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_length,tm_&
  &mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,betaz&
  &g2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,dfzg2,d&
  &lphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_z,eh_&
  &centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_interp,&
  &fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyyg,gyy&
  &g2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelsets,mor&
  &e_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init_cont&
  &rol,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p_p,xg&
  &2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicing_han&
  &dle,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,coarse_dy,coarse_dz,conf&
  &ormal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p,dt&
  &lapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,gzz,gz&
  &z_p,gzz_p_p,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi,psix&
  &,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface

  INTEGER*4 :: i, j, k, l
  REAL*8 :: idx, idy, idz
  REAL*8 :: al, ar, bl, br, cl, cr
  REAL*8 :: alminus, alplus, blminus, blplus, clminus, clplus
  REAL*8 :: arminus, arplus, brminus, brplus, crminus, crplus









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




ngx = cctk_nghostzones(1)
ngy = cctk_nghostzones(2)
ngz = cctk_nghostzones(3)





symx = .false.; symy = .false.; symz = .false.;

ixl = 1
ixr = nx
jyl = 1
jyr = ny
kzl = 1
kzr = nz




if ( cctk_bbox(1) .eq. 0 ) ixl = ixl + ngx
if ( cctk_bbox(2) .eq. 0 ) ixr = ixr - ngx

if ( cctk_bbox(3) .eq. 0 ) jyl = jyl + ngy
if ( cctk_bbox(4) .eq. 0 ) jyr = jyr - ngy

if ( cctk_bbox(5) .eq. 0 ) kzl = kzl + ngz
if ( cctk_bbox(6) .eq. 0 ) kzr = kzr - ngz








if ( (CCTK_Equals( domain, 'octant' ) .ne. 0) ) then
  if (cctk_lbnd(1) .eq. 0 ) then
    ixl = ixl + ngx
    symx = .true.
  end if
  if (cctk_lbnd(2) .eq. 0 ) then
    jyl = jyl + ngy
    symy = .true.
  end if
  if (cctk_lbnd(3) .eq. 0 ) then
    kzl = kzl + ngz
    symz = .true.
  end if
end if




if ( (CCTK_Equals( domain, 'quadrant' ) .ne. 0) ) then
  if ( (CCTK_Equals( quadrant_direction, 'x' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction, 'y' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction,'z' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  end if
end if



if ( (CCTK_Equals( domain, 'bitant' ) .ne. 0) ) then
  if ( (CCTK_Equals( bitant_plane, 'xy' ) .ne. 0) ) then
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'xz' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'yz' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
  endif
end if







  h = hfac*min((cctk_delta_space(1)/cctk_levfac(1)),(cctk_delta_space(2)/cctk_levfac(2)),(cctk_delta_space(3)/cctk_levfac(3)))


  if ( (CCTK_Equals( pde_differences, 'centered' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    dfx(i,j,k,l) = idx * ( f(i+1,j,k,l) - f(i-1,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    dfx(i,j,k,l) = idx * ( -three * f(i,j,k,l) + &
                          four * f(i+1,j,k,l) - f(i+2,j,k,l) )
  else
    dfx(i,j,k,l) = idx * ( three * f(i,j,k,l) - &
                         four * f(i-1,j,k,l) + f(i-2,j,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    dfy(i,j,k,l) = idy * ( f(i,j+1,k,l) - f(i,j-1,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    dfy(i,j,k,l) = idy * ( -three * f(i,j,k,l) + &
                          four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    dfy(i,j,k,l) = idy * ( three * f(i,j,k,l) - &
                          four * f(i,j-1,k,l) + f(i,j-2,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    dfz(i,j,k,l) = idz * ( f(i,j,k+1,l) - f(i,j,k-1,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    dfz(i,j,k,l) = idz * ( -three * f(i,j,k,l) + &
                           four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    dfz(i,j,k,l) = idz * ( three * f(i,j,k,l) - &
                          four * f(i,j,k-1,l) + f(i,j,k-2,l) )
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind' ) .ne. 0) ) then



    idx = one / (cctk_delta_space(1)/cctk_levfac(1))
    idy = one / (cctk_delta_space(2)/cctk_levfac(2))
    idz = one / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = 1, nz
        do j = 1, ny
          do i = 1, nx




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    al = zero
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = zero
  end if

  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind2' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr







if ( eh_mask(i,j,k,l) .ge. 0 ) then

  
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then

    
    if ( ( .not. btest(eh_mask(i-1,j,k,l),0) ) .or. &
               ( eh_mask(i-1,j,k,l) .eq. -2 ) ) then

      
      al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    else
      al = zero
    end if

    
    if ( ( .not. btest(eh_mask(i+1,j,k,l),1) ) .or. &
               ( eh_mask(i+1,j,k,l) .eq. -2 ) ) then 

      
      ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )
    else
      ar = zero
    end if

  
  else if ( btest(eh_mask(i,j,k,l),0) ) then

    
    al = zero
    ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )

  
  else

    
    al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    ar = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    if ( ( .not. btest(eh_mask(i,j-1,k,l),2) ) .or. &
               ( eh_mask(i,j-1,k,l) .eq. -2 ) ) then
      bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    else
      bl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j+1,k,l),3) ) .or. &
               ( eh_mask(i,j+1,k,l) .eq. -2 ) ) then 
      br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
    else
      br = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    br = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    if ( ( .not. btest(eh_mask(i,j,k-1,l),4) ) .or. &
               ( eh_mask(i,j,k-1,l) .eq. -2 ) ) then
      cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    else
      cl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j,k+1,l),5) ) .or. &
               ( eh_mask(i,j,k+1,l) .eq. -2 ) ) then 
      cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
    else
      cr = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    cr = zero
  end if

  
  
  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  
  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  
  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  
  
  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  
  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if


else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  where ( eh_mask >= 0 )
    sftmp =  sqrt( dfx**2 + dfy**2 + dfz**2 )
    sftmp = - half * h * f / sqrt(f**2+one) * ( sftmp - one )
    f = f + sftmp
  elsewhere
    sftmp = zero
  end where

end subroutine EHFinder_ReInitializeRK2_1


subroutine EHFinder_ReInitializeRK2_2(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,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_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,X0eh_&
  &centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0generator_&
  &arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_array&
  &s,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1surfa&
  &ce_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_length,dx&
  &g_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_lengt&
  &h,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length,eh_c&
  &irc_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_length,tm_&
  &mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,betaz&
  &g2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,dfzg2,d&
  &lphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_z,eh_&
  &centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_interp,&
  &fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyyg,gyy&
  &g2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelsets,mor&
  &e_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init_cont&
  &rol,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p_p,xg&
  &2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicing_han&
  &dle,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,coarse_dy,coarse_dz,conf&
  &ormal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p,dt&
  &lapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,gzz,gz&
  &z_p,gzz_p_p,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi,psix&
  &,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface

  INTEGER*4 :: i, j, k, l
  REAL*8 :: idx, idy, idz
  REAL*8, dimension(eh_number_level_sets) :: maxdfloc, maxdf, &
                                                mindfloc, mindf
  REAL*8 :: al, ar, bl, br, cl, cr
  REAL*8 :: alminus, alplus, blminus, blplus, clminus, clplus
  REAL*8 :: arminus, arplus, brminus, brplus, crminus, crplus
  character(len=128) :: info_message








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




ngx = cctk_nghostzones(1)
ngy = cctk_nghostzones(2)
ngz = cctk_nghostzones(3)





symx = .false.; symy = .false.; symz = .false.;

ixl = 1
ixr = nx
jyl = 1
jyr = ny
kzl = 1
kzr = nz




if ( cctk_bbox(1) .eq. 0 ) ixl = ixl + ngx
if ( cctk_bbox(2) .eq. 0 ) ixr = ixr - ngx

if ( cctk_bbox(3) .eq. 0 ) jyl = jyl + ngy
if ( cctk_bbox(4) .eq. 0 ) jyr = jyr - ngy

if ( cctk_bbox(5) .eq. 0 ) kzl = kzl + ngz
if ( cctk_bbox(6) .eq. 0 ) kzr = kzr - ngz








if ( (CCTK_Equals( domain, 'octant' ) .ne. 0) ) then
  if (cctk_lbnd(1) .eq. 0 ) then
    ixl = ixl + ngx
    symx = .true.
  end if
  if (cctk_lbnd(2) .eq. 0 ) then
    jyl = jyl + ngy
    symy = .true.
  end if
  if (cctk_lbnd(3) .eq. 0 ) then
    kzl = kzl + ngz
    symz = .true.
  end if
end if




if ( (CCTK_Equals( domain, 'quadrant' ) .ne. 0) ) then
  if ( (CCTK_Equals( quadrant_direction, 'x' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction, 'y' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction,'z' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  end if
end if



if ( (CCTK_Equals( domain, 'bitant' ) .ne. 0) ) then
  if ( (CCTK_Equals( bitant_plane, 'xy' ) .ne. 0) ) then
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'xz' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'yz' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
  endif
end if






  if ( (CCTK_Equals( pde_differences, 'centered' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    dfx(i,j,k,l) = idx * ( f(i+1,j,k,l) - f(i-1,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    dfx(i,j,k,l) = idx * ( -three * f(i,j,k,l) + &
                          four * f(i+1,j,k,l) - f(i+2,j,k,l) )
  else
    dfx(i,j,k,l) = idx * ( three * f(i,j,k,l) - &
                         four * f(i-1,j,k,l) + f(i-2,j,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    dfy(i,j,k,l) = idy * ( f(i,j+1,k,l) - f(i,j-1,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    dfy(i,j,k,l) = idy * ( -three * f(i,j,k,l) + &
                          four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    dfy(i,j,k,l) = idy * ( three * f(i,j,k,l) - &
                          four * f(i,j-1,k,l) + f(i,j-2,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    dfz(i,j,k,l) = idz * ( f(i,j,k+1,l) - f(i,j,k-1,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    dfz(i,j,k,l) = idz * ( -three * f(i,j,k,l) + &
                           four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    dfz(i,j,k,l) = idz * ( three * f(i,j,k,l) - &
                          four * f(i,j,k-1,l) + f(i,j,k-2,l) )
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind' ) .ne. 0) ) then



    idx = one / (cctk_delta_space(1)/cctk_levfac(1))
    idy = one / (cctk_delta_space(2)/cctk_levfac(2))
    idz = one / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    al = zero
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = zero
  end if

  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind2' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr







if ( eh_mask(i,j,k,l) .ge. 0 ) then

  
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then

    
    if ( ( .not. btest(eh_mask(i-1,j,k,l),0) ) .or. &
               ( eh_mask(i-1,j,k,l) .eq. -2 ) ) then

      
      al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    else
      al = zero
    end if

    
    if ( ( .not. btest(eh_mask(i+1,j,k,l),1) ) .or. &
               ( eh_mask(i+1,j,k,l) .eq. -2 ) ) then 

      
      ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )
    else
      ar = zero
    end if

  
  else if ( btest(eh_mask(i,j,k,l),0) ) then

    
    al = zero
    ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )

  
  else

    
    al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    ar = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    if ( ( .not. btest(eh_mask(i,j-1,k,l),2) ) .or. &
               ( eh_mask(i,j-1,k,l) .eq. -2 ) ) then
      bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    else
      bl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j+1,k,l),3) ) .or. &
               ( eh_mask(i,j+1,k,l) .eq. -2 ) ) then 
      br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
    else
      br = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    br = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    if ( ( .not. btest(eh_mask(i,j,k-1,l),4) ) .or. &
               ( eh_mask(i,j,k-1,l) .eq. -2 ) ) then
      cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    else
      cl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j,k+1,l),5) ) .or. &
               ( eh_mask(i,j,k+1,l) .eq. -2 ) ) then 
      cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
    else
      cr = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    cr = zero
  end if

  
  
  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  
  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  
  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  
  
  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  
  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if


else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if



  where ( eh_mask >= 0 )
    sftmp =  sqrt( dfx**2 + dfy**2 + dfz**2 )
    sftmp = - h * f / sqrt(f**2+one) * ( sftmp - one )
    f = ftmp + sftmp
  elsewhere
    sftmp = zero
  end where



  do l = 1, eh_number_level_sets
    maxdfloc(l) = maxval ( abs(sftmp(ixl:ixr,jyl:jyr,kzl:kzr,l)), &
                             mask = eh_mask(ixl:ixr,jyl:jyr,kzl:kzr,l) >= 0)
    mindfloc(l) = minval ( abs(sftmp(ixl:ixr,jyl:jyr,kzl:kzr,l)), &
                             mask = eh_mask(ixl:ixr,jyl:jyr,kzl:kzr,l) >= 0)
  end do



  call CCTK_ReduceLocArrayToArray1D ( ierr, cctkGH, -1, max_handle, &
                                    maxdfloc, maxdf, eh_number_level_sets, &
                                    130 )
  if ( ierr .ne. 0 ) then
    call CCTK_Warn(0,364,"EHFinder_ReInitialize.F90","EHFinder",'Reduction of maxdf failed')
  end if



  call CCTK_ReduceLocArrayToArray1D ( ierr, cctkGH, -1, min_handle, &
                                    mindfloc, mindf, eh_number_level_sets, &
                                    130 )
  if ( ierr .ne. 0 ) then
    call CCTK_Warn(0,373,"EHFinder_ReInitialize.F90","EHFinder",'Reduction of mindf failed')
  end if



  if ( all ( maxdf < h*min((cctk_delta_space(1)/cctk_levfac(1)),(cctk_delta_space(2)/cctk_levfac(2)), &
                           (cctk_delta_space(3)/cctk_levfac(3)))**2 ) ) then

    re_init_control = 0
  end if


  niter_reinit = niter_reinit + 1



  if ( re_init_control == 0 ) then
    write(info_message,'(a35,i5,a12)') &
        'PDE re-initialization complete in ',niter_reinit,' iterations.'
    call CCTK_Info("EHFinder", trim(info_message) )
  end if



  if ( niter_reinit > re_init_max_iter ) then
    call CCTK_Warn(1,398,"EHFinder_ReInitialize.F90","EHFinder",'Re-initialization failed to converge')

    re_init_control = 0
  end if



  ftmp = f

end subroutine EHFinder_ReInitializeRK2_2


subroutine EHFinder_ReInitializeEuler(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_alig&
  &nment,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_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_ash&
  &2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,X0eh_&
  &centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0generator_&
  &arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_array&
  &s,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1surfa&
  &ce_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_length,dx&
  &g_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_lengt&
  &h,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length,eh_c&
  &irc_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_length,tm_&
  &mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,betaz&
  &g2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,dfzg2,d&
  &lphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_z,eh_&
  &centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_interp,&
  &fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyyg,gyy&
  &g2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelsets,mor&
  &e_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init_cont&
  &rol,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p_p,xg&
  &2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicing_han&
  &dle,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,coarse_dy,coarse_dz,conf&
  &ormal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p,dt&
  &lapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_p,gxy_p_p,gxz,gxz_p,gxz_p_p,gyy,gyy_p,gyy_p_p,gyz,gyz_p,gyz_p_p,gzz,gz&
  &z_p,gzz_p_p,kxx,kxx_p,kxx_p_p,kxy,kxy_p,kxy_p_p,kxz,kxz_p,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi,psix&
  &,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface

  INTEGER*4 :: i, j, k, l
  REAL*8 :: idx, idy, idz
  REAL*8 :: al, ar, bl, br, cl, cr
  REAL*8 :: alminus, alplus, blminus, blplus, clminus, clplus
  REAL*8 :: arminus, arplus, brminus, brplus, crminus, crplus









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




ngx = cctk_nghostzones(1)
ngy = cctk_nghostzones(2)
ngz = cctk_nghostzones(3)





symx = .false.; symy = .false.; symz = .false.;

ixl = 1
ixr = nx
jyl = 1
jyr = ny
kzl = 1
kzr = nz




if ( cctk_bbox(1) .eq. 0 ) ixl = ixl + ngx
if ( cctk_bbox(2) .eq. 0 ) ixr = ixr - ngx

if ( cctk_bbox(3) .eq. 0 ) jyl = jyl + ngy
if ( cctk_bbox(4) .eq. 0 ) jyr = jyr - ngy

if ( cctk_bbox(5) .eq. 0 ) kzl = kzl + ngz
if ( cctk_bbox(6) .eq. 0 ) kzr = kzr - ngz








if ( (CCTK_Equals( domain, 'octant' ) .ne. 0) ) then
  if (cctk_lbnd(1) .eq. 0 ) then
    ixl = ixl + ngx
    symx = .true.
  end if
  if (cctk_lbnd(2) .eq. 0 ) then
    jyl = jyl + ngy
    symy = .true.
  end if
  if (cctk_lbnd(3) .eq. 0 ) then
    kzl = kzl + ngz
    symz = .true.
  end if
end if




if ( (CCTK_Equals( domain, 'quadrant' ) .ne. 0) ) then
  if ( (CCTK_Equals( quadrant_direction, 'x' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction, 'y' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  end if
  if ( (CCTK_Equals( quadrant_direction,'z' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  end if
end if



if ( (CCTK_Equals( domain, 'bitant' ) .ne. 0) ) then
  if ( (CCTK_Equals( bitant_plane, 'xy' ) .ne. 0) ) then
    if (cctk_lbnd(3) .eq. 0 ) then
      kzl = kzl + ngz
      symz = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'xz' ) .ne. 0) ) then
    if (cctk_lbnd(2) .eq. 0 ) then
      jyl = jyl + ngy
      symy = .true.
    end if
  endif
  if ( (CCTK_Equals( bitant_plane, 'yz' ) .ne. 0) ) then
    if (cctk_lbnd(1) .eq. 0 ) then
      ixl = ixl + ngx
      symx = .true.
    end if
  endif
end if







  h = hfac*min((cctk_delta_space(1)/cctk_levfac(1)),(cctk_delta_space(2)/cctk_levfac(2)),(cctk_delta_space(3)/cctk_levfac(3)))


  if ( (CCTK_Equals( pde_differences, 'centered' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    dfx(i,j,k,l) = idx * ( f(i+1,j,k,l) - f(i-1,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    dfx(i,j,k,l) = idx * ( -three * f(i,j,k,l) + &
                          four * f(i+1,j,k,l) - f(i+2,j,k,l) )
  else
    dfx(i,j,k,l) = idx * ( three * f(i,j,k,l) - &
                         four * f(i-1,j,k,l) + f(i-2,j,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    dfy(i,j,k,l) = idy * ( f(i,j+1,k,l) - f(i,j-1,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    dfy(i,j,k,l) = idy * ( -three * f(i,j,k,l) + &
                          four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    dfy(i,j,k,l) = idy * ( three * f(i,j,k,l) - &
                          four * f(i,j-1,k,l) + f(i,j-2,k,l) )
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    dfz(i,j,k,l) = idz * ( f(i,j,k+1,l) - f(i,j,k-1,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    dfz(i,j,k,l) = idz * ( -three * f(i,j,k,l) + &
                           four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    dfz(i,j,k,l) = idz * ( three * f(i,j,k,l) - &
                          four * f(i,j,k-1,l) + f(i,j,k-2,l) )
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind' ) .ne. 0) ) then



    idx = one / (cctk_delta_space(1)/cctk_levfac(1))
    idy = one / (cctk_delta_space(2)/cctk_levfac(2))
    idz = one / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr




if ( eh_mask(i,j,k,l) .ge. 0 ) then
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),0) ) then
    al = zero
    ar = idx * ( f(i+1,j,k,l) - f(i,j,k,l) )
  else
    al = idx * ( f(i,j,k,l) - f(i-1,j,k,l) )
    ar = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( f(i,j+1,k,l) - f(i,j,k,l) )
  else
    bl = idy * ( f(i,j,k,l) - f(i,j-1,k,l) )
    br = zero
  end if
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( f(i,j,k+1,l) - f(i,j,k,l) )
  else
    cl = idz * ( f(i,j,k,l) - f(i,j,k-1,l) )
    cr = zero
  end if

  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if
else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  if ( (CCTK_Equals( pde_differences, 'upwind2' ) .ne. 0) ) then



    idx = half / (cctk_delta_space(1)/cctk_levfac(1))
    idy = half / (cctk_delta_space(2)/cctk_levfac(2))
    idz = half / (cctk_delta_space(3)/cctk_levfac(3))


    do l = 1, eh_number_level_sets
      do k = kzl, kzr
        do j = jyl, jyr
          do i = ixl, ixr







if ( eh_mask(i,j,k,l) .ge. 0 ) then

  
  if ( ( .not. btest(eh_mask(i,j,k,l),0) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),1) ) ) then

    
    if ( ( .not. btest(eh_mask(i-1,j,k,l),0) ) .or. &
               ( eh_mask(i-1,j,k,l) .eq. -2 ) ) then

      
      al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    else
      al = zero
    end if

    
    if ( ( .not. btest(eh_mask(i+1,j,k,l),1) ) .or. &
               ( eh_mask(i+1,j,k,l) .eq. -2 ) ) then 

      
      ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )
    else
      ar = zero
    end if

  
  else if ( btest(eh_mask(i,j,k,l),0) ) then

    
    al = zero
    ar = idx * ( - three * f(i,j,k,l) + four * f(i+1,j,k,l) - f(i+2,j,k,l) )

  
  else

    
    al = idx * ( three * f(i,j,k,l) - four * f(i-1,j,k,l) + f(i-2,j,k,l) )
    ar = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),2) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),3) ) ) then
    if ( ( .not. btest(eh_mask(i,j-1,k,l),2) ) .or. &
               ( eh_mask(i,j-1,k,l) .eq. -2 ) ) then
      bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    else
      bl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j+1,k,l),3) ) .or. &
               ( eh_mask(i,j+1,k,l) .eq. -2 ) ) then 
      br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
    else
      br = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),2) ) then
    bl = zero
    br = idy * ( - three * f(i,j,k,l) + four * f(i,j+1,k,l) - f(i,j+2,k,l) )
  else
    bl = idy * ( three * f(i,j,k,l) - four * f(i,j-1,k,l) + f(i,j-2,k,l) )
    br = zero
  end if

  
  if ( ( .not. btest(eh_mask(i,j,k,l),4) ) .and. &
       ( .not. btest(eh_mask(i,j,k,l),5) ) ) then
    if ( ( .not. btest(eh_mask(i,j,k-1,l),4) ) .or. &
               ( eh_mask(i,j,k-1,l) .eq. -2 ) ) then
      cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    else
      cl = zero
    end if
    if ( ( .not. btest(eh_mask(i,j,k+1,l),5) ) .or. &
               ( eh_mask(i,j,k+1,l) .eq. -2 ) ) then 
      cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
    else
      cr = zero
    end if
  else if ( btest(eh_mask(i,j,k,l),4) ) then
    cl = zero
    cr = idz * ( - three * f(i,j,k,l) + four * f(i,j,k+1,l) - f(i,j,k+2,l) )
  else
    cl = idz * ( three * f(i,j,k,l) - four * f(i,j,k-1,l) + f(i,j,k-2,l) )
    cr = zero
  end if

  
  
  alminus = half*(al-abs(al))
  alplus = half*(al+abs(al))
  arminus = half*(ar-abs(ar))
  arplus = half*(ar+abs(ar))

  
  blminus = half*(bl-abs(bl))
  blplus = half*(bl+abs(bl))
  brminus = half*(br-abs(br))
  brplus = half*(br+abs(br))

  
  clminus = half*(cl-abs(cl))
  clplus = half*(cl+abs(cl))
  crminus = half*(cr-abs(cr))
  crplus = half*(cr+abs(cr))

  
  
  if ( f(i,j,k,l) .gt. 0 ) then
    if ( abs(alplus) .gt. abs(arminus) ) then
      dfx(i,j,k,l) = alplus
    else
      dfx(i,j,k,l) = arminus
    end if
    if ( abs(blplus) .gt. abs(brminus) ) then
      dfy(i,j,k,l) = blplus
    else
      dfy(i,j,k,l) = brminus
    end if
    if ( abs(clplus) .gt. abs(crminus) ) then
      dfz(i,j,k,l) = clplus
    else
      dfz(i,j,k,l) = crminus
    end if
  endif

  
  if ( f(i,j,k,l) .lt. 0 ) then
    if ( abs(alminus) .gt. abs(arplus) ) then
      dfx(i,j,k,l) = alminus
    else
      dfx(i,j,k,l) = arplus
    end if
    if ( abs(blminus) .gt. abs(brplus) ) then
      dfy(i,j,k,l) = blminus
    else
      dfy(i,j,k,l) = brplus
    end if
    if ( abs(clminus) .gt. abs(crplus) ) then
      dfz(i,j,k,l) = clminus
    else
      dfz(i,j,k,l) = crplus
    end if
  end if


else
  dfx(i,j,k,l) = zero
  dfy(i,j,k,l) = zero
  dfz(i,j,k,l) = zero
end if
          end do
        end do
      end do
    end do
  end if


  where ( eh_mask >= 0 )
    sftmp =  sqrt( dfx**2 + dfy**2 + dfz**2 )
    sftmp =  - h * f / sqrt(f**2+one) * ( sftmp - one )
    f = f + sftmp
  elsewhere
    sftmp = zero
  end where
  



  sftmp = abs ( sftmp ) / ( h*min((cctk_delta_space(1)/cctk_levfac(1)),(cctk_delta_space(2)/cctk_levfac(2)), &
                                  (cctk_delta_space(3)/cctk_levfac(3)))**2 )

end subroutine EHFinder_ReInitializeEuler

subroutine EHFinder_ReInitializePostStep(cctk_dim,cctk_gsh,cctk_lsh,cctk_lbnd,cctk_ubnd,cctk_tile_min,cctk_tile_max,cctk_ash,cctk_a&
  &lignment,cctk_alignment_offset,cctk_from,cctk_to,cctk_bbox,cctk_delta_time,cctk_time,cctk_delta_space,cctk_origin_space,cctk_lev&
  &fac,cctk_levoff,cctk_levoffdenom,cctk_timefac,cctk_convlevel,cctk_convfac,cctk_nghostzones,cctk_iteration,cctkGH,cctk_ash1,cctk_&
  &ash2,cctk_ash3, X0center_arrays,X0dxg,X0dxg2,X0dyg,X0dyg2,X0dzg,X0dzg2,X0eh_area,X0eh_area2,X0eh_centroid2_x,X0eh_centroid2_y,X0&
  &eh_centroid2_z,X0eh_centroid_x,X0eh_centroid_y,X0eh_centroid_z,X0eh_circ_eq,X0eh_circ_eq2,X0eh_circ_pol,X0eh_circ_pol2,X0generat&
  &or_arrays,X0generator_arrays2,X0integrate_tmp_array,X0interp_metric_arrays,X0surface_arrays,X0surface_int_array,X0surface_tmp_ar&
  &rays,X0xg,X0xg2,X0yg,X0yg2,X0zg,X0zg2,X1dxg2,X1dyg2,X1dzg2,X1generator_arrays2,X1integrate_tmp_array,X1interp_metric_arrays,X1su&
  &rface_arrays,X1surface_int_array,X1surface_tmp_arrays,X1xg2,X1yg2,X1zg2,dfsq_length,dfx_length,dfy_length,dfz_length,dxg2_length&
  &,dxg_length,dyg2_length,dyg_length,dzg2_length,dzg_length,eh_area2_length,eh_area_length,eh_centroid2_x_length,eh_centroid2_y_le&
  &ngth,eh_centroid2_z_length,eh_centroid_x_length,eh_centroid_y_length,eh_centroid_z_length,eh_circ_eq2_length,eh_circ_eq_length,e&
  &h_circ_pol2_length,eh_circ_pol_length,eh_mask_bak_length,eh_mask_length,f_length,fbak_length,ftmp_length,sf_length,sftmp_length,&
  &tm_mask_length,xg2_length,xg_length,yg2_length,yg_length,zg2_length,zg_length,alpg,alpg2,betaxg,betaxg2,betayg,betayg2,betazg,be&
  &tazg2,center,cosphi,costheta,cphi,ctheta,da,dfdx_interp,dfdy_interp,dfdz_interp,dfsq,dfx,dfxg,dfxg2,dfy,dfyg,dfyg2,dfz,dfzg,dfzg&
  &2,dlphi,dltheta,drdphi,drdtheta,drsurf,dxg,dxg2,dyg,dyg2,dzg,dzg2,eh_area,eh_area2,eh_centroid2_x,eh_centroid2_y,eh_centroid2_z,&
  &eh_centroid_x,eh_centroid_y,eh_centroid_z,eh_circ_eq,eh_circ_eq2,eh_circ_pol,eh_circ_pol2,eh_mask,eh_mask_bak,f,f_p,f_p_p,f_inte&
  &rp,fbak,find_surface_status,ftmp,g3xx,g3xy,g3xz,g3yy,g3yz,g3zz,gpp,gtp,gtt,gxxg,gxxg2,gxxi,gxyg,gxyg2,gxyi,gxzg,gxzg2,gxzi,gyyg,&
  &gyyg2,gyyi,gyzg,gyzg2,gyzi,gzzg,gzzg2,gzzi,int_tmp,integrate_counter,interp_x,interp_y,interp_z,levelset_counter,more_levelsets,&
  &more_points,more_surfaces,n_since_last_reduction,niter_reinit,phi_sym_factor,phiweights,points_counter,psig,psig2,psii,re_init_c&
  &ontrol,rsurf,sc,sf,sftmp,sinphi,sintheta,surface_counter,sym_factor,theta_sym_factor,thetaweights,tm_mask,weights,xg,xg_p,xg_p_p&
  &,xg2,xg2_p,xg2_p_p,xgf,xgf2,yg,yg_p,yg_p_p,yg2,yg2_p,yg2_p_p,ygf,ygf2,zg,zg_p,zg_p_p,zg2,zg2_p,zg2_p_p,zgf,zgf2, active_slicing_&
  &handle,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,coarse_dy,coarse_dz,c&
  &onformal_state,dtalp,dtalp_p,dtalp_p_p,dtbetax,dtbetax_p,dtbetax_p_p,dtbetay,dtbetay_p,dtbetay_p_p,dtbetaz,dtbetaz_p,dtbetaz_p_p&
  &,dtlapse_state,dtshift_state,emask,gxx,gxx_p,gxx_p_p,gxy,gxy_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,kxz_p_p,kyy,kyy_p,kyy_p_p,kyz,kyz_p,kyz_p_p,kzz,kzz_p,kzz_p_p,psi,p&
  &six,psixx,psixy,psixz,psiy,psiyy,psiyz,psiz,psizz,r,shift_state,space_mask,x,y,z)

  use EHFinder_mod

  implicit none

  INTEGER*4 EHFinder_MaxNumEvolvedVars
  integer, parameter :: cctki_use_EHFinder_MaxNumEvolvedVars = kind(EHFinder_MaxNumEvolvedVars)
  INTEGER*4 EHFinder_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_EHFinder_Max_Evolved_Array_Size = kind(EHFinder_Max_Evolved_Array_Size)
  INTEGER*4 EHFinder_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_EHFinder_Num_ArrayEvolved_Vars = kind(EHFinder_Num_ArrayEvolved_Vars)
  COMMON /ehfinderrest/EHFinder_MaxNumEvolvedVars, EHFinder_Max_Evolved_Array_Size, EHFinder_Num_ArrayEvolved_Vars
  REAL*8 cas_a (10)
  integer, parameter :: cctki_use_cas_a = kind(cas_a)
  REAL*8 cas_b (10)
  integer, parameter :: cctki_use_cas_b = kind(cas_b)
  REAL*8 center_x
  integer, parameter :: cctki_use_center_x = kind(center_x)
  REAL*8 center_y
  integer, parameter :: cctki_use_center_y = kind(center_y)
  REAL*8 center_z
  integer, parameter :: cctki_use_center_z = kind(center_z)
  REAL*8 initial_a (10)
  integer, parameter :: cctki_use_initial_a = kind(initial_a)
  REAL*8 initial_b (10)
  integer, parameter :: cctki_use_initial_b = kind(initial_b)
  REAL*8 initial_c (10)
  integer, parameter :: cctki_use_initial_c = kind(initial_c)
  REAL*8 initial_rad (10)
  integer, parameter :: cctki_use_initial_rad = kind(initial_rad)
  REAL*8 rotation_alpha (10)
  integer, parameter :: cctki_use_rotation_alpha = kind(rotation_alpha)
  REAL*8 rotation_beta (10)
  integer, parameter :: cctki_use_rotation_beta = kind(rotation_beta)
  REAL*8 rotation_gamma (10)
  integer, parameter :: cctki_use_rotation_gamma = kind(rotation_gamma)
  REAL*8 shell_width
  integer, parameter :: cctki_use_shell_width = kind(shell_width)
  REAL*8 translate_x (10)
  integer, parameter :: cctki_use_translate_x = kind(translate_x)
  REAL*8 translate_y (10)
  integer, parameter :: cctki_use_translate_y = kind(translate_y)
  REAL*8 translate_z (10)
  integer, parameter :: cctki_use_translate_z = kind(translate_z)
  integer*8 area_calculation_method
  integer, parameter :: cctki_use_area_calculation_method = kind(area_calculation_method)
  integer*8 area_interpolator
  integer, parameter :: cctki_use_area_interpolator = kind(area_interpolator)
  integer*8 eh_lapse_type
  integer, parameter :: cctki_use_eh_lapse_type = kind(eh_lapse_type)
  integer*8 eh_metric_type
  integer, parameter :: cctki_use_eh_metric_type = kind(eh_metric_type)
  integer*8 eh_shift_type
  integer, parameter :: cctki_use_eh_shift_type = kind(eh_shift_type)
  integer*8 file_type
  integer, parameter :: cctki_use_file_type = kind(file_type)
  integer*8 generator_distribution
  integer, parameter :: cctki_use_generator_distribution = kind(generator_distribution)
  integer*8 generator_interpolator
  integer, parameter :: cctki_use_generator_interpolator = kind(generator_interpolator)
  integer*8 generator_tracking_method
  integer, parameter :: cctki_use_generator_tracking_method = kind(generator_tracking_method)
  integer*8 initial_f (10)
  integer, parameter :: cctki_use_initial_f = kind(initial_f)
  integer*8 mode
  integer, parameter :: cctki_use_mode = kind(mode)
  integer*8 pde_differences
  integer, parameter :: cctki_use_pde_differences = kind(pde_differences)
  integer*8 re_init_int_method
  integer, parameter :: cctki_use_re_init_int_method = kind(re_init_int_method)
  integer*8 surface_direction
  integer, parameter :: cctki_use_surface_direction = kind(surface_direction)
  integer*8 surface_interpolator
  integer, parameter :: cctki_use_surface_interpolator = kind(surface_interpolator)
  integer*8 upwind_type
  integer, parameter :: cctki_use_upwind_type = kind(upwind_type)
  INTEGER*4 area_interpolation_order
  integer, parameter :: cctki_use_area_interpolation_order = kind(area_interpolation_order)
  INTEGER*4 cheat
  integer, parameter :: cctki_use_cheat = kind(cheat)
  INTEGER*4 cheat_iterations
  integer, parameter :: cctki_use_cheat_iterations = kind(cheat_iterations)
  INTEGER*4 eh_number_level_sets
  integer, parameter :: cctki_use_eh_number_level_sets = kind(eh_number_level_sets)
  INTEGER*4 evolve_generators
  integer, parameter :: cctki_use_evolve_generators = kind(evolve_generators)
  INTEGER*4 generator_interpolation_order
  integer, parameter :: cctki_use_generator_interpolation_order = kind(generator_interpolation_order)
  INTEGER*4 last_iteration_number
  integer, parameter :: cctki_use_last_iteration_number = kind(last_iteration_number)
  INTEGER*4 maximum_surface_number
  integer, parameter :: cctki_use_maximum_surface_number = kind(maximum_surface_number)
  INTEGER*4 n_array_ghosts
  integer, parameter :: cctki_use_n_array_ghosts = kind(n_array_ghosts)
  INTEGER*4 nphi
  integer, parameter :: cctki_use_nphi = kind(nphi)
  INTEGER*4 ntheta
  integer, parameter :: cctki_use_ntheta = kind(ntheta)
  INTEGER*4 number_of_generators
  integer, parameter :: cctki_use_number_of_generators = kind(number_of_generators)
  INTEGER*4 number_of_generators_phi
  integer, parameter :: cctki_use_number_of_generators_phi = kind(number_of_generators_phi)
  INTEGER*4 number_of_generators_theta
  integer, parameter :: cctki_use_number_of_generators_theta = kind(number_of_generators_theta)
  INTEGER*4 re_init_max_iter
  integer, parameter :: cctki_use_re_init_max_iter = kind(re_init_max_iter)
  INTEGER*4 re_init_undo
  integer, parameter :: cctki_use_re_init_undo = kind(re_init_undo)
  INTEGER*4 re_init_verbose
  integer, parameter :: cctki_use_re_init_verbose = kind(re_init_verbose)
  INTEGER*4 re_initialize_every
  integer, parameter :: cctki_use_re_initialize_every = kind(re_initialize_every)
  INTEGER*4 read_conformal_factor_once
  integer, parameter :: cctki_use_read_conformal_factor_once = kind(read_conformal_factor_once)
  INTEGER*4 saved_iteration_every
  integer, parameter :: cctki_use_saved_iteration_every = kind(saved_iteration_every)
  INTEGER*4 surface_interpolation_order
  integer, parameter :: cctki_use_surface_interpolation_order = kind(surface_interpolation_order)
  INTEGER*4 use_inner_excision
  integer, parameter :: cctki_use_use_inner_excision = kind(use_inner_excision)
  INTEGER*4 use_outer_excision
  integer, parameter :: cctki_use_use_outer_excision = kind(use_outer_excision)
  INTEGER*4 use_user_center
  integer, parameter :: cctki_use_use_user_center = kind(use_user_center)
  COMMON /EHFinderpriv/cas_a, cas_b, center_x, center_y, center_z, initial_a, initial_b, initial_c, initial_rad, rotation_alpha, ro&
  &tation_beta, rotation_gamma, shell_width, translate_x, translate_y, translate_z, area_calculation_method, area_interpolator, eh_&
  &lapse_type, eh_metric_type, eh_shift_type, file_type, generator_distribution, generator_interpolator, generator_tracking_method,&
  & initial_f, mode, pde_differences, re_init_int_method, surface_direction, surface_interpolator, upwind_type, area_interpolation_&
  &order, cheat, cheat_iterations, eh_number_level_sets, evolve_generators, generator_interpolation_order, last_iteration_number, m&
  &aximum_surface_number, n_array_ghosts, nphi, ntheta, number_of_generators, number_of_generators_phi, number_of_generators_theta,&
  & re_init_max_iter, re_init_undo, re_init_verbose, re_initialize_every, read_conformal_factor_once, saved_iteration_every, surfac&
  &e_interpolation_order, use_inner_excision, use_outer_excision, use_user_center
  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 initial_data
  integer, parameter :: cctki_use_initial_data = kind(initial_data)
  integer*8 CCTKH4
  integer, parameter :: cctki_use_CCTKH4 = kind(CCTKH4)
  integer*8 CCTKH5
  integer, parameter :: cctki_use_CCTKH5 = kind(CCTKH5)
  integer*8 initial_lapse
  integer, parameter :: cctki_use_initial_lapse = kind(initial_lapse)
  integer*8 initial_shift
  integer, parameter :: cctki_use_initial_shift = kind(initial_shift)
  integer*8 CCTKH6
  integer, parameter :: cctki_use_CCTKH6 = kind(CCTKH6)
  integer*8 CCTKH7
  integer, parameter :: cctki_use_CCTKH7 = kind(CCTKH7)
  integer*8 CCTKH9
  integer, parameter :: cctki_use_CCTKH9 = kind(CCTKH9)
  integer*8 metric_type
  integer, parameter :: cctki_use_metric_type = kind(metric_type)
  integer*8 CCTKH11
  integer, parameter :: cctki_use_CCTKH11 = kind(CCTKH11)
  integer*8 CCTKH12
  integer, parameter :: cctki_use_CCTKH12 = kind(CCTKH12)
  INTEGER*4 CCTKH8
  integer, parameter :: cctki_use_CCTKH8 = kind(CCTKH8)
  INTEGER*4 CCTKH10
  integer, parameter :: cctki_use_CCTKH10 = kind(CCTKH10)
  INTEGER*4 CCTKH13
  integer, parameter :: cctki_use_CCTKH13 = kind(CCTKH13)
  COMMON /ADMBASErest/CCTKH0, CCTKH1, CCTKH2, CCTKH3, initial_data, CCTKH4, CCTKH5, initial_lapse, initial_shift, CCTKH6, CCTKH7, C&
  &CTKH9, metric_type, CCTKH11, CCTKH12, CCTKH8, CCTKH10, CCTKH13
  REAL*8 CCTKH14
  integer, parameter :: cctki_use_CCTKH14 = kind(CCTKH14)
  REAL*8 CCTKH15
  integer, parameter :: cctki_use_CCTKH15 = kind(CCTKH15)
  REAL*8 CCTKH16
  integer, parameter :: cctki_use_CCTKH16 = kind(CCTKH16)
  REAL*8 CCTKH17
  integer, parameter :: cctki_use_CCTKH17 = kind(CCTKH17)
  REAL*8 CCTKH26
  integer, parameter :: cctki_use_CCTKH26 = kind(CCTKH26)
  REAL*8 CCTKH27
  integer, parameter :: cctki_use_CCTKH27 = kind(CCTKH27)
  REAL*8 CCTKH28
  integer, parameter :: cctki_use_CCTKH28 = kind(CCTKH28)
  REAL*8 CCTKH29
  integer, parameter :: cctki_use_CCTKH29 = kind(CCTKH29)
  REAL*8 CCTKH30
  integer, parameter :: cctki_use_CCTKH30 = kind(CCTKH30)
  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)
  integer*8 bitant_plane
  integer, parameter :: cctki_use_bitant_plane = kind(bitant_plane)
  integer*8 domain
  integer, parameter :: cctki_use_domain = kind(domain)
  integer*8 quadrant_direction
  integer, parameter :: cctki_use_quadrant_direction = kind(quadrant_direction)
  integer*8 CCTKH18
  integer, parameter :: cctki_use_CCTKH18 = kind(CCTKH18)
  integer*8 CCTKH25
  integer, parameter :: cctki_use_CCTKH25 = kind(CCTKH25)
  INTEGER*4 CCTKH19
  integer, parameter :: cctki_use_CCTKH19 = kind(CCTKH19)
  INTEGER*4 CCTKH20
  integer, parameter :: cctki_use_CCTKH20 = kind(CCTKH20)
  INTEGER*4 CCTKH21
  integer, parameter :: cctki_use_CCTKH21 = kind(CCTKH21)
  INTEGER*4 CCTKH22
  integer, parameter :: cctki_use_CCTKH22 = kind(CCTKH22)
  INTEGER*4 CCTKH23
  integer, parameter :: cctki_use_CCTKH23 = kind(CCTKH23)
  INTEGER*4 CCTKH24
  integer, parameter :: cctki_use_CCTKH24 = kind(CCTKH24)
  COMMON /GRIDrest/CCTKH14, CCTKH15, CCTKH16, CCTKH17, CCTKH26, CCTKH27, CCTKH28, CCTKH29, CCTKH30, CCTKH31, CCTKH32, CCTKH33, bita&
  &nt_plane, domain, quadrant_direction, CCTKH18, CCTKH25, CCTKH19, CCTKH20, CCTKH21, CCTKH22, CCTKH23, CCTKH24
  INTEGER*4 MoL_Max_Evolved_Array_Size
  integer, parameter :: cctki_use_MoL_Max_Evolved_Array_Size = kind(MoL_Max_Evolved_Array_Size)
  INTEGER*4 CCTKH34
  integer, parameter :: cctki_use_CCTKH34 = kind(CCTKH34)
  INTEGER*4 MoL_Num_ArrayEvolved_Vars
  integer, parameter :: cctki_use_MoL_Num_ArrayEvolved_Vars = kind(MoL_Num_ArrayEvolved_Vars)
  INTEGER*4 CCTKH35
  integer, parameter :: cctki_use_CCTKH35 = kind(CCTKH35)
  INTEGER*4 CCTKH36
  integer, parameter :: cctki_use_CCTKH36 = kind(CCTKH36)
  INTEGER*4 MoL_Num_Evolved_Vars
  integer, parameter :: cctki_use_MoL_Num_Evolved_Vars = kind(MoL_Num_Evolved_Vars)
  INTEGER*4 CCTKH37
  integer, parameter :: cctki_use_CCTKH37 = kind(CCTKH37)
  INTEGER*4 CCTKH38
  integer, parameter :: cctki_use_CCTKH38 = kind(CCTKH38)
  INTEGER*4 CCTKH39
  integer, parameter :: cctki_use_CCTKH39 = kind(CCTKH39)
  COMMON /METHODOFLINESrest/MoL_Max_Evolved_Array_Size, CCTKH34, MoL_Num_ArrayEvolved_Vars, CCTKH35, CCTKH36, MoL_Num_Evolved_Vars,&
  & CCTKH37, CCTKH38, CCTKH39
  INTEGER*4 use_mask
  integer, parameter :: cctki_use_use_mask = kind(use_mask)
  COMMON /SPACEMASKrest/use_mask

  INTEGER cctk_dim
  integer, parameter :: cctki_use_cctk_dim = kind(cctk_dim)
  INTEGER cctk_gsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_gsh = kind(cctk_gsh)
  INTEGER cctk_lsh (cctk_dim)
  integer, parameter :: cctki_use_cctk_lsh = kind(cctk_lsh)
  INTEGER cctk_lbnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_lbnd = kind(cctk_lbnd)
  INTEGER cctk_ubnd (cctk_dim)
  integer, parameter :: cctki_use_cctk_ubnd = kind(cctk_ubnd)
  INTEGER cctk_tile_min (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_min = kind(cctk_tile_min)
  INTEGER cctk_tile_max (cctk_dim)
  integer, parameter :: cctki_use_cctk_tile_max = kind(cctk_tile_max)
  INTEGER cctk_ash (cctk_dim)
  integer, parameter :: cctki_use_cctk_ash = kind(cctk_ash)
  INTEGER cctk_alignment
  integer, parameter :: cctki_use_cctk_alignment = kind(cctk_alignment)
  INTEGER cctk_alignment_offset
  integer, parameter :: cctki_use_cctk_alignment_offset = kind(cctk_alignment_offset)
  INTEGER cctk_from (cctk_dim)
  integer, parameter :: cctki_use_cctk_from = kind(cctk_from)
  INTEGER cctk_to (cctk_dim)
  integer, parameter :: cctki_use_cctk_to = kind(cctk_to)
  INTEGER cctk_bbox (2*cctk_dim)
  integer, parameter :: cctki_use_cctk_bbox = kind(cctk_bbox)
  REAL*8 cctk_delta_time
  integer, parameter :: cctki_use_cctk_delta_time = kind(cctk_delta_time)
  REAL*8 cctk_time
  integer, parameter :: cctki_use_cctk_time = kind(cctk_time)
  REAL*8 cctk_delta_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_delta_space = kind(cctk_delta_space)
  REAL*8 cctk_origin_space (cctk_dim)
  integer, parameter :: cctki_use_cctk_origin_space = kind(cctk_origin_space)
  INTEGER cctk_levfac (cctk_dim)
  integer, parameter :: cctki_use_cctk_levfac = kind(cctk_levfac)
  INTEGER cctk_levoff (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoff = kind(cctk_levoff)
  INTEGER cctk_levoffdenom (cctk_dim)
  integer, parameter :: cctki_use_cctk_levoffdenom = kind(cctk_levoffdenom)
  INTEGER cctk_timefac
  integer, parameter :: cctki_use_cctk_timefac = kind(cctk_timefac)
  INTEGER cctk_convlevel
  integer, parameter :: cctki_use_cctk_convlevel = kind(cctk_convlevel)
  INTEGER cctk_convfac
  integer, parameter :: cctki_use_cctk_convfac = kind(cctk_convfac)
  INTEGER cctk_nghostzones (cctk_dim)
  integer, parameter :: cctki_use_cctk_nghostzones = kind(cctk_nghostzones)
  INTEGER cctk_iteration
  integer, parameter :: cctki_use_cctk_iteration = kind(cctk_iteration)
  integer*8 cctkGH
  integer, parameter :: cctki_use_cctkGH = kind(cctkGH)
  INTEGER cctk_ash1
  integer, parameter :: cctki_use_cctk_ash1 = kind(cctk_ash1)
  INTEGER cctk_ash2
  integer, parameter :: cctki_use_cctk_ash2 = kind(cctk_ash2)
  INTEGER cctk_ash3
  integer, parameter :: cctki_use_cctk_ash3 = kind(cctk_ash3)
  INTEGER X0center_arrays
  INTEGER X0dxg
  INTEGER X0dxg2
  INTEGER X0dyg
  INTEGER X0dyg2
  INTEGER X0dzg
  INTEGER X0dzg2
  INTEGER X0eh_area
  INTEGER X0eh_area2
  INTEGER X0eh_centroid2_x
  INTEGER X0eh_centroid2_y
  INTEGER X0eh_centroid2_z
  INTEGER X0eh_centroid_x
  INTEGER X0eh_centroid_y
  INTEGER X0eh_centroid_z
  INTEGER X0eh_circ_eq
  INTEGER X0eh_circ_eq2
  INTEGER X0eh_circ_pol
  INTEGER X0eh_circ_pol2
  INTEGER X0generator_arrays
  INTEGER X0generator_arrays2
  INTEGER X0integrate_tmp_array
  INTEGER X0interp_metric_arrays
  INTEGER X0surface_arrays
  INTEGER X0surface_int_array
  INTEGER X0surface_tmp_arrays
  INTEGER X0xg
  INTEGER X0xg2
  INTEGER X0yg
  INTEGER X0yg2
  INTEGER X0zg
  INTEGER X0zg2
  INTEGER X1dxg2
  INTEGER X1dyg2
  INTEGER X1dzg2
  INTEGER X1generator_arrays2
  INTEGER X1integrate_tmp_array
  INTEGER X1interp_metric_arrays
  INTEGER X1surface_arrays
  INTEGER X1surface_int_array
  INTEGER X1surface_tmp_arrays
  INTEGER X1xg2
  INTEGER X1yg2
  INTEGER X1zg2
  INTEGER dfsq_length
  INTEGER dfx_length
  INTEGER dfy_length
  INTEGER dfz_length
  INTEGER dxg2_length
  INTEGER dxg_length
  INTEGER dyg2_length
  INTEGER dyg_length
  INTEGER dzg2_length
  INTEGER dzg_length
  INTEGER eh_area2_length
  INTEGER eh_area_length
  INTEGER eh_centroid2_x_length
  INTEGER eh_centroid2_y_length
  INTEGER eh_centroid2_z_length
  INTEGER eh_centroid_x_length
  INTEGER eh_centroid_y_length
  INTEGER eh_centroid_z_length
  INTEGER eh_circ_eq2_length
  INTEGER eh_circ_eq_length
  INTEGER eh_circ_pol2_length
  INTEGER eh_circ_pol_length
  INTEGER eh_mask_bak_length
  INTEGER eh_mask_length
  INTEGER f_length
  INTEGER fbak_length
  INTEGER ftmp_length
  INTEGER sf_length
  INTEGER sftmp_length
  INTEGER tm_mask_length
  INTEGER xg2_length
  INTEGER xg_length
  INTEGER yg2_length
  INTEGER yg_length
  INTEGER zg2_length
  INTEGER zg_length
  REAL*8 alpg (X0generator_arrays)
  integer, parameter :: cctki_use_alpg = kind(alpg)
  REAL*8 alpg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_alpg2 = kind(alpg2)
  REAL*8 betaxg (X0generator_arrays)
  integer, parameter :: cctki_use_betaxg = kind(betaxg)
  REAL*8 betaxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betaxg2 = kind(betaxg2)
  REAL*8 betayg (X0generator_arrays)
  integer, parameter :: cctki_use_betayg = kind(betayg)
  REAL*8 betayg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betayg2 = kind(betayg2)
  REAL*8 betazg (X0generator_arrays)
  integer, parameter :: cctki_use_betazg = kind(betazg)
  REAL*8 betazg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_betazg2 = kind(betazg2)
  REAL*8 center (X0center_arrays)
  integer, parameter :: cctki_use_center = kind(center)
  REAL*8 cosphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cosphi = kind(cosphi)
  REAL*8 costheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_costheta = kind(costheta)
  REAL*8 cphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_cphi = kind(cphi)
  REAL*8 ctheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_ctheta = kind(ctheta)
  REAL*8 da (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_da = kind(da)
  REAL*8 dfdx_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdx_interp = kind(dfdx_interp)
  REAL*8 dfdy_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdy_interp = kind(dfdy_interp)
  REAL*8 dfdz_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_dfdz_interp = kind(dfdz_interp)
  REAL*8 dfsq (cctk_ash1,cctk_ash2,cctk_ash3,dfsq_length)
  integer, parameter :: cctki_use_dfsq = kind(dfsq)
  REAL*8 dfx (cctk_ash1,cctk_ash2,cctk_ash3,dfx_length)
  integer, parameter :: cctki_use_dfx = kind(dfx)
  REAL*8 dfxg (X0generator_arrays)
  integer, parameter :: cctki_use_dfxg = kind(dfxg)
  REAL*8 dfxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfxg2 = kind(dfxg2)
  REAL*8 dfy (cctk_ash1,cctk_ash2,cctk_ash3,dfy_length)
  integer, parameter :: cctki_use_dfy = kind(dfy)
  REAL*8 dfyg (X0generator_arrays)
  integer, parameter :: cctki_use_dfyg = kind(dfyg)
  REAL*8 dfyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfyg2 = kind(dfyg2)
  REAL*8 dfz (cctk_ash1,cctk_ash2,cctk_ash3,dfz_length)
  integer, parameter :: cctki_use_dfz = kind(dfz)
  REAL*8 dfzg (X0generator_arrays)
  integer, parameter :: cctki_use_dfzg = kind(dfzg)
  REAL*8 dfzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_dfzg2 = kind(dfzg2)
  REAL*8 dlphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dlphi = kind(dlphi)
  REAL*8 dltheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_dltheta = kind(dltheta)
  REAL*8 drdphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdphi = kind(drdphi)
  REAL*8 drdtheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_drdtheta = kind(drdtheta)
  REAL*8 drsurf (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_drsurf = kind(drsurf)
  REAL*8 dxg (X0dxg,dxg_length)
  integer, parameter :: cctki_use_dxg = kind(dxg)
  REAL*8 dxg2 (X0dxg2,X1dxg2,dxg2_length)
  integer, parameter :: cctki_use_dxg2 = kind(dxg2)
  REAL*8 dyg (X0dyg,dyg_length)
  integer, parameter :: cctki_use_dyg = kind(dyg)
  REAL*8 dyg2 (X0dyg2,X1dyg2,dyg2_length)
  integer, parameter :: cctki_use_dyg2 = kind(dyg2)
  REAL*8 dzg (X0dzg,dzg_length)
  integer, parameter :: cctki_use_dzg = kind(dzg)
  REAL*8 dzg2 (X0dzg2,X1dzg2,dzg2_length)
  integer, parameter :: cctki_use_dzg2 = kind(dzg2)
  REAL*8 eh_area (X0eh_area,eh_area_length)
  integer, parameter :: cctki_use_eh_area = kind(eh_area)
  REAL*8 eh_area2 (X0eh_area2,eh_area2_length)
  integer, parameter :: cctki_use_eh_area2 = kind(eh_area2)
  REAL*8 eh_centroid2_x (X0eh_centroid2_x,eh_centroid2_x_length)
  integer, parameter :: cctki_use_eh_centroid2_x = kind(eh_centroid2_x)
  REAL*8 eh_centroid2_y (X0eh_centroid2_y,eh_centroid2_y_length)
  integer, parameter :: cctki_use_eh_centroid2_y = kind(eh_centroid2_y)
  REAL*8 eh_centroid2_z (X0eh_centroid2_z,eh_centroid2_z_length)
  integer, parameter :: cctki_use_eh_centroid2_z = kind(eh_centroid2_z)
  REAL*8 eh_centroid_x (X0eh_centroid_x,eh_centroid_x_length)
  integer, parameter :: cctki_use_eh_centroid_x = kind(eh_centroid_x)
  REAL*8 eh_centroid_y (X0eh_centroid_y,eh_centroid_y_length)
  integer, parameter :: cctki_use_eh_centroid_y = kind(eh_centroid_y)
  REAL*8 eh_centroid_z (X0eh_centroid_z,eh_centroid_z_length)
  integer, parameter :: cctki_use_eh_centroid_z = kind(eh_centroid_z)
  REAL*8 eh_circ_eq (X0eh_circ_eq,eh_circ_eq_length)
  integer, parameter :: cctki_use_eh_circ_eq = kind(eh_circ_eq)
  REAL*8 eh_circ_eq2 (X0eh_circ_eq2,eh_circ_eq2_length)
  integer, parameter :: cctki_use_eh_circ_eq2 = kind(eh_circ_eq2)
  REAL*8 eh_circ_pol (X0eh_circ_pol,eh_circ_pol_length)
  integer, parameter :: cctki_use_eh_circ_pol = kind(eh_circ_pol)
  REAL*8 eh_circ_pol2 (X0eh_circ_pol2,eh_circ_pol2_length)
  integer, parameter :: cctki_use_eh_circ_pol2 = kind(eh_circ_pol2)
  INTEGER*4 eh_mask (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_length)
  integer, parameter :: cctki_use_eh_mask = kind(eh_mask)
  INTEGER*4 eh_mask_bak (cctk_ash1,cctk_ash2,cctk_ash3,eh_mask_bak_length)
  integer, parameter :: cctki_use_eh_mask_bak = kind(eh_mask_bak)
  REAL*8 f (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f = kind(f)
  REAL*8 f_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p = kind(f_p)
  REAL*8 f_p_p (cctk_ash1,cctk_ash2,cctk_ash3,f_length)
  integer, parameter :: cctki_use_f_p_p = kind(f_p_p)
  REAL*8 f_interp (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_f_interp = kind(f_interp)
  REAL*8 fbak (cctk_ash1,cctk_ash2,cctk_ash3,fbak_length)
  integer, parameter :: cctki_use_fbak = kind(fbak)
  INTEGER*4 find_surface_status
  integer, parameter :: cctki_use_find_surface_status = kind(find_surface_status)
  REAL*8 ftmp (cctk_ash1,cctk_ash2,cctk_ash3,ftmp_length)
  integer, parameter :: cctki_use_ftmp = kind(ftmp)
  REAL*8 g3xx (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xx = kind(g3xx)
  REAL*8 g3xy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xy = kind(g3xy)
  REAL*8 g3xz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3xz = kind(g3xz)
  REAL*8 g3yy (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yy = kind(g3yy)
  REAL*8 g3yz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3yz = kind(g3yz)
  REAL*8 g3zz (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_g3zz = kind(g3zz)
  REAL*8 gpp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gpp = kind(gpp)
  REAL*8 gtp (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtp = kind(gtp)
  REAL*8 gtt (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_gtt = kind(gtt)
  REAL*8 gxxg (X0generator_arrays)
  integer, parameter :: cctki_use_gxxg = kind(gxxg)
  REAL*8 gxxg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxxg2 = kind(gxxg2)
  REAL*8 gxxi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxxi = kind(gxxi)
  REAL*8 gxyg (X0generator_arrays)
  integer, parameter :: cctki_use_gxyg = kind(gxyg)
  REAL*8 gxyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxyg2 = kind(gxyg2)
  REAL*8 gxyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxyi = kind(gxyi)
  REAL*8 gxzg (X0generator_arrays)
  integer, parameter :: cctki_use_gxzg = kind(gxzg)
  REAL*8 gxzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gxzg2 = kind(gxzg2)
  REAL*8 gxzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gxzi = kind(gxzi)
  REAL*8 gyyg (X0generator_arrays)
  integer, parameter :: cctki_use_gyyg = kind(gyyg)
  REAL*8 gyyg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyyg2 = kind(gyyg2)
  REAL*8 gyyi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyyi = kind(gyyi)
  REAL*8 gyzg (X0generator_arrays)
  integer, parameter :: cctki_use_gyzg = kind(gyzg)
  REAL*8 gyzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gyzg2 = kind(gyzg2)
  REAL*8 gyzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gyzi = kind(gyzi)
  REAL*8 gzzg (X0generator_arrays)
  integer, parameter :: cctki_use_gzzg = kind(gzzg)
  REAL*8 gzzg2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_gzzg2 = kind(gzzg2)
  REAL*8 gzzi (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_gzzi = kind(gzzi)
  REAL*8 int_tmp (X0integrate_tmp_array,X1integrate_tmp_array)
  integer, parameter :: cctki_use_int_tmp = kind(int_tmp)
  INTEGER*4 integrate_counter
  integer, parameter :: cctki_use_integrate_counter = kind(integrate_counter)
  REAL*8 interp_x (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_x = kind(interp_x)
  REAL*8 interp_y (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_y = kind(interp_y)
  REAL*8 interp_z (X0surface_tmp_arrays,X1surface_tmp_arrays)
  integer, parameter :: cctki_use_interp_z = kind(interp_z)
  INTEGER*4 levelset_counter
  integer, parameter :: cctki_use_levelset_counter = kind(levelset_counter)
  INTEGER*4 more_levelsets
  integer, parameter :: cctki_use_more_levelsets = kind(more_levelsets)
  INTEGER*4 more_points
  integer, parameter :: cctki_use_more_points = kind(more_points)
  INTEGER*4 more_surfaces
  integer, parameter :: cctki_use_more_surfaces = kind(more_surfaces)
  INTEGER*4 n_since_last_reduction (X0surface_int_array,X1surface_int_array)
  integer, parameter :: cctki_use_n_since_last_reduction = kind(n_since_last_reduction)
  INTEGER*4 niter_reinit
  integer, parameter :: cctki_use_niter_reinit = kind(niter_reinit)
  REAL*8 phi_sym_factor
  integer, parameter :: cctki_use_phi_sym_factor = kind(phi_sym_factor)
  REAL*8 phiweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_phiweights = kind(phiweights)
  INTEGER*4 points_counter
  integer, parameter :: cctki_use_points_counter = kind(points_counter)
  REAL*8 psig (X0generator_arrays)
  integer, parameter :: cctki_use_psig = kind(psig)
  REAL*8 psig2 (X0generator_arrays2,X1generator_arrays2)
  integer, parameter :: cctki_use_psig2 = kind(psig2)
  REAL*8 psii (X0interp_metric_arrays,X1interp_metric_arrays)
  integer, parameter :: cctki_use_psii = kind(psii)
  INTEGER*4 re_init_control
  integer, parameter :: cctki_use_re_init_control = kind(re_init_control)
  REAL*8 rsurf (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_rsurf = kind(rsurf)
  REAL*8 sc (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_sc = kind(sc)
  REAL*8 sf (cctk_ash1,cctk_ash2,cctk_ash3,sf_length)
  integer, parameter :: cctki_use_sf = kind(sf)
  REAL*8 sftmp (cctk_ash1,cctk_ash2,cctk_ash3,sftmp_length)
  integer, parameter :: cctki_use_sftmp = kind(sftmp)
  REAL*8 sinphi (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sinphi = kind(sinphi)
  REAL*8 sintheta (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_sintheta = kind(sintheta)
  INTEGER*4 surface_counter
  integer, parameter :: cctki_use_surface_counter = kind(surface_counter)
  REAL*8 sym_factor
  integer, parameter :: cctki_use_sym_factor = kind(sym_factor)
  REAL*8 theta_sym_factor
  integer, parameter :: cctki_use_theta_sym_factor = kind(theta_sym_factor)
  REAL*8 thetaweights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_thetaweights = kind(thetaweights)
  INTEGER*4 tm_mask (cctk_ash1,cctk_ash2,cctk_ash3,tm_mask_length)
  integer, parameter :: cctki_use_tm_mask = kind(tm_mask)
  REAL*8 weights (X0surface_arrays,X1surface_arrays)
  integer, parameter :: cctki_use_weights = kind(weights)
  REAL*8 xg (X0xg,xg_length)
  integer, parameter :: cctki_use_xg = kind(xg)
  REAL*8 xg_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p = kind(xg_p)
  REAL*8 xg_p_p (X0xg,xg_length)
  integer, parameter :: cctki_use_xg_p_p = kind(xg_p_p)
  REAL*8 xg2 (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2 = kind(xg2)
  REAL*8 xg2_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p = kind(xg2_p)
  REAL*8 xg2_p_p (X0xg2,X1xg2,xg2_length)
  integer, parameter :: cctki_use_xg2_p_p = kind(xg2_p_p)
  REAL*8 xgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf = kind(xgf)
  REAL*8 xgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_xgf2 = kind(xgf2)
  REAL*8 yg (X0yg,yg_length)
  integer, parameter :: cctki_use_yg = kind(yg)
  REAL*8 yg_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p = kind(yg_p)
  REAL*8 yg_p_p (X0yg,yg_length)
  integer, parameter :: cctki_use_yg_p_p = kind(yg_p_p)
  REAL*8 yg2 (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2 = kind(yg2)
  REAL*8 yg2_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p = kind(yg2_p)
  REAL*8 yg2_p_p (X0yg2,X1yg2,yg2_length)
  integer, parameter :: cctki_use_yg2_p_p = kind(yg2_p_p)
  REAL*8 ygf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf = kind(ygf)
  REAL*8 ygf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_ygf2 = kind(ygf2)
  REAL*8 zg (X0zg,zg_length)
  integer, parameter :: cctki_use_zg = kind(zg)
  REAL*8 zg_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p = kind(zg_p)
  REAL*8 zg_p_p (X0zg,zg_length)
  integer, parameter :: cctki_use_zg_p_p = kind(zg_p_p)
  REAL*8 zg2 (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2 = kind(zg2)
  REAL*8 zg2_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p = kind(zg2_p)
  REAL*8 zg2_p_p (X0zg2,X1zg2,zg2_length)
  integer, parameter :: cctki_use_zg2_p_p = kind(zg2_p_p)
  REAL*8 zgf (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf = kind(zgf)
  REAL*8 zgf2 (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_zgf2 = kind(zgf2)
  INTEGER*4 active_slicing_handle
  integer, parameter :: cctki_use_active_slicing_handle = kind(active_slicing_handle)
  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_state)
  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 emask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_emask = kind(emask)
  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)
  INTEGER*4 space_mask (cctk_ash1,cctk_ash2,cctk_ash3)
  integer, parameter :: cctki_use_space_mask = kind(space_mask)
  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)
  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
  interface
  INTEGER*4 function Boundary_SelectGroupForBC (GH, faces, boundary_width, table_handle, var_name, bc_name)
  implicit none
  integer*8 GH
  INTEGER*4 faces
  INTEGER*4 boundary_width
  INTEGER*4 table_handle
  character(*) var_name
  character(*) bc_name
  end function Boundary_SelectGroupForBC
  end interface
  interface
  INTEGER*4 function MoLRegisterEvolvedGroup (EvolvedIndex, RHSIndex)
  implicit none
  INTEGER*4 EvolvedIndex
  INTEGER*4 RHSIndex
  end function MoLRegisterEvolvedGroup
  end interface

  REAL*8, dimension(eh_number_level_sets) :: maxdf
  INTEGER*4 :: i,j,l
  character(len=128) :: info_message, variable_name
  character(15) :: form(4) = (/ '(a16,i1,a1)', '(a16,i2,a1)', &
                                '(a16,i3,a1)', '(a16,i4,a1)' /)


  call CCTK_ReductionHandle ( max_handle, 'maximum' )
  if ( max_handle < 0 ) then
    call CCTK_Warn(0,532,"EHFinder_ReInitialize.F90","EHFinder",'Could not obtain a handle for maximum reduction')
  end if

  do l = 1, eh_number_level_sets
    select case (l)
    case (1:9)
      j = 1
    case(10:99)
      j = 2
    case(100:999)
      j = 3
    case(1000:9999)
      j = 4
    case(10000:)
      call CCTK_Warn(0,546,"EHFinder_ReInitialize.F90","EHFinder",'To many simultaneous level set functions')
    end select

    write (variable_name,form(j)) 'ehfinder::sftmp[',l-1,']'

    call CCTK_VarIndex ( i, variable_name )

    if ( i < 0 ) then
      write (info_message,'(a9,a18,a16)') 'Variable ',variable_name, &
                                          ' does not exist'
      call CCTK_Warn(0,556,"EHFinder_ReInitialize.F90","EHFinder",info_message)
    end if

    call CCTK_Reduce ( ierr, cctkGH, -1, max_handle, 1, &
                       130, maxdf(l), 1, i)

    if ( ierr .ne. 0 ) then
      call CCTK_Warn(0,563,"EHFinder_ReInitialize.F90","EHFinder",'Reduction of fmax failed')
    end if

  end do

  if ( re_init_verbose /= 0 ) then
    write(info_message,'(a13,i5,a9,es12.5)') 'At iteration ', niter_reinit, &
                                            ' maxdf = ', maxval(maxdf)
    call CCTK_Info("EHFinder", trim(info_message) )
  end if



  if ( all ( maxdf < one ) ) then
      re_init_control = 0
  endif

  if ( CCTK_IsThornACtive ( 'PUGH' ) /= 0 ) then

    niter_reinit = niter_reinit + 1
  end if



  if ( re_init_control == 0 ) then
    write(info_message,'(a35,i5,a12)') &
        'PDE re-initialization complete in ',niter_reinit,' iterations.'
    call CCTK_Info("EHFinder", trim(info_message) )
  end if



  if ( niter_reinit > re_init_max_iter ) then
    call CCTK_Warn(1,596,"EHFinder_ReInitialize.F90","EHFinder",'Re-initialization failed to converge')
    re_init_control = 0
  end if

end subroutine EHFinder_ReInitializePostStep
