Actual source code: ex4f.F90

  1: !
  2: !    Test AO with on IS with 0 entries - Fortran version of ex4.c
  3: !
  4: #include <petsc/finclude/petscao.h>
  5: program main
  6:   use petscao
  7:   implicit none

  9:   PetscErrorCode ierr
 10:   AO ao
 11:   PetscInt localvert(4), nlocal
 12:   PetscMPIInt rank
 13:   IS is

 15:   PetscCallA(PetscInitialize(ierr))
 16:   PetscCallMPIA(MPI_Comm_rank(PETSC_COMM_WORLD, rank, ierr))

 18:   if (rank == 0) then
 19:     nlocal = 4
 20:     localvert = [0, 1, 2, 3]
 21:   else
 22:     nlocal = 0
 23:   end if

 25: ! Test AOCreateBasic()
 26:   PetscCallA(AOCreateBasic(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL_INTEGER_ARRAY, ao, ierr))
 27:   PetscCallA(AODestroy(ao, ierr))

 29: ! Test AOCreateMemoryScalable()
 30:   PetscCallA(AOCreateMemoryScalable(PETSC_COMM_WORLD, nlocal, localvert, PETSC_NULL_INTEGER_ARRAY, ao, ierr))
 31:   PetscCallA(AODestroy(ao, ierr))

 33:   PetscCallA(AOCreate(PETSC_COMM_WORLD, ao, ierr))
 34:   PetscCallA(ISCreateStride(PETSC_COMM_WORLD, 1_PETSC_INT_KIND, 0_PETSC_INT_KIND, 1_PETSC_INT_KIND, is, ierr))
 35:   PetscCallA(AOSetIS(ao, is, is, ierr))
 36:   PetscCallA(AOSetType(ao, AOMEMORYSCALABLE, ierr))
 37:   PetscCallA(ISDestroy(is, ierr))
 38:   PetscCallA(AODestroy(ao, ierr))

 40:   PetscCallA(PetscFinalize(ierr))
 41: end

 43: !/*TEST
 44: !
 45: !   test:
 46: !     output_file: output/empty.out
 47: !
 48: !   test:
 49: !      suffix: 2
 50: !      nsize: 2
 51: !      output_file: output/empty.out
 52: !
 53: !TEST*/