Actual source code: aopart.c

 2:  #include petscao.h

  6: /*@C
  7:     AODataKeyPartition - Partitions a key across the processors to reduce
  8:     communication costs.

 10:     Collective on AOData

 12:     Input Parameters:
 13: +   aodata - the database
 14: -   key - the key you wish partitioned and renumbered

 16:    Level: advanced

 18: .seealso: AODataSegmentPartition()
 19: @*/
 20: PetscErrorCode AODataKeyPartition(AOData aodata,const char key[])
 21: {
 22:   AO              ao;
 23:   Mat             adj;
 24:   MatPartitioning part;
 25:   IS              is,isg;
 27:   MPI_Comm        comm;

 31:   PetscObjectGetComm((PetscObject)aodata,&comm);

 33:   AODataKeyGetAdjacency(aodata,key,&adj);
 34:   MatPartitioningCreate(comm,&part);
 35:   MatPartitioningSetAdjacency(part,adj);
 36:   MatPartitioningSetFromOptions(part);
 37:   MatPartitioningApply(part,&is);
 38:   MatPartitioningDestroy(part);
 39:   MatDestroy(adj);
 40:   ISPartitioningToNumbering(is,&isg);
 41:   ISDestroy(is);

 43:   AOCreateBasicIS(isg,PETSC_NULL,&ao);
 44:   ISDestroy(isg);

 46:   AODataKeyRemap(aodata,key,ao);
 47:   AODestroy(ao);
 48:   return(0);
 49: }