Actual source code: ex6f.F

petsc-3.12.2 2019-11-22
Report Typos and Errors
  1: !
  2: !  Program to test random number generation routines from fortran.
  3: !
  4:       program main

  6:  #include <petsc/finclude/petscsys.h>
  7:        use petscsys
  8:        implicit none

 10:       PetscErrorCode  ierr
 11:       PetscRandom     r
 12:       PetscScalar     rand

 14:       call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
 15:       if (ierr .ne. 0) then
 16:          print*, 'Unable to begin PETSc program'
 17:       endif

 19:       call PetscRandomCreate(PETSC_COMM_WORLD,r,ierr)
 20:       call PetscRandomSetFromOptions(r,ierr)
 21:       call PetscRandomGetValue(r,rand,ierr)
 22:       print*, 'Random value:',rand

 24:       call PetscRandomDestroy(r,ierr)
 25:       call PetscFinalize(ierr)
 26:       end

 28: !
 29: !/*TEST
 30: !
 31: !   test:
 32: !      requires: !complex
 33: !
 34: !TEST*/