Skip to content
Snippets Groups Projects
Commit bdbb7964 authored by Paul Baumeister's avatar Paul Baumeister
Browse files

removed unused DebugHelpers/DebugCheckArray*_mod.f90 (3x)

parent 49cbeb98
Branches kkrnano-dev2018-tfQMRgpu
No related tags found
No related merge requests found
! Author: Elias Rabel
module DebugCheckArrayD_mod
implicit none
public
type DebugCheckArrayD
private
double precision, allocatable :: array_data(:)
integer :: num_elements
character(len=32) :: array_name
endtype
contains
subroutine createDebugCheckArrayD(self, array_to_check, num_elements, array_name)
type(DebugCheckArrayD), intent(inout) :: self
double precision, intent(in) :: array_to_check(num_elements)
integer, intent(in) :: num_elements
character(len=*), intent(in) :: array_name
integer :: ii
allocate(self%array_data(num_elements))
self%num_elements = num_elements
self%array_name = array_name
do ii = 1, num_elements
self%array_data(ii) = array_to_check(ii)
enddo ! ii
endsubroutine
logical function testDebugCheckArrayD(self, array_to_check, fail_message)
type(DebugCheckArrayD), intent(in) :: self
double precision, intent(in) :: array_to_check(*) ! accept any array
character(len=*), intent(in), optional :: fail_message
integer :: ii
testDebugCheckArrayD = .false.
do ii = 1, self%num_elements
if (self%array_data(ii) /= array_to_check(ii)) then
write(*,*) "testDebugCheckArrayD: Arrays do not match. Element ", ii
if (present(fail_message)) then
write(*,*) self%array_name, fail_message
else
write(*,*) self%array_name
endif
return
endif
enddo ! ii
testDebugCheckArrayD = .true.
endfunction
elemental subroutine destroyDebugCheckArrayD(self)
type(DebugCheckArrayD), intent(inout) :: self
integer :: ist
deallocate(self%array_data, stat=ist) ! ignore status
endsubroutine ! destroy
endmodule
!
!program TryDebugCheckArrayD
! use DebugCheckArrayD_mod
! implicit none
!
! integer, parameter :: dimx = 10
! integer, parameter :: dimy = 10
!
! double precision, dimension(dimx, dimy) :: my_array
!
! integer :: x, y
! logical :: flag
!
! type(DebugCheckArrayD) :: db
!
! do y = 1, dimy
! do x = 1, dimx
! my_array(x,y) = x * y
! enddo
! enddo
!
! call createDebugCheckArrayD(db, my_array, dimx*dimy, "my_array")
!
! ! .. do something
!
! write(*,*) testDebugCheckArrayD(db, my_array)
!
! ! .. do something bad
!
! my_array(3,5) = -3
!
! write(*,*) testDebugCheckArrayD(db, my_array)
!
! ! use optional fail_message
! write(*,*) testDebugCheckArrayD(db, my_array, fail_message="location: main")
!
!
! call destroyDebugCheckArrayD(db)
!endprogram
! Author: Elias Rabel
module DebugCheckArrayI_mod
implicit none
public
type DebugCheckArrayI
private
integer, allocatable :: array_data(:)
integer :: num_elements
character(len=32) :: array_name
endtype
contains
subroutine createDebugCheckArrayI(self, array_to_check, num_elements, array_name)
type(DebugCheckArrayI), intent(inout) :: self
integer, intent(in) :: array_to_check(num_elements)
integer, intent(in) :: num_elements
character(len=*), intent(in) :: array_name
integer :: ii
allocate(self%array_data(num_elements))
self%num_elements = num_elements
self%array_name = array_name
do ii = 1, num_elements
self%array_data(ii) = array_to_check(ii)
enddo ! ii
endsubroutine
logical function testDebugCheckArrayI(self, array_to_check, fail_message)
type(DebugCheckArrayI), intent(in) :: self
integer, intent(in) :: array_to_check(*) ! accept any array
character(len=*), intent(in), optional :: fail_message
integer :: ii
testDebugCheckArrayI = .false.
do ii = 1, self%num_elements
if (self%array_data(ii) /= array_to_check(ii)) then
write(*,*) "testDebugCheckArrayI: Arrays do not match. Element ", ii
if (present(fail_message)) then
write(*,*) self%array_name, fail_message
else
write(*,*) self%array_name
endif
return
endif
enddo ! ii
testDebugCheckArrayI = .true.
endfunction
elemental subroutine destroyDebugCheckArrayI(self)
type(DebugCheckArrayI), intent(inout) :: self
integer :: ist
deallocate(self%array_data, stat=ist) ! ignore status
endsubroutine ! destroy
endmodule
!
!program TryDebugCheckArrayI
! use DebugCheckArrayI_mod
! implicit none
!
! integer, parameter :: dimx = 10
! integer, parameter :: dimy = 10
!
! integer, dimension(dimx, dimy) :: my_array
!
! integer :: x, y
! logical :: flag
!
! type(DebugCheckArrayI) :: db
!
! do y = 1, dimy
! do x = 1, dimx
! my_array(x,y) = x * y
! enddo
! enddo
!
! call createDebugCheckArrayI(db, my_array, dimx*dimy, "my_array")
!
! ! .. do something
!
! write(*,*) testDebugCheckArrayI(db, my_array)
!
! ! .. do something bad
!
! my_array(3,5) = -3
!
! write(*,*) testDebugCheckArrayI(db, my_array)
!
! ! use optional fail_message
! write(*,*) testDebugCheckArrayI(db, my_array, fail_message="location: main")
!
!
! call destroyDebugCheckArrayI(db)
!endprogram
! Author: Elias Rabel
module DebugCheckArrayZ_mod
implicit none
public
type DebugCheckArrayZ
private
double complex, allocatable :: array_data(:)
integer :: num_elements
character(len=32) :: array_name
endtype
contains
subroutine createDebugCheckArrayZ(self, array_to_check, num_elements, array_name)
type(DebugCheckArrayZ), intent(inout) :: self
double complex, intent(in) :: array_to_check(num_elements)
integer, intent(in) :: num_elements
character(len=*), intent(in) :: array_name
integer :: ii
allocate(self%array_data(num_elements))
self%num_elements = num_elements
self%array_name = array_name
do ii = 1, num_elements
self%array_data(ii) = array_to_check(ii)
enddo ! ii
endsubroutine
logical function testDebugCheckArrayZ(self, array_to_check, fail_message)
type(DebugCheckArrayZ), intent(in) :: self
double complex, intent(in) :: array_to_check(*) ! accept any array
character(len=*), intent(in), optional :: fail_message
integer :: ii
testDebugCheckArrayZ = .false.
do ii = 1, self%num_elements
if (self%array_data(ii) /= array_to_check(ii)) then
write(*,*) "testDebugCheckArrayZ: Arrays do not match. Element ", ii
if (present(fail_message)) then
write(*,*) self%array_name, fail_message
else
write(*,*) self%array_name
endif
return
endif
enddo ! ii
testDebugCheckArrayZ = .true.
endfunction
elemental subroutine destroyDebugCheckArrayZ(self)
type(DebugCheckArrayZ), intent(inout) :: self
integer :: ist
deallocate(self%array_data, stat=ist) ! ignore status
endsubroutine ! destroy
endmodule
!program TryDebugCheckArrayZ
! use DebugCheckArrayZ_mod
! implicit none
!
! integer, parameter :: dimx = 10
! integer, parameter :: dimy = 10
!
! double complex, dimension(dimx, dimy) :: my_array
!
! integer :: x, y
! logical :: flag
!
! type(DebugCheckArrayZ) :: db
!
! do y = 1, dimy
! do x = 1, dimx
! my_array(x,y) = x * y
! enddo
! enddo
!
! call createDebugCheckArrayZ(db, my_array, dimx*dimy, "my_array")
!
! ! .. do something
!
! write(*,*) testDebugCheckArrayZ(db, my_array)
!
! ! .. do something bad
!
! my_array(3,5) = -3
!
! write(*,*) testDebugCheckArrayZ(db, my_array)
!
! ! use optional fail_message
! write(*,*) testDebugCheckArrayZ(db, my_array, fail_message="location: main")
!
!
! call destroyDebugCheckArrayZ(db)
!endprogram
......@@ -13,10 +13,6 @@ module arraytest2_mod
module procedure ztest2d
module procedure ztest3d
module procedure ztest4d
!module procedure itest1d
! repeat until 4d
endinterface
contains
......@@ -93,7 +89,7 @@ module arraytest2_mod
double precision, intent(in) :: array(*)
integer, intent(in) :: length
double precision, external :: DNRM2
double precision, external :: DNRM2 ! from LAPACK
! print norm and average
write(unit=str, fmt='(a7,i4,x,a16,x,e16.9,x,e16.9)') &
......@@ -106,12 +102,11 @@ module arraytest2_mod
double complex, intent(in) :: array(*)
integer, intent(in) :: length
double precision, external :: DZNRM2
double precision, external :: DZNRM2 ! from LAPACK
! print norm and average
write(unit=str, fmt='(a7,i4,x,a16,x,e12.5,x,e12.5,x,e12.5)') &
"DEBUG: ", nr, msg, DZNRM2(length, array, 1), sum(array(1:length))/length
endfunction
endmodule
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment