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 9 int main(int argc, char* argv[]) { 10 MPI_Init(&argc,&argv); 11 int rank; 12 MPI_Comm_rank(MPI_COMM_WORLD, &rank); 13 const char* iotype = "binary"; 14 int seven = 7; 15 int headerData[7] = {0,0,0,0,0,0,0}; 16 int blocksRead = 0; 17 phio_fp file; 18 posixio_setup(&file, 'r'); 19 phio_openfile("geombc.dat.", file); 20 MPI_Barrier(MPI_COMM_WORLD); 21 do { 22 phio_readheader(file, "connectivity interior", 23 headerData, &seven, "integer", iotype); 24 fprintf(stderr, "rank %d data[0] %d\n", rank, headerData[0]); 25 blocksRead += (headerData[0] > 0); 26 } while( headerData[0] > 0 ); 27 phio_closefile(file); 28 MPI_Barrier(MPI_COMM_WORLD); 29 fprintf(stderr, "rank %d number of blocks read %d\n", rank, blocksRead); 30 MPI_Finalize(); 31 return (blocksRead==2); 32 } 33