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: #undef __FUNCT__
7: /*@C
8: AODataPartitionAndSetupLocal - Partitions across a given key (for example cells), then partitions a segment
9: (for example vertices) subservient to that key.
11: Collective on AOData
13: Input Parameters:
14: + ao - the AO database
15: . keyname - the name of the key
16: - segmentname - the name of the segment
19: Output Parameters:
20: + iskey - the local indices in global numbering of the key entries (cells). Note that these are
21: contiguous from rstart to rend
22: . issegment - the local indices in global numbering of the segment entries (vertices)
23: - ltog - the local to global mapping for the segment entries (vertices)
25: Level: advanced
27: Notes: this renumbers the key and segment entries in the AO database to reflect the new partitioning.
28: The ltog mapping is a mapping for the issegment indices, that is ltog applied to the indices
29: 0 to sizeof(issegment)-1 is the entries in issegment.
31: .seealso: AODataKeyParition(), AODataSegmentPartition()
32: @*/
33: int AODataPartitionAndSetupLocal(AOData ao,char *keyname,char *segmentname,IS *iskey,IS *issegment,ISLocalToGlobalMapping *ltog)
34: {
35: ISLocalToGlobalMapping ltogkey;
36: int ierr,rstart,rend;
37: MPI_Comm comm;
41: /* Partition the keys (cells) */
42: AODataKeyPartition(ao,keyname);
44: /* Partition the segment (vertices) subservient to the keys (cells) */
45: AODataSegmentPartition(ao,keyname,segmentname);
47: /* Generate the list of key entries (cells) on this processor */
48: AODataKeyGetOwnershipRange(ao,"cell",&rstart,&rend);
49: PetscObjectGetComm((PetscObject)ao,&comm);
51: ISCreateStride(comm,rend-rstart,rstart,1,iskey);
53: /* Get the list of segment entries (vertices) used by these key entries (cells) */
54: AODataSegmentGetReducedIS(ao,keyname,segmentname,*iskey,issegment);
56: /* Make local to global mapping of key entries (cells) */
57: ISLocalToGlobalMappingCreateIS(*iskey,<ogkey);
59: /* Make local to global mapping of segment entries (vertices) */
60: ISLocalToGlobalMappingCreateIS(*issegment,ltog);
62: /* Attach the local to global mappings to the database */
63: AODataKeySetLocalToGlobalMapping(ao,keyname,ltogkey);
64: AODataKeySetLocalToGlobalMapping(ao,segmentname,*ltog);
66: /* Dereference the ltogkey; we don't need a copy of it */
67: PetscObjectDereference((PetscObject)ltogkey);
69: return(0);
70: }