Actual source code: ex49f.F90
petsc-3.12.1 2019-10-22
1: !
2: ! Test Fortran binding of sort routines
3: !
4: program main
5: #include "petsc/finclude/petsc.h"
7: use petsc
8: implicit none
10: PetscErrorCode ierr
11: PetscInt,parameter:: N=3
12: PetscMPIInt,parameter:: mN=3
13: PetscInt x(N),y(N),z(N)
14: PetscMPIInt mx(N),my(N),mz(N)
15: PetscScalar s(N)
16: PetscReal r(N)
18: call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
20: x = [3, 2, 1]
21: y = [6, 5, 4]
22: z = [3, 5, 2]
23: mx = [5, 7, 2]
24: my = [5, 7, 2]
25: mz = [5, 7, 2]
26: s = [1.0, 2.0, 3.0]
27: r = [1.0, 2.0, 3.0]
29: call PetscSortInt(N,x,ierr)
30: call PetscSortIntWithArray(N,y,x,ierr)
31: call PetscSortIntWithArrayPair(N,x,y,z,ierr)
33: call PetscSortMPIInt(N,mx,ierr)
34: call PetscSortMPIIntWithArray(mN,mx,my,ierr)
35: call PetscSortMPIIntWithIntArray(mN,mx,y,ierr)
37: call PetscSortIntWithScalarArray(N,x,s,ierr)
39: call PetscSortReal(N,r,ierr)
40: call PetscSortRealWithArrayInt(N,r,x,ierr)
42: call PetscFinalize(ierr)
43: end program
45: !/*TEST
46: !
47: ! test:
48: !
49: !TEST*/