Actual source code: ex49f.F90

petsc-3.13.4 2020-08-01
Report Typos and Errors
  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)
 17:   PetscMPIInt,parameter:: two=2, five=5, seven=7

 19:   call PetscInitialize(PETSC_NULL_CHARACTER,ierr)

 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]

 30:   call PetscSortInt(N,x,ierr)
 31:   call PetscSortIntWithArray(N,y,x,ierr)
 32:   call PetscSortIntWithArrayPair(N,x,y,z,ierr)

 34:   call PetscSortMPIInt(N,mx,ierr)
 35:   call PetscSortMPIIntWithArray(mN,mx,my,ierr)
 36:   call PetscSortMPIIntWithIntArray(mN,mx,y,ierr)

 38:   call PetscSortIntWithScalarArray(N,x,s,ierr)

 40:   call PetscSortReal(N,r,ierr)
 41:   call PetscSortRealWithArrayInt(N,r,x,ierr)

 43:   call PetscFinalize(ierr)
 44: end program

 46: !/*TEST
 47: !
 48: !   test:
 49: !
 50: !TEST*/