1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
!
! Progran to test random number generation routines from fortran.
!
program main
#include <finclude/petscsys.h>
PetscErrorCode ierr
PetscRandom r
PetscScalar rand
call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
if (ierr .ne. 0) then
print*, 'Unable to begin PETSc program'
endif
call PetscRandomCreate(PETSC_COMM_WORLD,r,ierr)
call PetscRandomSetFromOptions(r,ierr)
call PetscRandomGetValue(r,rand,ierr)
print*, 'Random value:',rand
call PetscRandomDestroy(r,ierr)
call PetscFinalize(ierr)
end
|