!===============================================================================
!
! typedef_simd.F90
!
!-------------------------------------------------------------------------------
!
! Copyright (C) 2012-2015 Hinnerk Stueben
!
! 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/>.
!
!-------------------------------------------------------------------------------
# define LANGUAGE_FORTRAN
# include "simd.h"

!-------------------------------------------------------------------------------
module typedef_simd

FOR rkind in 4 8
SET _rr = _r %% rkind

  type real%%_rr
     sequence
     real(rkind) :: r
  end type real%%_rr

  type imaginary%%_rr
     sequence
     real(rkind) :: i
  end type imaginary%%_rr

  type complex%%_rr
     sequence
     real(rkind) :: r
     real(rkind) :: i
  end type complex%%_rr

ENDSET
ENDFOR

FOR rkind in 4 8
SET _rr = _r %% rkind
SET SIMD_WIDTH = SIMD_WIDTH %% $(toupper _rr)

  type simd_real%%_rr
     sequence
     real(rkind) :: r(SIMD_WIDTH)
  end type simd_real%%_rr

  type simd_imaginary%%_rr
     sequence
     real(rkind) :: i(SIMD_WIDTH)
  end type simd_imaginary%%_rr

  type simd_complex%%_rr
     sequence
     real(rkind) :: r(SIMD_WIDTH)
     real(rkind) :: i(SIMD_WIDTH)
  end type simd_complex%%_rr

ENDSET
ENDSET
ENDFOR

FOR rkind in 4 8
SET _rr = _r %% rkind 
SET _rrs = _r %% rkind %% s 
SET SIMD_WIDTH = SIMD_WIDTH %% $(toupper _rr)

  type real%%_rrs
     sequence
     real(rkind) :: r(SIMD_WIDTH)
  end type real%%_rrs

  type imaginary%%_rrs
     sequence
     real(rkind) :: i(SIMD_WIDTH)
  end type imaginary%%_rrs

  type complex%%_rrs
     sequence
     real(rkind) :: r(SIMD_WIDTH)
     real(rkind) :: i(SIMD_WIDTH)
  end type complex%%_rrs

ENDSET
ENDSET
ENDSET
ENDFOR

end

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