xref: /petsc/src/sys/tests/ex49f.F90 (revision 86e171c2e8cb2483b83c668879cf08e5ef2d2eed)
1!
2!  Test Fortran binding of sort routines
3!
4program main
5#include "petsc/finclude/petsc.h"
6
7  use petsc
8  implicit none
9
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)
17  PetscMPIInt,parameter:: two=2, five=5, seven=7
18
19  call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
20
21  x  = [3, 2, 1]
22  y  = [6, 5, 4]
23  z  = [3, 5, 2]
24  mx = [five, seven, two]
25  my = [five, seven, two]
26  mz = [five, seven, two]
27  s  = [1.0, 2.0, 3.0]
28  r  = [1.0, 2.0, 3.0]
29
30  call PetscSortInt(N,x,ierr)
31  call PetscSortIntWithArray(N,y,x,ierr)
32  call PetscSortIntWithArrayPair(N,x,y,z,ierr)
33
34  call PetscSortMPIInt(N,mx,ierr)
35  call PetscSortMPIIntWithArray(mN,mx,my,ierr)
36  call PetscSortMPIIntWithIntArray(mN,mx,y,ierr)
37
38  call PetscSortIntWithScalarArray(N,x,s,ierr)
39
40  call PetscSortReal(N,r,ierr)
41  call PetscSortRealWithArrayInt(N,r,x,ierr)
42
43  call PetscFinalize(ierr)
44end program
45
46!/*TEST
47!
48!   test:
49!
50!TEST*/
51