11447629fSBarry Smith 21447629fSBarry Smith /* 31447629fSBarry Smith The most basic AO application ordering routines. These store the 41447629fSBarry Smith entire orderings on each processor. 51447629fSBarry Smith */ 61447629fSBarry Smith 71447629fSBarry Smith #include <../src/vec/is/ao/aoimpl.h> /*I "petscao.h" I*/ 81447629fSBarry Smith 91447629fSBarry Smith typedef struct { 101447629fSBarry Smith PetscInt *app; /* app[i] is the partner for the ith PETSc slot */ 111447629fSBarry Smith PetscInt *petsc; /* petsc[j] is the partner for the jth app slot */ 121447629fSBarry Smith } AO_Basic; 131447629fSBarry Smith 141447629fSBarry Smith /* 151447629fSBarry Smith All processors have the same data so processor 1 prints it 161447629fSBarry Smith */ 171447629fSBarry Smith PetscErrorCode AOView_Basic(AO ao,PetscViewer viewer) 181447629fSBarry Smith { 191447629fSBarry Smith PetscErrorCode ierr; 201447629fSBarry Smith PetscMPIInt rank; 211447629fSBarry Smith PetscInt i; 221447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*)ao->data; 231447629fSBarry Smith PetscBool iascii; 241447629fSBarry Smith 251447629fSBarry Smith PetscFunctionBegin; 261447629fSBarry Smith ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)ao),&rank);CHKERRQ(ierr); 271447629fSBarry Smith if (!rank) { 281447629fSBarry Smith ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr); 291447629fSBarry Smith if (iascii) { 301447629fSBarry Smith ierr = PetscViewerASCIIPrintf(viewer,"Number of elements in ordering %D\n",ao->N);CHKERRQ(ierr); 311447629fSBarry Smith ierr = PetscViewerASCIIPrintf(viewer, "PETSc->App App->PETSc\n");CHKERRQ(ierr); 321447629fSBarry Smith for (i=0; i<ao->N; i++) { 331447629fSBarry Smith ierr = PetscViewerASCIIPrintf(viewer,"%3D %3D %3D %3D\n",i,aobasic->app[i],i,aobasic->petsc[i]);CHKERRQ(ierr); 341447629fSBarry Smith } 351447629fSBarry Smith } 361447629fSBarry Smith } 371447629fSBarry Smith ierr = PetscViewerFlush(viewer);CHKERRQ(ierr); 381447629fSBarry Smith PetscFunctionReturn(0); 391447629fSBarry Smith } 401447629fSBarry Smith 411447629fSBarry Smith PetscErrorCode AODestroy_Basic(AO ao) 421447629fSBarry Smith { 431447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*)ao->data; 441447629fSBarry Smith PetscErrorCode ierr; 451447629fSBarry Smith 461447629fSBarry Smith PetscFunctionBegin; 471447629fSBarry Smith ierr = PetscFree2(aobasic->app,aobasic->petsc);CHKERRQ(ierr); 481447629fSBarry Smith ierr = PetscFree(aobasic);CHKERRQ(ierr); 491447629fSBarry Smith PetscFunctionReturn(0); 501447629fSBarry Smith } 511447629fSBarry Smith 521447629fSBarry Smith PetscErrorCode AOBasicGetIndices_Private(AO ao,PetscInt **app,PetscInt **petsc) 531447629fSBarry Smith { 541447629fSBarry Smith AO_Basic *basic = (AO_Basic*)ao->data; 551447629fSBarry Smith 561447629fSBarry Smith PetscFunctionBegin; 571447629fSBarry Smith if (app) *app = basic->app; 581447629fSBarry Smith if (petsc) *petsc = basic->petsc; 591447629fSBarry Smith PetscFunctionReturn(0); 601447629fSBarry Smith } 611447629fSBarry Smith 621447629fSBarry Smith PetscErrorCode AOPetscToApplication_Basic(AO ao,PetscInt n,PetscInt *ia) 631447629fSBarry Smith { 641447629fSBarry Smith PetscInt i,N=ao->N; 651447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*)ao->data; 661447629fSBarry Smith 671447629fSBarry Smith PetscFunctionBegin; 681447629fSBarry Smith for (i=0; i<n; i++) { 691447629fSBarry Smith if (ia[i] >= 0 && ia[i] < N) { 701447629fSBarry Smith ia[i] = aobasic->app[ia[i]]; 711447629fSBarry Smith } else { 721447629fSBarry Smith ia[i] = -1; 731447629fSBarry Smith } 741447629fSBarry Smith } 751447629fSBarry Smith PetscFunctionReturn(0); 761447629fSBarry Smith } 771447629fSBarry Smith 781447629fSBarry Smith PetscErrorCode AOApplicationToPetsc_Basic(AO ao,PetscInt n,PetscInt *ia) 791447629fSBarry Smith { 801447629fSBarry Smith PetscInt i,N=ao->N; 811447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*)ao->data; 821447629fSBarry Smith 831447629fSBarry Smith PetscFunctionBegin; 841447629fSBarry Smith for (i=0; i<n; i++) { 851447629fSBarry Smith if (ia[i] >= 0 && ia[i] < N) { 861447629fSBarry Smith ia[i] = aobasic->petsc[ia[i]]; 871447629fSBarry Smith } else { 881447629fSBarry Smith ia[i] = -1; 891447629fSBarry Smith } 901447629fSBarry Smith } 911447629fSBarry Smith PetscFunctionReturn(0); 921447629fSBarry Smith } 931447629fSBarry Smith 941447629fSBarry Smith PetscErrorCode AOPetscToApplicationPermuteInt_Basic(AO ao, PetscInt block, PetscInt *array) 951447629fSBarry Smith { 961447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*) ao->data; 971447629fSBarry Smith PetscInt *temp; 981447629fSBarry Smith PetscInt i, j; 991447629fSBarry Smith PetscErrorCode ierr; 1001447629fSBarry Smith 1011447629fSBarry Smith PetscFunctionBegin; 102785e854fSJed Brown ierr = PetscMalloc1(ao->N*block, &temp);CHKERRQ(ierr); 1031447629fSBarry Smith for (i = 0; i < ao->N; i++) { 1041447629fSBarry Smith for (j = 0; j < block; j++) temp[i*block+j] = array[aobasic->petsc[i]*block+j]; 1051447629fSBarry Smith } 106580bdb30SBarry Smith ierr = PetscArraycpy(array, temp, ao->N*block);CHKERRQ(ierr); 1071447629fSBarry Smith ierr = PetscFree(temp);CHKERRQ(ierr); 1081447629fSBarry Smith PetscFunctionReturn(0); 1091447629fSBarry Smith } 1101447629fSBarry Smith 1111447629fSBarry Smith PetscErrorCode AOApplicationToPetscPermuteInt_Basic(AO ao, PetscInt block, PetscInt *array) 1121447629fSBarry Smith { 1131447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*) ao->data; 1141447629fSBarry Smith PetscInt *temp; 1151447629fSBarry Smith PetscInt i, j; 1161447629fSBarry Smith PetscErrorCode ierr; 1171447629fSBarry Smith 1181447629fSBarry Smith PetscFunctionBegin; 119785e854fSJed Brown ierr = PetscMalloc1(ao->N*block, &temp);CHKERRQ(ierr); 1201447629fSBarry Smith for (i = 0; i < ao->N; i++) { 1211447629fSBarry Smith for (j = 0; j < block; j++) temp[i*block+j] = array[aobasic->app[i]*block+j]; 1221447629fSBarry Smith } 123580bdb30SBarry Smith ierr = PetscArraycpy(array, temp, ao->N*block);CHKERRQ(ierr); 1241447629fSBarry Smith ierr = PetscFree(temp);CHKERRQ(ierr); 1251447629fSBarry Smith PetscFunctionReturn(0); 1261447629fSBarry Smith } 1271447629fSBarry Smith 1281447629fSBarry Smith PetscErrorCode AOPetscToApplicationPermuteReal_Basic(AO ao, PetscInt block, PetscReal *array) 1291447629fSBarry Smith { 1301447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*) ao->data; 1311447629fSBarry Smith PetscReal *temp; 1321447629fSBarry Smith PetscInt i, j; 1331447629fSBarry Smith PetscErrorCode ierr; 1341447629fSBarry Smith 1351447629fSBarry Smith PetscFunctionBegin; 136785e854fSJed Brown ierr = PetscMalloc1(ao->N*block, &temp);CHKERRQ(ierr); 1371447629fSBarry Smith for (i = 0; i < ao->N; i++) { 1381447629fSBarry Smith for (j = 0; j < block; j++) temp[i*block+j] = array[aobasic->petsc[i]*block+j]; 1391447629fSBarry Smith } 140580bdb30SBarry Smith ierr = PetscArraycpy(array, temp, ao->N*block);CHKERRQ(ierr); 1411447629fSBarry Smith ierr = PetscFree(temp);CHKERRQ(ierr); 1421447629fSBarry Smith PetscFunctionReturn(0); 1431447629fSBarry Smith } 1441447629fSBarry Smith 1451447629fSBarry Smith PetscErrorCode AOApplicationToPetscPermuteReal_Basic(AO ao, PetscInt block, PetscReal *array) 1461447629fSBarry Smith { 1471447629fSBarry Smith AO_Basic *aobasic = (AO_Basic*) ao->data; 1481447629fSBarry Smith PetscReal *temp; 1491447629fSBarry Smith PetscInt i, j; 1501447629fSBarry Smith PetscErrorCode ierr; 1511447629fSBarry Smith 1521447629fSBarry Smith PetscFunctionBegin; 153785e854fSJed Brown ierr = PetscMalloc1(ao->N*block, &temp);CHKERRQ(ierr); 1541447629fSBarry Smith for (i = 0; i < ao->N; i++) { 1551447629fSBarry Smith for (j = 0; j < block; j++) temp[i*block+j] = array[aobasic->app[i]*block+j]; 1561447629fSBarry Smith } 157580bdb30SBarry Smith ierr = PetscArraycpy(array, temp, ao->N*block);CHKERRQ(ierr); 1581447629fSBarry Smith ierr = PetscFree(temp);CHKERRQ(ierr); 1591447629fSBarry Smith PetscFunctionReturn(0); 1601447629fSBarry Smith } 1611447629fSBarry Smith 1621447629fSBarry Smith static struct _AOOps AOOps_Basic = { 1631447629fSBarry Smith AOView_Basic, 1641447629fSBarry Smith AODestroy_Basic, 1651447629fSBarry Smith AOPetscToApplication_Basic, 1661447629fSBarry Smith AOApplicationToPetsc_Basic, 1671447629fSBarry Smith AOPetscToApplicationPermuteInt_Basic, 1681447629fSBarry Smith AOApplicationToPetscPermuteInt_Basic, 1691447629fSBarry Smith AOPetscToApplicationPermuteReal_Basic, 1701447629fSBarry Smith AOApplicationToPetscPermuteReal_Basic 1711447629fSBarry Smith }; 1721447629fSBarry Smith 1738cc058d9SJed Brown PETSC_EXTERN PetscErrorCode AOCreate_Basic(AO ao) 1741447629fSBarry Smith { 1751447629fSBarry Smith AO_Basic *aobasic; 1761447629fSBarry Smith PetscMPIInt size,rank,count,*lens,*disp; 1771447629fSBarry Smith PetscInt napp,*allpetsc,*allapp,ip,ia,N,i,*petsc=NULL,start; 1781447629fSBarry Smith PetscErrorCode ierr; 1791447629fSBarry Smith IS isapp=ao->isapp,ispetsc=ao->ispetsc; 1801447629fSBarry Smith MPI_Comm comm; 1811447629fSBarry Smith const PetscInt *myapp,*mypetsc=NULL; 1821447629fSBarry Smith 1831447629fSBarry Smith PetscFunctionBegin; 1841447629fSBarry Smith /* create special struct aobasic */ 185b00a9115SJed Brown ierr = PetscNewLog(ao,&aobasic);CHKERRQ(ierr); 1861447629fSBarry Smith ao->data = (void*) aobasic; 1871447629fSBarry Smith ierr = PetscMemcpy(ao->ops,&AOOps_Basic,sizeof(struct _AOOps));CHKERRQ(ierr); 1881447629fSBarry Smith ierr = PetscObjectChangeTypeName((PetscObject)ao,AOBASIC);CHKERRQ(ierr); 1891447629fSBarry Smith 1901447629fSBarry Smith ierr = ISGetLocalSize(isapp,&napp);CHKERRQ(ierr); 1911447629fSBarry Smith ierr = ISGetIndices(isapp,&myapp);CHKERRQ(ierr); 1921447629fSBarry Smith 1931447629fSBarry Smith ierr = PetscMPIIntCast(napp,&count);CHKERRQ(ierr); 1941447629fSBarry Smith 1951447629fSBarry Smith /* transmit all lengths to all processors */ 1961447629fSBarry Smith ierr = PetscObjectGetComm((PetscObject)isapp,&comm);CHKERRQ(ierr); 1971447629fSBarry Smith ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr); 1981447629fSBarry Smith ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr); 199dcca6d9dSJed Brown ierr = PetscMalloc2(size, &lens,size,&disp);CHKERRQ(ierr); 2001447629fSBarry Smith ierr = MPI_Allgather(&count, 1, MPI_INT, lens, 1, MPI_INT, comm);CHKERRQ(ierr); 2011447629fSBarry Smith N = 0; 2021447629fSBarry Smith for (i = 0; i < size; i++) { 2031447629fSBarry Smith ierr = PetscMPIIntCast(N,disp+i);CHKERRQ(ierr); /* = sum(lens[j]), j< i */ 2041447629fSBarry Smith N += lens[i]; 2051447629fSBarry Smith } 2061447629fSBarry Smith ao->N = N; 2071447629fSBarry Smith ao->n = N; 2081447629fSBarry Smith 2091447629fSBarry Smith /* If mypetsc is 0 then use "natural" numbering */ 2101447629fSBarry Smith if (napp) { 2111447629fSBarry Smith if (!ispetsc) { 2121447629fSBarry Smith start = disp[rank]; 213854ce69bSBarry Smith ierr = PetscMalloc1(napp+1, &petsc);CHKERRQ(ierr); 2141447629fSBarry Smith for (i=0; i<napp; i++) petsc[i] = start + i; 2151447629fSBarry Smith } else { 2161447629fSBarry Smith ierr = ISGetIndices(ispetsc,&mypetsc);CHKERRQ(ierr); 2171447629fSBarry Smith petsc = (PetscInt*)mypetsc; 2181447629fSBarry Smith } 2191447629fSBarry Smith } 2201447629fSBarry Smith 2211447629fSBarry Smith /* get all indices on all processors */ 222dcca6d9dSJed Brown ierr = PetscMalloc2(N,&allpetsc,N,&allapp);CHKERRQ(ierr); 2231447629fSBarry Smith ierr = MPI_Allgatherv(petsc, count, MPIU_INT, allpetsc, lens, disp, MPIU_INT, comm);CHKERRQ(ierr); 2241447629fSBarry Smith ierr = MPI_Allgatherv((void*)myapp, count, MPIU_INT, allapp, lens, disp, MPIU_INT, comm);CHKERRQ(ierr); 2251447629fSBarry Smith ierr = PetscFree2(lens,disp);CHKERRQ(ierr); 2261447629fSBarry Smith 227*4e1ad211SJed Brown if (PetscDefined(USE_DEBUG)) { 2281447629fSBarry Smith PetscInt *sorted; 229785e854fSJed Brown ierr = PetscMalloc1(N,&sorted);CHKERRQ(ierr); 2301447629fSBarry Smith 231580bdb30SBarry Smith ierr = PetscArraycpy(sorted,allpetsc,N);CHKERRQ(ierr); 2321447629fSBarry Smith ierr = PetscSortInt(N,sorted);CHKERRQ(ierr); 2331447629fSBarry Smith for (i=0; i<N; i++) { 2341447629fSBarry Smith if (sorted[i] != i) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"PETSc ordering requires a permutation of numbers 0 to N-1\n it is missing %D has %D",i,sorted[i]); 2351447629fSBarry Smith } 2361447629fSBarry Smith 237580bdb30SBarry Smith ierr = PetscArraycpy(sorted,allapp,N);CHKERRQ(ierr); 2381447629fSBarry Smith ierr = PetscSortInt(N,sorted);CHKERRQ(ierr); 2391447629fSBarry Smith for (i=0; i<N; i++) { 2401447629fSBarry Smith if (sorted[i] != i) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Application ordering requires a permutation of numbers 0 to N-1\n it is missing %D has %D",i,sorted[i]); 2411447629fSBarry Smith } 2421447629fSBarry Smith 2431447629fSBarry Smith ierr = PetscFree(sorted);CHKERRQ(ierr); 2441447629fSBarry Smith } 2451447629fSBarry Smith 2461447629fSBarry Smith /* generate a list of application and PETSc node numbers */ 247580bdb30SBarry Smith ierr = PetscCalloc2(N, &aobasic->app,N,&aobasic->petsc);CHKERRQ(ierr); 2483bb1ff40SBarry Smith ierr = PetscLogObjectMemory((PetscObject)ao,2*N*sizeof(PetscInt));CHKERRQ(ierr); 2491447629fSBarry Smith for (i = 0; i < N; i++) { 2501447629fSBarry Smith ip = allpetsc[i]; 2511447629fSBarry Smith ia = allapp[i]; 2521447629fSBarry Smith /* check there are no duplicates */ 2531447629fSBarry Smith if (aobasic->app[ip]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Duplicate in PETSc ordering at position %d. Already mapped to %d, not %d.", i, aobasic->app[ip]-1, ia); 2541447629fSBarry Smith aobasic->app[ip] = ia + 1; 2551447629fSBarry Smith if (aobasic->petsc[ia]) SETERRQ3(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Duplicate in Application ordering at position %d. Already mapped to %d, not %d.", i, aobasic->petsc[ia]-1, ip); 2561447629fSBarry Smith aobasic->petsc[ia] = ip + 1; 2571447629fSBarry Smith } 2581447629fSBarry Smith if (napp && !mypetsc) { 2591447629fSBarry Smith ierr = PetscFree(petsc);CHKERRQ(ierr); 2601447629fSBarry Smith } 2611447629fSBarry Smith ierr = PetscFree2(allpetsc,allapp);CHKERRQ(ierr); 2621447629fSBarry Smith /* shift indices down by one */ 2631447629fSBarry Smith for (i = 0; i < N; i++) { 2641447629fSBarry Smith aobasic->app[i]--; 2651447629fSBarry Smith aobasic->petsc[i]--; 2661447629fSBarry Smith } 2671447629fSBarry Smith 2681447629fSBarry Smith ierr = ISRestoreIndices(isapp,&myapp);CHKERRQ(ierr); 2691447629fSBarry Smith if (napp) { 2701447629fSBarry Smith if (ispetsc) { 2711447629fSBarry Smith ierr = ISRestoreIndices(ispetsc,&mypetsc);CHKERRQ(ierr); 2721447629fSBarry Smith } else { 2731447629fSBarry Smith ierr = PetscFree(petsc);CHKERRQ(ierr); 2741447629fSBarry Smith } 2751447629fSBarry Smith } 2761447629fSBarry Smith PetscFunctionReturn(0); 2771447629fSBarry Smith } 2781447629fSBarry Smith 2791447629fSBarry Smith /*@C 2801447629fSBarry Smith AOCreateBasic - Creates a basic application ordering using two integer arrays. 2811447629fSBarry Smith 282d083f849SBarry Smith Collective 2831447629fSBarry Smith 2841447629fSBarry Smith Input Parameters: 2851447629fSBarry Smith + comm - MPI communicator that is to share AO 2861447629fSBarry Smith . napp - size of integer arrays 2871447629fSBarry Smith . myapp - integer array that defines an ordering 2881447629fSBarry Smith - mypetsc - integer array that defines another ordering (may be NULL to 2891447629fSBarry Smith indicate the natural ordering, that is 0,1,2,3,...) 2901447629fSBarry Smith 2911447629fSBarry Smith Output Parameter: 2921447629fSBarry Smith . aoout - the new application ordering 2931447629fSBarry Smith 2941447629fSBarry Smith Level: beginner 2951447629fSBarry Smith 29695452b02SPatrick Sanan Notes: 29795452b02SPatrick Sanan the arrays myapp and mypetsc must contain the all the integers 0 to napp-1 with no duplicates; that is there cannot be any "holes" 2981447629fSBarry Smith in the indices. Use AOCreateMapping() or AOCreateMappingIS() if you wish to have "holes" in the indices. 2991447629fSBarry Smith 3001447629fSBarry Smith .seealso: AOCreateBasicIS(), AODestroy(), AOPetscToApplication(), AOApplicationToPetsc() 3011447629fSBarry Smith @*/ 3021447629fSBarry Smith PetscErrorCode AOCreateBasic(MPI_Comm comm,PetscInt napp,const PetscInt myapp[],const PetscInt mypetsc[],AO *aoout) 3031447629fSBarry Smith { 3041447629fSBarry Smith PetscErrorCode ierr; 3051447629fSBarry Smith IS isapp,ispetsc; 3061447629fSBarry Smith const PetscInt *app=myapp,*petsc=mypetsc; 3071447629fSBarry Smith 3081447629fSBarry Smith PetscFunctionBegin; 3091447629fSBarry Smith ierr = ISCreateGeneral(comm,napp,app,PETSC_USE_POINTER,&isapp);CHKERRQ(ierr); 3101447629fSBarry Smith if (mypetsc) { 3111447629fSBarry Smith ierr = ISCreateGeneral(comm,napp,petsc,PETSC_USE_POINTER,&ispetsc);CHKERRQ(ierr); 3121447629fSBarry Smith } else { 3131447629fSBarry Smith ispetsc = NULL; 3141447629fSBarry Smith } 3151447629fSBarry Smith ierr = AOCreateBasicIS(isapp,ispetsc,aoout);CHKERRQ(ierr); 3161447629fSBarry Smith ierr = ISDestroy(&isapp);CHKERRQ(ierr); 3171447629fSBarry Smith if (mypetsc) { 3181447629fSBarry Smith ierr = ISDestroy(&ispetsc);CHKERRQ(ierr); 3191447629fSBarry Smith } 3201447629fSBarry Smith PetscFunctionReturn(0); 3211447629fSBarry Smith } 3221447629fSBarry Smith 3231447629fSBarry Smith /*@C 3241447629fSBarry Smith AOCreateBasicIS - Creates a basic application ordering using two index sets. 3251447629fSBarry Smith 3261447629fSBarry Smith Collective on IS 3271447629fSBarry Smith 3281447629fSBarry Smith Input Parameters: 3291447629fSBarry Smith + isapp - index set that defines an ordering 3301447629fSBarry Smith - ispetsc - index set that defines another ordering (may be NULL to use the 3311447629fSBarry Smith natural ordering) 3321447629fSBarry Smith 3331447629fSBarry Smith Output Parameter: 3341447629fSBarry Smith . aoout - the new application ordering 3351447629fSBarry Smith 3361447629fSBarry Smith Level: beginner 3371447629fSBarry Smith 33895452b02SPatrick Sanan Notes: 33995452b02SPatrick Sanan the index sets isapp and ispetsc must contain the all the integers 0 to napp-1 (where napp is the length of the index sets) with no duplicates; 3401447629fSBarry Smith that is there cannot be any "holes" 3411447629fSBarry Smith 3421447629fSBarry Smith .seealso: AOCreateBasic(), AODestroy() 3431447629fSBarry Smith @*/ 3441447629fSBarry Smith PetscErrorCode AOCreateBasicIS(IS isapp,IS ispetsc,AO *aoout) 3451447629fSBarry Smith { 3461447629fSBarry Smith PetscErrorCode ierr; 3471447629fSBarry Smith MPI_Comm comm; 3481447629fSBarry Smith AO ao; 3491447629fSBarry Smith 3501447629fSBarry Smith PetscFunctionBegin; 3511447629fSBarry Smith ierr = PetscObjectGetComm((PetscObject)isapp,&comm);CHKERRQ(ierr); 3521447629fSBarry Smith ierr = AOCreate(comm,&ao);CHKERRQ(ierr); 3531447629fSBarry Smith ierr = AOSetIS(ao,isapp,ispetsc);CHKERRQ(ierr); 3541447629fSBarry Smith ierr = AOSetType(ao,AOBASIC);CHKERRQ(ierr); 355817ea411SJed Brown ierr = AOViewFromOptions(ao,NULL,"-ao_view");CHKERRQ(ierr); 3561447629fSBarry Smith *aoout = ao; 3571447629fSBarry Smith PetscFunctionReturn(0); 3581447629fSBarry Smith } 3591447629fSBarry Smith 360