1! 2! 3! Test for PetscFOpen() from Fortran 4! 5program main 6#include <petsc/finclude/petscsys.h> 7 use petscsys 8 implicit none 9 10 PetscErrorCode ierr 11 PetscMPIInt rank 12 PetscFortranAddr file 13 character*100 joe 14 15 PetscCallA(PetscInitialize(ierr)) 16 PetscCallMPIA(MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr)) 17 18 PetscCallA(PetscFOpen(PETSC_COMM_WORLD, 'testfile', 'w', file, ierr)) 19 20 PetscCallA(PetscFPrintf(PETSC_COMM_WORLD, file, 'Hi once \n', ierr)) 21 PetscCallA(PetscSynchronizedFPrintf(PETSC_COMM_WORLD, file, 'Hi twice \n', ierr)) 22 PetscCallA(PetscSynchronizedFlush(PETSC_COMM_WORLD, file, ierr)) 23 24 write (FMT=*, UNIT=joe) 'greetings from ', rank, '\n' 25 PetscCallA(PetscSynchronizedFPrintf(PETSC_COMM_WORLD, file, joe, ierr)) 26 PetscCallA(PetscSynchronizedFlush(PETSC_COMM_WORLD, file, ierr)) 27 28 PetscCallA(PetscFClose(PETSC_COMM_WORLD, file, ierr)) 29 30 PetscCallA(PetscSynchronizedPrintf(PETSC_COMM_WORLD, 'Hi twice \n', ierr)) 31 PetscCallA(PetscSynchronizedFlush(PETSC_COMM_WORLD, PETSC_STDOUT, ierr)) 32 33 PetscCallA(PetscFinalize(ierr)) 34end 35 36! 37!/*TEST 38! 39! test: 40! nsize: 3 41! 42!TEST*/ 43