MODULE metric_var_mod
  USE prec
  
  INTEGER :: nb_face
  
  TYPE t_cell_glo
    INTEGER :: neighbour(0:5)
    INTEGER :: edge(0:5)
    INTEGER :: vertex(0:5)
    INTEGER :: assign_face
    INTEGER :: assign_i
    INTEGER :: assign_j
    INTEGER :: assign_domain
    REAL(rstd) :: xyz(3)
  END TYPE t_cell_glo
  
  TYPE t_vertex_glo
    REAL(rstd) :: xyz(3)
    INTEGER    :: neighbour(0:5)
    INTEGER    :: ne(0:5)
    INTEGER    :: ind
    INTEGER    :: delta
    INTEGER    :: assign_i
    INTEGER    :: assign_j
  END TYPE t_vertex_glo
  
  TYPE t_edge_glo
   INTEGER :: e1
   INTEGER :: e2
   INTEGER :: assign_domain
   INTEGER :: assign_i
   INTEGER :: assign_j
   INTEGER :: assign_pos
   INTEGER :: assign_delta
  END TYPE t_edge_glo
    
  TYPE t_vertices_glo
   INTEGER :: assign_domain
   INTEGER :: assign_i
   INTEGER :: assign_j
   INTEGER :: assign_pos
   INTEGER :: assign_delta
  END TYPE t_vertices_glo    
 
  TYPE(t_vertex_glo),ALLOCATABLE,SAVE :: vertex_glo(:,:,:)
  TYPE(t_cell_glo),ALLOCATABLE,SAVE :: cell_glo(:)
  TYPE(t_edge_glo),ALLOCATABLE,SAVE :: edge_glo(:)
  TYPE(t_vertices_glo),ALLOCATABLE,SAVE :: vertices_glo(:)
  INTEGER :: ncell_glo
  
  INTEGER,ALLOCATABLE,SAVE :: Tab_index(:,:,:)  
  INTEGER,PARAMETER :: right=1
  INTEGER,PARAMETER :: rup=2
  INTEGER,PARAMETER :: lup=3
  INTEGER,PARAMETER :: left=4
  INTEGER,PARAMETER :: ldown=5
  INTEGER,PARAMETER :: rdown=6
  
  INTEGER,PARAMETER :: vrup=1
  INTEGER,PARAMETER :: vup=2
  INTEGER,PARAMETER :: vlup=3
  INTEGER,PARAMETER :: vldown=4
  INTEGER,PARAMETER :: vdown=5
  INTEGER,PARAMETER :: vrdown=6
  
 END MODULE metric_var_mod
