#include #include #include #include "H5Part.h" #include #include #include #include using namespace std; /* A simple regression test that shows how you use this API to write and read multi-timestep files of particle data. */ int ReadFile(const string fn){ char name[64]; h5_file_t *file; int i,nt,nds; cout << "Open " << fn << endl; file= H5PartOpenFile(fn.c_str(),H5_O_RDONLY); nt=H5GetNumSteps(file); H5PartSetStep(file,0); nds=H5PartGetNumDatasets(file); cout << "Timesteps = " << nt << " dataSets per timestep = " << nds << endl; cout << endl << endl << "===============================" << endl; for(i=0;i1) str=argv[1]; else str=dstr; const string fn = string(str); /* f=fopen(fn.c_str(),"r"); if(f!=NULL) { a poor-man's stat() fclose(f); */ if(!WriteFile(fn)){ cerr << "Failed to write file " << fn << endl; exit(0); } /* } else { cout << "File " << fn << " already exists, so we will proceed to reading" << endl; } */ if(!ReadFile(fn)){ cerr << "Failed to read file " << fn << endl; } }