xref: /petsc/src/vec/is/ao/tests/ex4f.F90 (revision 9b88ac225e01f016352a5f4cd90e158abe5f5675)
1!
2!    Test AO with on IS with 0 entries - Fortran version of ex4.c
3!
4#include <petsc/finclude/petscao.h>
5program main
6  use petscao
7  implicit none
8
9  PetscErrorCode ierr
10  AO ao
11  PetscInt localvert(4), nlocal
12  PetscMPIInt rank
13  IS is
14  PetscInt one, zero
15
16!  Needed to work with 64-bit integers from Fortran
17  one = 1
18  zero = 0
19
20  PetscCallA(PetscInitialize(ierr))
21  PetscCallMPIA(MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr))
22
23  nlocal = 0
24  if (rank == 0) then
25    nlocal = 4
26    localvert(1) = 0
27    localvert(2) = 1
28    localvert(3) = 2
29    localvert(4) = 3
30  end if
31
32!     Test AOCreateBasic()
33  PetscCallA(AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL_INTEGER_ARRAY, ao, ierr))
34  PetscCallA(AODestroy(ao, ierr))
35
36!     Test AOCreateMemoryScalable()
37  PetscCallA(AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL_INTEGER_ARRAY, ao, ierr))
38  PetscCallA(AODestroy(ao, ierr))
39
40  PetscCallA(AOCreate(PETSC_COMM_WORLD, ao, ierr))
41  PetscCallA(ISCreateStride(PETSC_COMM_WORLD, one, zero, one, is, ierr))
42  PetscCallA(AOSetIS(ao, is, is, ierr))
43  PetscCallA(AOSetType(ao, AOMEMORYSCALABLE, ierr))
44  PetscCallA(ISDestroy(is, ierr))
45  PetscCallA(AODestroy(ao, ierr))
46
47  PetscCallA(PetscFinalize(ierr))
48end
49
50!/*TEST
51!
52!   test:
53!     output_file: output/empty.out
54!
55!   test:
56!      suffix: 2
57!      nsize: 2
58!      output_file: output/empty.out
59!
60!TEST*/
61