xref: /petsc/src/sys/tests/ex13f.F90 (revision d52a580b706c59ca78066c1e38754e45b6b56e2b)
1!
2!  Program to test object composition from Fortran
3!
4#include <petsc/finclude/petscsys.h>
5program main
6  use petscsys
7  implicit none
8
9  PetscErrorCode ierr
10  PetscViewer o1, o2, o3
11  character*(4) name
12  PetscCopyMode :: mode = PETSC_COPY_VALUES
13
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')
21
22  if (mode == PETSC_COPY_VALUES) then
23    PetscCallA(PetscViewerDestroy(o1, ierr))
24  end if
25  PetscCallA(PetscViewerDestroy(o2, ierr))
26  PetscCallA(PetscFinalize(ierr))
27end
28
29!
30!/*TEST
31!
32!   test:
33!     suffix: 0
34!     output_file: output/empty.out
35!
36!TEST*/
37