1 #include <mpi.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include "phIO.h"
6 #include "syncio.h"
7 #include "posixio.h"
8 #include <assert.h>
9
main(int argc,char * argv[])10 int main(int argc, char* argv[]) {
11 MPI_Init(&argc,&argv);
12 int rank;
13 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
14 const char* iotype = "binary";
15 int seven = 7;
16 int headerData[7] = {0,0,0,0,0,0,0};
17 int blocksRead = 0;
18 phio_fp file;
19 posixio_setup(&file, 'r');
20 phio_openfile("geombc.dat.", file);
21 for(int i=0;i<2;i++) {
22 phio_readheader(file, "connectivity interior",
23 headerData, &seven, "integer", iotype);
24 assert(headerData[0] > 0 && headerData[3] > 0);
25 int size = headerData[0]*headerData[3]; /* neltp*nshl */
26 int* vals = (int*) calloc(size,sizeof(int));
27 phio_readdatablock(file,"connectivity interior",vals,&size,"integer",iotype);
28 free(vals);
29 blocksRead += (headerData[0] > 0);
30 }
31 phio_closefile(file);
32 MPI_Finalize();
33 return !(blocksRead==2);
34 }
35