Actual source code: aosetlocal.c
1: /*$Id: aosetlocal.c,v 1.13 2001/03/23 23:24:57 balay Exp $*/
3: #include petscao.h
5: /*@C
6: AODataPartitionAndSetupLocal - Partitions across a given key (for example cells), then partitions a segment
7: (for example vertices) subservient to that key.
9: Collective on AOData
11: Input Parameters:
12: + ao - the AO database
13: . keyname - the name of the key
14: - segmentname - the name of the segment
17: Output Parameters:
18: + iskey - the local indices in global numbering of the key entries (cells). Note that these are
19: contiguous from rstart to rend
20: . issegment - the local indices in global numbering of the segment entries (vertices)
21: - ltog - the local to global mapping for the segment entries (vertices)
23: Level: advanced
25: Notes: this renumbers the key and segment entries in the AO database to reflect the new partitioning.
26: The ltog mapping is a mapping for the issegment indices, that is ltog applied to the indices
27: 0 to sizeof(issegment)-1 is the entries in issegment.
29: .seealso: AODataKeyParition(), AODataSegmentPartition()
30: @*/
31: int AODataPartitionAndSetupLocal(AOData ao,char *keyname,char *segmentname,IS *iskey,IS *issegment,ISLocalToGlobalMapping *ltog)
32: {
33: ISLocalToGlobalMapping ltogkey;
34: int ierr,rstart,rend;
35: MPI_Comm comm;
39: /* Partition the keys (cells) */
40: AODataKeyPartition(ao,keyname);
42: /* Partition the segment (vertices) subservient to the keys (cells) */
43: AODataSegmentPartition(ao,keyname,segmentname);
45: /* Generate the list of key entries (cells) on this processor */
46: AODataKeyGetOwnershipRange(ao,"cell",&rstart,&rend);
47: PetscObjectGetComm((PetscObject)ao,&comm);
49: ISCreateStride(comm,rend-rstart,rstart,1,iskey);
51: /* Get the list of segment entries (vertices) used by these key entries (cells) */
52: AODataSegmentGetReducedIS(ao,keyname,segmentname,*iskey,issegment);
54: /* Make local to global mapping of key entries (cells) */
55: ISLocalToGlobalMappingCreateIS(*iskey,<ogkey);
57: /* Make local to global mapping of segment entries (vertices) */
58: ISLocalToGlobalMappingCreateIS(*issegment,ltog);
60: /* Attach the local to global mappings to the database */
61: AODataKeySetLocalToGlobalMapping(ao,keyname,ltogkey);
62: AODataKeySetLocalToGlobalMapping(ao,segmentname,*ltog);
64: /* Dereference the ltogkey; we don't need a copy of it */
65: PetscObjectDereference((PetscObject)ltogkey);
67: return(0);
68: }