Actual source code: ex4f.F
petsc-3.12.0 2019-09-29
1: !
2: ! Test AO with on IS with 0 entries - Fortran version of ex4.c
3: !
4: program main
5: #include <petsc/finclude/petscao.h>
6: use petscao
7: implicit none
9: PetscErrorCode ierr
10: AO ao
11: PetscInt localvert(4),nlocal
12: PetscMPIInt rank
13: IS is
14: PetscInt one,zero
16: ! Needed to work with 64 bit integers from Fortran
17: one = 1
18: zero = 0
20: call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
21: if (ierr .ne. 0) then
22: print*,'Unable to initialize PETSc'
23: stop
24: endif
25: call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
27: nlocal = 0
28: if (rank .eq. 0) then
29: nlocal = 4
30: localvert(1) = 0
31: localvert(2) = 1
32: localvert(3) = 2
33: localvert(4) = 3
34: endif
36: ! Test AOCreateBasic()
37: call AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, &
38: & PETSC_NULL_INTEGER,ao,ierr)
39: call AODestroy(ao,ierr)
41: ! Test AOCreateMemoryScalable()
42: call AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, &
43: & PETSC_NULL_INTEGER,ao,ierr)
44: call AODestroy(ao,ierr)
46: call AOCreate(PETSC_COMM_WORLD,ao,ierr)
47: call ISCreateStride(PETSC_COMM_WORLD,one,zero,one,is,ierr)
48: call AOSetIS(ao,is,is,ierr)
49: call AOSetType(ao,AOMEMORYSCALABLE,ierr)
50: call ISDestroy(is,ierr)
51: call AODestroy(ao,ierr)
53: call PetscFinalize(ierr)
54: end
58: !/*TEST
59: !
60: ! test:
61: ! output_file: output/ex4_1.out
62: !
63: ! test:
64: ! suffix: 2
65: ! nsize: 2
66: ! output_file: output/ex4_1.out
67: !
68: !TEST*/