00001 #ifndef _H5Part_H_
00002 #define _H5Part_H_
00003
00004 #include <hdf5.h>
00005 #ifdef PARALLEL_IO
00006 #include <mpi.h>
00007 #endif
00008
00016 typedef struct H5PartFile {
00017 hid_t file;
00018 int timestep;
00019
00020 hid_t timegroup;
00021 hid_t properties;
00022 hsize_t nparticles;
00023 hid_t shape;
00024 unsigned mode;
00025 int maxstep;
00026 hid_t xfer_prop,create_prop,access_prop;
00027 hid_t diskshape,memshape;
00028
00029 long long viewstart,viewend;
00030
00031 #ifdef PARALLEL_IO
00032 long long *pnparticles;
00033
00034
00035
00036
00037
00038 MPI_Comm comm;
00039 int nprocs,myproc;
00040 #endif
00041 }H5PartFile;
00042
00043 #define H5PART_READ 0x01
00044 #define H5PART_WRITE 0x02
00045
00046
00047 #ifdef PARALLEL_IO
00048 #include <mpi.h>
00049 H5PartFile *H5PartOpenFileParallel(const char *filename,
00050 unsigned flags,
00051 MPI_Comm communicator);
00052 #endif
00053 #define H5PartOpenFileSerial(x,y) H5PartOpenFile(x,y)
00054
00055 H5PartFile *H5PartOpenFile(const char *filename,
00056 unsigned flags);
00057 int H5PartFileIsValid(H5PartFile *f);
00058 void H5PartCloseFile(H5PartFile *f);
00059
00060
00061
00062 void H5PartSetNumParticles(H5PartFile *f,long long nparticles);
00063 int H5PartWriteDataFloat64(H5PartFile *f,char *name,double *array);
00064 int H5PartWriteDataInt64(H5PartFile *f,char *name,long long *array);
00065
00066
00067 void H5PartSetStep(H5PartFile *f,
00068 int step);
00069 int H5PartGetNumSteps(H5PartFile *f);
00070 int H5PartGetNumDatasets(H5PartFile *f);
00071 int H5PartGetDatasetName(H5PartFile *f,int index,char *name,int maxlen);
00072 long long H5PartGetNumParticles(H5PartFile *f);
00073 void H5PartSetView(H5PartFile *f,long long start,long long end);
00074 #define H5PartResetView(f) H5PartSetView(f,-1,-1)
00075 #define H5PartHasView(f) ((f->viewstart<0||f->viewend<0)?0:1)
00076 int H5PartGetView(H5PartFile *f,long long *start,long long *end);
00077 void H5PartSetCanonicalView(H5PartFile *f);
00078
00079 int H5PartReadDataFloat64(H5PartFile *f,
00080 char *name,
00081
00082
00083
00084 double *array);
00085 int H5PartReadDataInt64(H5PartFile *f,
00086 char *name,
00087
00088
00089
00090 long long *array);
00091
00092
00093 #if 0
00094 int H5PartReadData(H5PartFile *f,char *name,void *array,hid_t type);
00095 int H5PartWriteData(H5PartFile *f,char *name,void *array,hid_t type);
00096 #endif
00097 int H5PartReadParticleStep(H5PartFile *f,
00098 int step,
00099 double *x,double *y,double *z,
00100 double *px,double *py,double *pz,
00101 long long *id);
00102
00103
00104
00105
00106
00107
00108
00109
00110 int H5PartWriteStepAttrib(H5PartFile *f,char *name,
00111 hid_t type,void *attrib,int nelem);
00112 int H5PartWriteFileAttrib(H5PartFile *f,char *name,
00113 hid_t type,void *attrib,int nelem);
00114 int H5PartWriteAttrib(H5PartFile *f,char *name,
00115 hid_t type,void *attrib,int nelem);
00116
00117 int H5PartWriteFileAttribString(H5PartFile *f,char *name,
00118 char *attrib);
00119 int H5PartWriteStepAttribString(H5PartFile *f,char *name,
00120 char *attrib);
00121 int H5PartGetNumStepAttribs(H5PartFile *f);
00122 int H5PartGetNumFileAttribs(H5PartFile *f);
00123 void H5PartGetStepAttribInfo(H5PartFile *f,int idx,
00124 char *name,size_t maxnamelen,
00125 hid_t *type,int *nelem);
00126 void H5PartGetFileAttribInfo(H5PartFile *f,int idx,
00127 char *name,size_t maxnamelen,
00128 hid_t *type,int *nelem);
00129 int H5PartReadStepAttrib(H5PartFile *f,char *name,void *data);
00130 void H5PartReadAttrib(H5PartFile *f,char *name,void *data);
00131 int H5PartReadFileAttrib(H5PartFile *f,char *name,void *data);
00132
00133
00134
00135 int H5PartStashFile(H5PartFile *f,char *filename);
00136 int H5PartUnstashFile(H5PartFile *f, char *filename, char *outputpath);
00137 int H5PartGetNumStashFiles(H5PartFile *f);
00138 int H5PartFileGetStashFileName(H5PartFile *f,int nameindex,char *filename,int maxnamelen);
00139
00140
00141 #endif