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.\n\n";
5: #include petscao.h
9: int main(int argc,char **argv)
10: {
11: AOData aodata;
12: PetscViewer binary;
13: int ierr,indices[4],*intv,i,rank;
15: PetscInitialize(&argc,&argv,(char*)0,help);
16: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
18: /*
19: Load the database from the file
20: */
21: PetscViewerBinaryOpen(PETSC_COMM_WORLD,"dataoutput",PETSC_BINARY_RDONLY,&binary);
22: AODataLoadBasic(binary,&aodata);
23: PetscViewerDestroy(binary);
25: /*
26: Access part of the data
27: */
28: indices[0] = 0; indices[1] = 2; indices[2] = 1; indices[3] = 5;
29: AODataSegmentGet(aodata,"key1","seg1",4,indices,(void **)&intv);
30: for (i=0; i<4; i++) {
31: PetscSynchronizedPrintf(PETSC_COMM_WORLD,"[%d] %d %d\n",rank,i,intv[i]);
32: }
33: PetscSynchronizedFlush(PETSC_COMM_WORLD);
34: AODataSegmentRestore(aodata,"key1","seg1",4,indices,(void **)&intv);
35:
36: AODataDestroy(aodata);
38: PetscFinalize();
39: return 0;
40: }
41: