!
!     module m_intersection_data_2
!
      module m_intersection_data_2
!
!      Written by H. Matsui on june, 2006
!
      use m_precision
!
      implicit none
!
!
      integer(kind = kint), parameter, private :: nnod_tri = 3
      integer(kind = kint), parameter, private :: nnod_quad = 4
!
!
!   2 nodes on a edge has differrent sign
!    (square...2 triangles)
!
!     flag = 1: c-c_ref >= 0
!     flag = 1: c-c_ref < 0
!
!       12345678: boundary...4 of 12:   quad;  (1-2-4), (3-4-2)
!   3:  11000000: 4-1, 2-3, 2-6, 1-5:  4-2-10- 9; 4-2- 9, 10- 9-2
!   6:  01100000: 1-2, 3-4, 3-7, 2-6:  1-3-11-10; 1-3-10, 11-10-3
!  12:  00110000: 2-3, 4-1, 4-8, 3-7:  2-4-12-11; 2-4-11, 12-11-4
!   9:  10010000: 3-4, 1-2, 1-5, 4-8:  3-1- 9-12; 3-1-12,  9-12-1
!  48:  00001100: 1-5, 2-6, 6-7, 8-5:   9-10-6-8;  9-10-8, 6-8-10
!  96:  00000110: 2-6, 3-7, 7-8, 5-6:  10-11-7-5; 10-11-5, 7-5-11
! 192:  00000011: 3-7, 4-8, 8-5, 6-7:  11-12-8-6; 11-12-6, 8-6-12
! 144:  00001001: 4-8, 1-5, 5-6, 7-8:  12- 9-5-7; 12- 9-7, 5-7- 9
!  17:  10001000: 8-5, 4-1, 1-2, 5-6:  8-4-1-5;   8-4-5,  1-5-4
!  34:  01000100: 5-6, 1-2, 2-3, 6-7:  5-1-2-6;   5-1-6,  2-6-1
!  68:  00100010: 6-7, 2-3, 3-4, 7-8:  6-2-3-7;   6-2-7,  3-7-2
! 136:  00010001: 7-8, 3-4, 4-1, 8-5:  7-3-4-8;   7-3-8,  4-8-3
!
!       12345678: boundary...4 of 12:   quad;  (1-2-4), (3-4-2)
! 252:  00111111: 4-1, 1-5, 2-6, 2-3:  4- 9-10-2; 4- 9-2,  10-2- 9
! 249:  10011111: 1-2, 2-6, 3-7, 3-4:  1-10-11-3; 1-10-3,  11-3-10
! 243:  11001111: 2-3, 3-7, 4-8, 4-1:  2-11-12-4; 2-11-4,  12-4-11
! 246:  01101111: 3-4, 4-8, 1-5, 1-2:  3-12- 9-1; 3-12-1,   9-1-12
! 207:  11110011: 1-5, 8-5, 6-7, 2-6:   9-8-6-10;  9-8-10,  6-10-8
! 159:  11111001: 2-6, 5-6, 7-8, 3-7:  10-5-7-11; 10-5-11,  7-11-5
!  63:  11111100: 3-7, 6-7, 8-5, 4-8:  11-6-8-12; 11-6-12,  8-12-6
! 111:  11110110: 4-8, 7-8, 5-6, 1-5:  12-7-5- 9; 12-7- 9,  5-9- 7
! 238:  01110111: 8-5, 5-6, 1-2, 4-1:  8-5-1-4;   8-5-4,   1-4-5
! 221:  10111011: 5-6, 6-7, 2-3, 1-2:  5-6-2-1;   5-6-1,   2-1-6
! 187:  11011101: 6-7, 7-8, 3-4, 2-3:  6-7-3-2;   6-7-2,   3-2-7
! 119:  11101110: 7-8, 8-5, 4-1, 3-4:  7-8-4-3;   7-8-3,   4-3-8
!
      integer(kind = kint), parameter :: nkind_etype_2 = 12
      integer(kind = kint), parameter :: num_quad_2 =    1
      integer(kind = kint), parameter :: num_patch_2 =   2
      integer(kind = kint), parameter :: iq_2_p_2(6)                    &
     &     = (/1, 2, 4,   3, 4, 2/)
