Actual source code: aopart.c

  1: /*$Id: aopart.c,v 1.17 2001/03/23 23:24:57 balay Exp $*/

 3:  #include petscao.h

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

  9:     Collective on AOData

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

 15:    Level: advanced

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

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

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

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

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