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: #undef __FUNCT__
7: /*@C
8: AODataKeyPartition - Partitions a key across the processors to reduce
9: communication costs.
11: Collective on AOData
13: Input Parameters:
14: + aodata - the database
15: - key - the key you wish partitioned and renumbered
17: Level: advanced
19: .seealso: AODataSegmentPartition()
20: @*/
21: int AODataKeyPartition(AOData aodata,char *key)
22: {
23: AO ao;
24: Mat adj;
25: MatPartitioning part;
26: IS is,isg;
27: int ierr;
28: MPI_Comm comm;
32: PetscObjectGetComm((PetscObject)aodata,&comm);
34: AODataKeyGetAdjacency(aodata,key,&adj);
35: MatPartitioningCreate(comm,&part);
36: MatPartitioningSetAdjacency(part,adj);
37: MatPartitioningSetFromOptions(part);
38: MatPartitioningApply(part,&is);
39: MatPartitioningDestroy(part);
40: MatDestroy(adj);
41: ISPartitioningToNumbering(is,&isg);
42: ISDestroy(is);
44: AOCreateBasicIS(isg,PETSC_NULL,&ao);
45: ISDestroy(isg);
47: AODataKeyRemap(aodata,key,ao);
48: AODestroy(ao);
49: return(0);
50: }