!
      integer(kind = kint) :: iquad_2_patches_2(3,2)
!
      integer(kind = kint), parameter                                   &
     &   :: iflag_psf_etype_2p(nkind_etype_2)                           &
     &     = (/  3,   6,  12,   9,  48,  96,                            &
     &         192, 144,  17,  34,  68, 136/)
      integer(kind = kint), parameter                                   &
     &   :: iflag_psf_etype_2n(nkind_etype_2)                           &
     &     = (/252, 249, 243, 246, 207, 159,                            &
     &          63, 111, 238, 221, 187, 119/)
!
      integer(kind = kint), parameter                                   &
     &        :: iedge_quad_2p(nnod_quad,nkind_etype_2)                 &
     &      = reshape(                                                  &
     &       (/ 4, 2,10, 9,   1, 3,11,10,   2, 4,12,11,   3, 1, 9,12,   &
     &          9,10, 6, 8,  10,11, 7, 5,  11,12, 8, 6,  12, 9, 5, 7,   &
     &          8, 4, 1, 5,   5, 1, 2, 6,   6, 2, 3, 7,   7, 3, 4, 8/), &
     &       shape=(/nnod_quad,nkind_etype_2/) )
!
      integer(kind = kint), parameter                                   &
     &        :: iedge_4_patch_2p(nnod_tri,num_patch_2,nkind_etype_2)   &
     &      = reshape(                                                  &
     &       (/ 4, 2, 9,   10,  9, 2,      1, 3, 10,    11, 10, 3,      &
     &          2, 4, 11,  12, 11, 4,      3, 1, 12,     9, 12, 1,      &
     &          9, 10, 8,   6, 8, 10,      10, 11, 5,    7, 5, 11,      &
     &         11, 12, 6,   8, 6, 12,      12,  9, 7,    5, 7,  9,      &
     &          8, 4, 5,    1, 5, 4,        5, 1, 6,     2, 6, 1,       &
     &          6, 2, 7,    3, 7, 2,        7, 3, 8,     4, 8, 3/),     &
     &       shape=(/nnod_tri,num_patch_2,nkind_etype_2/) )
!
!
      integer(kind = kint), parameter                                   &
     &        :: iedge_quad_2n(nnod_quad,nkind_etype_2)                 &
     &      = reshape(                                                  &
     &       (/ 4, 9,10, 2,   1,10,11, 3,   2,11,12, 4,   3,12, 9, 1,   &
     &          9, 8, 6,10,  10, 5, 7,11,  11, 6, 8,12,  12, 7, 5, 9,   &
     &          8, 5, 1, 4,   5, 6, 2, 1,   6, 7, 3, 2,   7, 8, 4, 3/), &
     &       shape=(/nnod_quad,nkind_etype_2/) )
!
      integer(kind = kint), parameter                                   &
     &        :: iedge_4_patch_2n(nnod_tri,num_patch_2,nkind_etype_2)   &
     &      = reshape(                                                  &
     &       (/ 4,  9, 2,  10,  2,  9,     1, 10, 3,    11,  3, 10,     &
     &          2, 11, 4,  12,  4, 11,     3, 12, 1,     9,  1, 12,     &
     &          9, 8, 10,   6, 10,  8,    10, 5, 11,     7, 11,  5,     &
     &         11, 6, 12,   8, 12,  6,    12, 7,  9,     5,  9,  7,     &
     &          8, 5, 4,    1,  4,  5,     5, 6,  1,     2,  1,  6,     &
     &          6, 7, 2,    3,  2,  7,     7, 8,  3,     4,  3,  8/),   &
     &       shape=(/nnod_tri,num_patch_2,nkind_etype_2/) )
!
      end module m_intersection_data_2
