Actual source code: ex4.c
1: /*$Id: ex4.c,v 1.17 2001/04/10 19:37:18 bsmith Exp $*/
3: static char help[] = "Tests AOData loading.nn";
5: #include petscao.h
7: int main(int argc,char **argv)
8: {
9: AOData aodata;
10: PetscViewer binary;
11: int ierr,indices[4],*intv,i,rank;
13: PetscInitialize(&argc,&argv,(char*)0,help);
14: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
16: /*
17: Load the database from the file
18: */
19: PetscViewerBinaryOpen(PETSC_COMM_WORLD,"dataoutput",PETSC_BINARY_RDONLY,&binary);
20: AODataLoadBasic(binary,&aodata);
21: PetscViewerDestroy(binary);
23: /*
24: Access part of the data
25: */
26: indices[0] = 0; indices[1] = 2; indices[2] = 1; indices[3] = 5;
27: AODataSegmentGet(aodata,"key1","seg1",4,indices,(void **)&intv);
28: for (i=0; i<4; i++) {
29: PetscSynchronizedPrintf(PETSC_COMM_WORLD,"[%d] %d %dn",rank,i,intv[i]);
30: }
31: PetscSynchronizedFlush(PETSC_COMM_WORLD);
32: AODataSegmentRestore(aodata,"key1","seg1",4,indices,(void **)&intv);
33:
34: AODataDestroy(aodata);
36: PetscFinalize();
37: return 0;
38: }
39: