Actual source code: ex13f.F90

  1: !
  2: !  Program to test object composition from Fortran
  3: !
  4: #include <petsc/finclude/petscsys.h>
  5: program main
  6:   use petscsys
  7:   implicit none

  9:   PetscErrorCode ierr
 10:   PetscViewer o1, o2, o3
 11:   character(len=4) name
 12:   PetscCopyMode :: mode = PETSC_COPY_VALUES

 14:   PetscCallA(PetscInitialize(ierr))
 15:   PetscCallA(PetscViewerASCIIOpen(PETSC_COMM_WORLD, "stdout", o1, ierr))
 16:   PetscCallA(PetscViewerASCIIOpen(PETSC_COMM_WORLD, "stderr", o2, ierr))
 17:   name = 'matt'
 18:   PetscCallA(PetscObjectCompose(o1, name, o2, ierr))
 19:   PetscCallA(PetscObjectQuery(o1, name, o3, ierr))
 20:   PetscCheckA(o2 == o3, PETSC_COMM_SELF, PETSC_ERR_PLIB, 'PetscObjectQuery failed')

 22:   if (mode == PETSC_COPY_VALUES) then
 23:     PetscCallA(PetscViewerDestroy(o1, ierr))
 24:   end if
 25:   PetscCallA(PetscViewerDestroy(o2, ierr))
 26:   PetscCallA(PetscFinalize(ierr))
 27: end

 29: !
 30: !/*TEST
 31: !
 32: !   test:
 33: !     suffix: 0
 34: !     output_file: output/empty.out
 35: !
 36: !TEST*/