xref: /petsc/src/vec/is/tests/ex4f.F90 (revision 3886731f808f6f9ca8348e6e791c818340d72f91)
17aaa936aSBarry Smith!
2ce78bad3SBarry Smith!     Test for bug with ISGetIndices() when length of indices is 0
37aaa936aSBarry Smith!
47aaa936aSBarry Smith!     Contributed by: Jakub Fabian
57aaa936aSBarry Smith!
67aaa936aSBarry Smithprogram main
77aaa936aSBarry Smith#include <petsc/finclude/petscis.h>
87aaa936aSBarry Smith  use petscis
97aaa936aSBarry Smith  implicit none
107aaa936aSBarry Smith
117aaa936aSBarry Smith  PetscErrorCode ierr
127aaa936aSBarry Smith  PetscInt n, bs
137aaa936aSBarry Smith  PetscInt, pointer :: indices(:)=>NULL()
147aaa936aSBarry Smith  PetscInt, pointer :: idx(:)=>NULL()
157aaa936aSBarry Smith  IS      is
167aaa936aSBarry Smith
177aaa936aSBarry Smith  n = 0
187aaa936aSBarry Smith  allocate(indices(n), source=n)
197aaa936aSBarry Smith
20d8606c27SBarry Smith  PetscCallA(PetscInitialize(ierr))
217aaa936aSBarry Smith
22d8606c27SBarry Smith  PetscCallA(ISCreateGeneral(PETSC_COMM_SELF,n,indices,PETSC_USE_POINTER,is,ierr))
23ce78bad3SBarry Smith  PetscCallA(ISGetIndices(is,idx,ierr))
24ce78bad3SBarry Smith  PetscCallA(ISRestoreIndices(is,idx,ierr))
25d8606c27SBarry Smith  PetscCallA(ISDestroy(is,ierr))
267aaa936aSBarry Smith
277aaa936aSBarry Smith  bs = 2
28d8606c27SBarry Smith  PetscCallA(ISCreateBlock(PETSC_COMM_SELF,bs,n,indices,PETSC_USE_POINTER,is,ierr))
29ce78bad3SBarry Smith  PetscCallA(ISGetIndices(is,idx,ierr))
30ce78bad3SBarry Smith  PetscCallA(ISRestoreIndices(is,idx,ierr))
31d8606c27SBarry Smith  PetscCallA(ISDestroy(is,ierr))
32d8606c27SBarry Smith  PetscCallA(PetscFinalize(ierr))
337aaa936aSBarry Smithend
347aaa936aSBarry Smith
357aaa936aSBarry Smith!/*TEST
367aaa936aSBarry Smith!
377aaa936aSBarry Smith!   test:
38*3886731fSPierre Jolivet!      output_file: output/empty.out
397aaa936aSBarry Smith!
407aaa936aSBarry Smith!TEST*/
41