!===============================================================================
!
! typedef.F90
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 2008 Yoshifumi Nakamura 
!
! This file is part of BQCD -- Berlin Quantum ChromoDynamics program
!
! BQCD is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! BQCD is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with BQCD.  If not, see <http://www.gnu.org/licenses/>.
!
!-------------------------------------------------------------------------------
# include "defs.h"

# define P_GAUGE_FIELD_R4    complex(4), dimension(:, :, :, :, :), pointer
# define P_CLOVER_FIELD_A_R4 type(type_clover_a_r4), dimension(:, :, :), pointer
# define P_CLOVER_FIELD_B_R4 type(type_clover_b_r4), dimension(:, :, :), pointer
# define P_CLOVER_FIELD12_R4 type(type_clover12_r4), dimension(:, :), pointer
# define P_CLOVER_FIELD12_R4 type(type_clover12_r4), dimension(:, :), pointer

# define P_GAUGE_FIELD_R16    complex(16), dimension(:, :, :, :, :), pointer
# define P_CLOVER_FIELD_A_R16 type(type_clover_a_r16), dimension(:, :, :), pointer
# define P_CLOVER_FIELD_B_R16 type(type_clover_b_r16), dimension(:, :, :), pointer
# define P_CLOVER_FIELD12_R16 type(type_clover12_r16), dimension(:, :), pointer
# define P_CLOVER_FIELD12_R16 type(type_clover12_r16), dimension(:, :), pointer

!-------------------------------------------------------------------------------
module typedef
  use typedef_clover
  use typedef_clover_r4

  type :: sc_field
     P_SPINCOL_FIELD :: sc
     P_SPINCOL_FIELD :: sc_e
     P_SPINCOL_FIELD :: sc_o
     COMPLEX, dimension(:, :, :, :, :), pointer :: ddsc
  end type sc_field

  type :: sco_field
     P_SPINCOL_OVERINDEXED :: sco
  end type sco_field

  type gauge_field
     logical :: init
     integer :: sid
     P_GAUGE_FIELD    :: u
     REAL :: em_charge  !! for quark, gauge(2)
  end type gauge_field

  type clover_field
     P_CLOVER_FIELD_A :: a
     P_CLOVER_FIELD_A :: i
     P_CLOVER_FIELD_B :: b
  end type clover_field

  type clover_field12
     P_CLOVER_FIELD12 :: a
     P_CLOVER_FIELD12 :: i
     COMPLEX, dimension(:, :), pointer :: det
  end type clover_field12

  type gauge_field_r4
     logical :: init
     integer :: sid
     P_GAUGE_FIELD_R4 :: u
  end type gauge_field_r4

  type clover_field_r4
     P_CLOVER_FIELD_A_R4 :: a
     P_CLOVER_FIELD_A_R4 :: i
     P_CLOVER_FIELD_B_R4 :: b
  end type clover_field_r4

  type clover_field12_r4
     P_CLOVER_FIELD12_R4 :: a
     P_CLOVER_FIELD12_R4 :: i
  end type clover_field12_r4

  type clover_term
     logical :: init
     type(clover_field     ) :: cfield
     type(clover_field_r4  ) :: cfield_r4
     type(clover_field12   ) :: cfield12
     type(clover_field12_r4) :: cfield12_r4
  end type clover_term

end

!===============================================================================
