also report correctly negative seeds

This commit is contained in:
Martin Diehl 2020-02-01 09:04:02 +01:00
parent 26496976c8
commit 588525611b
2 changed files with 7 additions and 9 deletions

View File

@ -91,28 +91,26 @@ subroutine math_init
integer :: randSize integer :: randSize
integer, dimension(:), allocatable :: randInit integer, dimension(:), allocatable :: randInit
write(6,'(/,a)') ' <<<+- math init -+>>>' write(6,'(/,a)') ' <<<+- math init -+>>>'; flush(6)
call random_seed(size=randSize) call random_seed(size=randSize)
allocate(randInit(randSize)) allocate(randInit(randSize))
if (randomSeed > 0) then if (randomSeed > 0) then
randInit = randomSeed randInit = randomSeed
call random_seed(put=randInit)
else else
call random_seed() call random_seed()
call random_seed(get = randInit) call random_seed(get = randInit)
randInit(2:randSize) = randInit(1) randInit(2:randSize) = randInit(1)
call random_seed(put = randInit)
endif endif
call random_seed(put=randInit)
do i = 1, 4 do i = 1, 4
call random_number(randTest(i)) call random_number(randTest(i))
enddo enddo
write(6,'(a,I2)') ' size of random seed: ', randSize write(6,'(a,i2)') ' size of random seed: ', randSize
do i = 1,randSize write(6,'(a,i0)') ' value of random seed: ', randInit(1)
write(6,'(a,I2,I14)') ' value of random seed: ', i, randInit(i)
enddo
write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest
call random_seed(put = randInit) call random_seed(put = randInit)

View File

@ -54,12 +54,12 @@ subroutine mesh_init(ip,el)
node0_cell node0_cell
type(tElement) :: elem type(tElement) :: elem
integer :: nElems
integer, dimension(:), allocatable :: & integer, dimension(:), allocatable :: &
microstructureAt, & microstructureAt, &
homogenizationAt homogenizationAt
integer:: & integer:: &
Nnodes !< total number of nodes in mesh Nnodes, & !< total number of nodes in the mesh
Nelems !< total number of elements in the mesh
real(pReal), dimension(:,:), allocatable :: & real(pReal), dimension(:,:), allocatable :: &
IP_reshaped IP_reshaped