static char help[] = "Tests application ordering.\n\n"; #include #include #include int main(int argc,char **argv) { PetscMPIInt rank,size; PetscInt n,*ispetsc,*isapp,start,N,i; AO ao; PetscFunctionBeginUser; PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); PetscCall(PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL)); PetscCallMPI(MPI_Comm_rank(PETSC_COMM_WORLD,&rank));n = rank + 2; PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD,&size)); /* create the orderings */ PetscCall(PetscMalloc2(n,&ispetsc,n,&isapp)); PetscCallMPI(MPI_Scan(&n,&start,1,MPIU_INT,MPI_SUM,PETSC_COMM_WORLD)); PetscCallMPI(MPI_Allreduce(&n,&N,1,MPIU_INT,MPI_SUM,PETSC_COMM_WORLD)); start -= n; for (i=0; i