2023-06-03 11:50:04 +02:00
|
|
|
module mathstuff2
|
|
|
|
|
|
|
|
! XXX This module was a copy of mathstuff.f90 fromthe BloubWorld
|
|
|
|
! XXX will be moved in an other place some day...
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
contains
|
|
|
|
|
2024-02-07 00:39:00 +01:00
|
|
|
! ----------------------------------------------------------------
|
|
|
|
! really quick'n'dirty hack
|
|
|
|
! not really tested yet...
|
2023-06-03 11:50:04 +02:00
|
|
|
subroutine init_random_seed()
|
|
|
|
|
|
|
|
integer, dimension(3) :: tarray
|
|
|
|
integer :: t3, foo
|
|
|
|
real :: dummy
|
2024-02-07 00:39:00 +01:00
|
|
|
|
2023-06-03 11:50:04 +02:00
|
|
|
call itime(tarray)
|
|
|
|
t3 = 3600*tarray(1) + 60*tarray(2) + tarray(3)
|
|
|
|
! write(0, '(A,3I3,A,I6)') "sranding: ", tarray, " --> ", t3
|
|
|
|
call srand(t3)
|
|
|
|
|
|
|
|
! after initializing the random generator engine,
|
|
|
|
! you MUST use it for initializing the initializer
|
2023-06-06 12:22:56 +02:00
|
|
|
do foo=1, tarray(1)+15
|
2023-06-03 11:50:04 +02:00
|
|
|
dummy = rand()
|
|
|
|
enddo
|
|
|
|
|
|
|
|
end subroutine
|
|
|
|
|
2024-02-07 00:39:00 +01:00
|
|
|
! ----------------------------------------------------------------
|
|
|
|
!-
|
|
|
|
!- May be I can make some generic procedures ?
|
|
|
|
!-
|
2024-01-06 02:54:06 +01:00
|
|
|
logical function diff_sign(a, b)
|
|
|
|
integer, intent(in) :: a, b
|
|
|
|
|
|
|
|
! write(0, *) "diff_sign", a, b
|
|
|
|
if ( (a .lt. 0) .and. (b .ge. 0) ) then
|
|
|
|
diff_sign = .TRUE.
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
if ( (a .ge. 0) .and. (b .lt. 0) ) then
|
|
|
|
diff_sign = .TRUE.
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
diff_sign = .FALSE.
|
|
|
|
|
|
|
|
end function
|
2024-02-07 00:39:00 +01:00
|
|
|
! ----------------------------------------------------------------
|
2023-06-03 11:50:04 +02:00
|
|
|
end module mathstuff2
|
|
|
|
|