diff --git a/.gitattributes b/.gitattributes index a16b3ce..db782e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -28,9 +28,10 @@ doc/H5PartVisIt/cloud_visit_2D.png -text doc/H5PartVisIt/cloud_visit_2D.s.png -text doc/H5PartVisIt/visit_query1.png -text doc/H5PartVisIt/visit_query1.s.png -text -doc/H5tools/H5tools.htm -text +doc/H5tools/H5tools.html -text doc/H5tools/H5tools_files/snapshot1.jpg -text doc/InternalLayout.html -text +doc/Makefile.am -text doc/UsingC.html -text doc/UsingF.html -text doc/collision_6.png -text @@ -49,22 +50,16 @@ src/H5BlockF.c -text src/H5BlockF90.inc -text src/H5BlockPrivate.h -text src/H5BlockTypes.h -text -src/H5Part++.cc -text -src/H5Part++.hh -text src/H5Part.c -text -src/H5Part.cc -text src/H5Part.h -text -src/H5Part.hh -text src/H5PartErrors.h -text src/H5PartF.c -text src/H5PartF90.inc -text src/H5PartPrivate.h -text src/H5PartTypes.h -text -src/H5Units.h -text src/Makefile.am -text src/TestUnderscore.f -text src/TestUnderscoreC.c -text -src/addToDoxygenMainPage.h -text test/Bench.c -text test/BlockTestSpecs.txt -text test/H5BlockDissolveGhosts.c -text @@ -77,7 +72,6 @@ test/H5ParallelTest.cc -text test/H5PartAndreasTest.cc -text test/H5PartTest.cc -text test/H5PartTestParallel.cc -text -test/H5ecloudExample.cc -text test/H5test.cc -text test/H5testF.f -text test/H5testFpar.f90 -text @@ -86,7 +80,6 @@ tools/Makefile.am -text tools/README -text tools/h5pAttrib.cc -text tools/h5pToGNUplot.cc -text -tools/h5pToGNUplot.py -text visit_plugins/databases/H5Part/.depend -text visit_plugins/databases/H5Part/Makefile -text visit_plugins/databases/H5Part/README.txt -text diff --git a/doc/H5tools/H5tools.htm b/doc/H5tools/H5tools.html similarity index 100% rename from doc/H5tools/H5tools.htm rename to doc/H5tools/H5tools.html diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..67b3a40 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,7 @@ +EXTRA_DIST = \ + Doxyfile doxyfooter \ + $(wildcard *.html) \ + $(wildcard *.png) \ + $(wildcard H5PartVisIt/*.png) \ + $(wildcard H5tools/*.html) \ + $(wildcard H5tools/H5tools_files/*.jpg) diff --git a/src/H5Part++.cc b/src/H5Part++.cc deleted file mode 100755 index 821ff11..0000000 --- a/src/H5Part++.cc +++ /dev/null @@ -1,234 +0,0 @@ -#include -#include -#include -#include -#include "H5Part++.hh" - -#include -#include -#include -#include -using namespace std; - -#ifdef READTEST - -/* - A simple regression test that shows how you use this API - to write and read multi-timestep files of particle data. -*/ -#ifdef PARALLEL_IO - - -#else - -int main(int argc,char **argv){ - const int sz=5; - double x[sz],y[sz],z[sz]; - long long id[sz]; - char name[64]; - H5PartFile *file; - int i,t,nt,nds,myproc; - int nfattribs,nsattribs; - - const string fn = string(argv[1]); - - cout << "Open " << fn << endl; - - - file= H5PartOpenFile(fn.c_str(),H5PART_READ); - nt=H5PartGetNumSteps(file); /* get number of steps in file */ - H5PartSetStep(file,0); - nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */ - - - - puts("\n\n==============================="); - for(i=0;ifile); - H5PartSetStep(file,t); /* must set the current timestep in file */ - H5PartSetNumParticles(file,sz); /* then set number of particles to store */ - /* now write different tuples of data into this timestep of the file */ - H5PartWriteDataFloat64(file,"x",x); - H5PartWriteDataFloat64(file,"y",y); - H5PartWriteDataFloat64(file,"z",z); - H5PartWriteDataInt64(file,"id",id); - } - printf("AllDone p[%u]\n",myproc); - H5PartCloseFile(file); - MPI_Barrier(comm); - printf("p[%u:%u] : OK, close file and reopen for reading \n",myproc,nprocs); - if(myproc==0){ /* now only proc 0 reads the file serially */ - file= H5PartOpenFileSerial("parttest.h5",H5PART_READ); - nt=H5PartGetNumSteps(file); /* get number of steps in file */ - H5PartSetStep(file,0); - nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */ - - puts("\n\n==============================="); - for(i=0;i0){ - char attrname[32]; - H5PartGetStepAttribInfo(file,0,attrname,32,0,0); - printf("First Attrib name is [%s]\n",attrname); - } - H5PartReadParticleStep(file,t,/* do a mongo read of all data this step */ - x,y,z,id); - printf("\tid\t\tx\t\ty\t\tz\n"); - puts("\t----------------------------------------------------"); - for(i=0;i -#endif -} - -/* Add any C++ specific extensions/implementations/wrappers here */ - -/* here is a sample class wrapping of H5Part for C++ usage */ - -class H5ParticleFile { - H5PartFile *file; - long long np; -public: - H5ParticleFile(const char *filename,const int flags):np(0){ - this->file=H5PartOpenFile(filename,flags); - } - - // H5ParticleFile(const std::string fn,const int flags):np(0){ - // this->file=H5PartOpenFile(fn.cstr(),flags); - //} - -#ifdef PARALLEL_IO - H5ParticleFile(const char *filename,const int flags,const MPI_Comm comm):np(0){ - this->file=H5PartOpenFileParallel(filename,flags,comm); - } - // H5ParticleFile(const string fn,const int flags,const MPI_Comm comm):np(0){ - // this->file=H5PartOpenFile(fn.cstr(),flags,comm); - //} -#endif - inline int isValid() { return H5PartFileIsValid(this->file);} - - ~H5ParticleFile(){H5PartCloseFile(this->file);} - - inline void setNumParticles(long long nparticles){ - np=nparticles; - H5PartSetNumParticles(file,nparticles); - } - // get the current step (-1 means step is invalid) - inline int step(){ return file->timestep; } - // set the current step - inline int step(int s){ H5PartSetStep(this->file,s); return file->timestep; } - inline int nSteps(){ return H5PartGetNumSteps(this->file);} - inline int nFields(){ return H5PartGetNumDatasets(file);} - inline int fieldName(int index,char *name,int maxlen){H5PartGetDatasetName(file,index,name,maxlen);} - inline long long nParticles(){return H5PartGetNumParticles(file);} - inline int write(char *name,double *array){ - return H5PartWriteDataFloat64(this->file,name,array); - } - inline int write(char *name,long long *array){ - return H5PartWriteDataInt64(this->file,name,array); - } - inline int read(char *name,double *array){ - return H5PartReadDataFloat64(this->file,name,array); - } - inline int read(char *name,long long *array){ - return H5PartReadDataInt64(this->file,name,array); - } - inline int readStep(int step, - double *x,double *y,double *z, - double *px,double *py,double *pz, - long long *id){ - return H5PartReadParticleStep(file,step, - x,y,z, - px,py,pz, - id); - } - - // Attribute stuff - // Info on attributes - inline int nStepAttribs(){ return H5PartGetNumStepAttribs(file);} - inline void getStepAttribInfo(int idx,char *name,size_t maxsize, - hid_t &type,int &nelem){ - H5PartGetStepAttribInfo(file,idx,name,maxsize,&type,&nelem); - } - inline int nFileAttribs(){ return H5PartGetNumFileAttribs(file);} - inline void getFileAttribInfo(int idx,char *name,size_t maxsize, - hid_t &type,int &nelem){ - H5PartGetFileAttribInfo(file,idx,name,maxsize,&type,&nelem); - } - // step attribs - // int writeStepAttrib(char *key,string *valuestring){ - // return H5PartWriteStepAttribString(file,key,valuestring.c_str()); - //} - inline int writeStepAttrib(char *key,char *valuestring){ - return H5PartWriteStepAttribString(file,key,valuestring); - } - inline int writeStepAttrib(char *key,double *value,int nelem=1){ - return H5PartWriteStepAttrib(file,key,H5T_NATIVE_DOUBLE,value,nelem); - } - inline int writeStepAttrib(char *key,float *value,int nelem=1){ - return H5PartWriteStepAttrib(file,key,H5T_NATIVE_FLOAT,value,nelem);} - inline int writeStepAttrib(char *key,int *value,int nelem=1){ - return H5PartWriteStepAttrib(file,key,H5T_NATIVE_INT,value,nelem);} - inline int writeStepAttrib(char *key,long long *value,int nelem=1){ - return H5PartWriteStepAttrib(file,key,H5T_NATIVE_INT64,value,nelem);} - inline void readStepAttrib(char *key,void *value){ - H5PartReadStepAttrib(file,key,value); - } - // FileAttribs - // Attribute stuff - // int writeFileAttrib(char *key,string *valuestring){ - // return H5PartWriteFileAttribString(file,key,valuestring.c_str()); - //} - inline int writeFileAttrib(char *key,char *valuestring){ - return H5PartWriteFileAttribString(file,key,valuestring); - } - inline int writeFileAttrib(char *key,double *value,int nelem=1){ - return H5PartWriteFileAttrib(file,key,H5T_NATIVE_DOUBLE,value,nelem); - } - inline int writeFileAttrib(char *key,float *value,int nelem=1){ - return H5PartWriteFileAttrib(file,key,H5T_NATIVE_FLOAT,value,nelem);} - inline int writeFileAttrib(char *key,int *value,int nelem=1){ - return H5PartWriteFileAttrib(file,key,H5T_NATIVE_INT,value,nelem);} - inline int writeFileAttrib(char *key,long long *value,int nelem=1){ - return H5PartWriteFileAttrib(file,key,H5T_NATIVE_INT64,value,nelem);} - // read file attribs - inline int readFileAttrib(char *key,void *valuestring){ - H5PartReadFileAttrib(file,key,valuestring); - } -}; - -/* - An even wackier idea - file.datasets[0:ndatasets-1] - file.attributes[0:nfileattribs-1] - file.datasets.attributes[0:ndatasetattribs-1] - file.datasets.size() - - operators - .size() - .name() - [idx] - ["name" or "keyname"] - -*/ -#if 0 - -class H5Dataset { - const hid_t dataset; - char *n; // return as const - int d[5]; // simple start - int nd; -public: - H5Dataset(const hid_t ds_handle):dataset(ds_handle){} - const char *name() {return n;} - int nDims(){ return nd; } - const int *dims(){return d;} -}; - -class H5Attribute{ - char *n; - int sz; -public: - const char *name(){return n;} - int size(){return sz;} -} - - -class H5Group { - hid_t gid; - int sz; -protected: - virtual int computesize(){} - void setGroup(gid_t g){ - if(gid>0) H5close(gid); - gid=g; - // must compute size if available - if(gid>0) computesize(); - else sz=0; - } -public: - // const hid_t gid; - H5Group(hid_t g):gid(g){} - H5Group():gid(-1){} - ~H5Group(){if(gid>0) H5Gclose(gid);} - int size(){return sz;} -}; - -class H5AttribGroup : public H5Group{ - int size; - virtual void computesize(){ - // compute the number of items in this group - } -public: - const H5Attribute &operator[](char *name); - const H5Attribute &operator[](int idx); -}; - -class H5DataGroup : public H5Group { - int size; -public: - const H5Dataset &operator[](int idx); - const H5Dataset &operator[](char *name); - // no name here?? -}; - -class H5FancyParticles { - char *n; - hid_t file; -public: - hid_t mygroup; - const H5AttribGroup attributes; - const H5DataGroup datasets; - H5FancyParticles(char *filename,int readwriteflag); - ~H5FancyParticles(); - // int size();// return the number of datasets in file - // const char *name(); // return the name of the file? - // const H5Dataset &operator[](int idx); // index dataset by integer - // const H5Dataset &operator[](char *n); // index dataset by name -}; - -#endif - -#endif diff --git a/src/H5Part.cc b/src/H5Part.cc deleted file mode 100755 index 5f91914..0000000 --- a/src/H5Part.cc +++ /dev/null @@ -1,234 +0,0 @@ -#include -#include -#include -#include -#include "H5Part.hh" - -#include -#include -#include -#include -using namespace std; - -#ifdef READTEST - -/* - A simple regression test that shows how you use this API - to write and read multi-timestep files of particle data. -*/ -#ifdef PARALLEL_IO - - -#else - -int main(int argc,char **argv){ - const int sz=5; - double x[sz],y[sz],z[sz]; - long long id[sz]; - char name[64]; - H5PartFile *file; - int i,t,nt,nds,myproc; - int nfattribs,nsattribs; - - const string fn = string(argv[1]); - - cout << "Open " << fn << endl; - - - file= H5PartOpenFile(fn.c_str(),H5PART_READ); - nt=H5PartGetNumSteps(file); /* get number of steps in file */ - H5PartSetStep(file,0); - nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */ - - - - puts("\n\n==============================="); - for(i=0;ifile); - H5PartSetStep(file,t); /* must set the current timestep in file */ - H5PartSetNumParticles(file,sz); /* then set number of particles to store */ - /* now write different tuples of data into this timestep of the file */ - H5PartWriteDataFloat64(file,"x",x); - H5PartWriteDataFloat64(file,"y",y); - H5PartWriteDataFloat64(file,"z",z); - H5PartWriteDataInt64(file,"id",id); - } - printf("AllDone p[%u]\n",myproc); - H5PartCloseFile(file); - MPI_Barrier(comm); - printf("p[%u:%u] : OK, close file and reopen for reading \n",myproc,nprocs); - if(myproc==0){ /* now only proc 0 reads the file serially */ - file= H5PartOpenFileSerial("parttest.h5",H5PART_READ); - nt=H5PartGetNumSteps(file); /* get number of steps in file */ - H5PartSetStep(file,0); - nds=H5PartGetNumDatasets(file); /* get number of datasets in timestep 0 */ - - puts("\n\n==============================="); - for(i=0;i0){ - char attrname[32]; - H5PartGetStepAttribInfo(file,0,attrname,32,0,0); - printf("First Attrib name is [%s]\n",attrname); - } - H5PartReadParticleStep(file,t,/* do a mongo read of all data this step */ - x,y,z,x,y,z,id); - printf("\tid\t\tx\t\ty\t\tz\n"); - puts("\t----------------------------------------------------"); - for(i=0;iH5Part: a Portable High Performance Parallel Data Interface to HDF5 - -

- -Particle based simulations of accelerator beam-lines, especially in six dimensional phase space, generate vast amounts of data. -Even though a subset of statistical information regarding phase space or analysis needs to be preserved, reading and writing such enormous restart -files on massively parallel supercomputing systems remains challenging. -

-H5Part consists of Particles, Block structured Fields and unstructured data (Topo).

-Developed by . - -

-For further information contact: xxxxxx - -xxxx xxxxx, (xxx) xxx. -

-Last modified on xxx xx, 2006. -

-Papers: -

-LBNL Vis Group
-*/ - - diff --git a/test/H5ecloudExample.cc b/test/H5ecloudExample.cc deleted file mode 100755 index 1d64731..0000000 --- a/test/H5ecloudExample.cc +++ /dev/null @@ -1,63 +0,0 @@ -#ifdef GTHDF5 -template void DataSink::savePhaseSpaceData() -{ - T *x=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - T *y=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - T *z=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - T *px=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - T *py=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - T *pz=(double*)malloc(beam_m->getLocalNum()*sizeof(double)); - h5part_int64_t int *id=(h5part_int64_t int*)malloc(beam_m->getLocalNum()*sizeof(h5part_int64_t)); - - double actPos = beam_m->getActSPos(); - double structLenght = beam_m->getMaxZ(); - Vector_t org = beam_m->getOrigin(); - Vector_t maxX = beam_m->getRmax(); - Vector_t minX = beam_m->getRmin(); - Vector_t maxP = beam_m->getPmax(); - Vector_t minP = beam_m->getPmin(); - unsigned long protons = beam_m->getNumberOfProtons(); - unsigned long electrons = beam_m->getNumberOfElectrons(); - Vector_t centroid = beam_m->getCentroid(); - unsigned nTot = beam_m->getTotalNum(); - for (h5part_int64_t i=0; igetLocalNum();i++) { - x[i] = beam_m->R[i](0); - y[i] = beam_m->R[i](1); - z[i] = beam_m->R[i](2); - px[i] = beam_m->P[i](0); - py[i] = beam_m->P[i](1); - pz[i] = beam_m->P[i](2); - if (i< (electrons-1)) - id[i] = beam_m->ID[i]; else - id[i] = -1*(long int)beam_m->ID[i]; - } - H5PartSetStep(file_m,idx_m); /* must set the current timestep in file */ - H5PartSetNumParticles(file_m,beam_m->getLocalNum()); /* then set number of particles to store */ - /* now write different tuples of data into this timestep of the file */ - H5PartWriteDataFloat64(file_m,"x",x); - H5PartWriteDataFloat64(file_m,"y",y); - H5PartWriteDataFloat64(file_m,"z",z); - H5PartWriteDataFloat64(file_m,"px",px); - H5PartWriteDataFloat64(file_m,"py",py); - H5PartWriteDataFloat64(file_m,"pz",pz); - H5PartWriteDataInt64(file_m,"id",id); - h5part_int64_t step = idx_m; - H5PartWriteStepAttrib(file_m,"Step",H5T_NATIVE_INT64,&step,1); - - - /* write scalar data i.e the header */ - H5PartWriteAttrib(file_m,"Spos",H5T_NATIVE_DOUBLE,&actPos,1); - H5PartWriteAttrib(file_m,"structLen",H5T_NATIVE_DOUBLE,&structLenght,1); - - H5PartWriteAttrib(file_m,"org",H5T_NATIVE_DOUBLE,&org,3); - H5PartWriteAttrib(file_m,"maxX",H5T_NATIVE_DOUBLE,&maxX,3); - H5PartWriteAttrib(file_m,"minX",H5T_NATIVE_DOUBLE,&minX,3); - H5PartWriteAttrib(file_m,"maxP",H5T_NATIVE_DOUBLE,&maxP,3); - H5PartWriteAttrib(file_m,"minP",H5T_NATIVE_DOUBLE,&minP,3); - H5PartWriteAttrib(file_m,"centroid",H5T_NATIVE_DOUBLE,¢roid,3); - delete x; - delete y; - delete z; - delete id; - idx_m++; -} diff --git a/tools/h5pToGNUplot.py b/tools/h5pToGNUplot.py deleted file mode 100755 index 9b3d54d..0000000 --- a/tools/h5pToGNUplot.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/python - -import string, sys -sys.path.append('../src/') -import H5Part -from optparse import OptionParser - - -parser = OptionParser() - -print_all=0 - -parser.add_option("-1", "--1var", dest="var_1", - help="(REQUIRED) Takes first variable parameter") - -parser.add_option("-2", "--2var", dest="var_2", - help="(REQUIRED) Takes second variable parameter") - -parser.add_option("-i", "--input", dest="input_file", - help="(REQUIRED) Takes input file name") - -parser.add_option("-t", "--timestep", dest="timestep", type="int", - help="(REQUIRED) Sets the timestep (Value -1 will result in dumping values of all timesteps.)") - -parser.add_option("-o", "--output", dest="output_file", - help="(OPTIONAL) Takes output file name (without this flag, the program will print to stdout)") - -parser.add_option("-n", "--number", dest="nparticle", type="int", - help="(OPTIONAL) Sets number of output points") - -parser.add_option("-s", "--start", dest="start", type="int", - help="(OPTIONAL) Sets the starting particle index") - - -(options, args) = parser.parse_args() - -if options.timestep == -1: - print_all = 1 - -MAX_LEN = 100 -stop = 0 -start_indx = 0 - -h5file = H5Part.H5PartOpenFile(options.input_file, H5Part.H5PART_READ) - -if H5Part.H5PartFileIsValid(h5file)==0 : - print "unable to open input file" - parser.print_help() - sys.exit(1) - -j = options.timestep -ntime_step = j+1 - -if print_all == 1: - j=0 - ntime_step = H5Part.H5PartGetNumSteps(h5file) - -for j in range(j, ntime_step): - H5Part.H5PartSetStep(h5file,j) - num_dataset = H5Part.H5PartGetNumDatasets(h5file) - for i in range(0, num_dataset): - data_name, data_type, nparticle = H5Part.H5PartGetDatasetInfo(h5file, i, MAX_LEN) - if data_name == options.var_1: - type_1=data_type - if data_name == options.var_2: - type_2=data_type -# # # # # # # # # # # # # # # # I MUST FIND A WAY... hid_t & H5T_NATIVE_INT64 etc undefined problem... Currently treated as int... - -#temp = H5Part.hid_tArray(2) -#temp[0] = H5T_NATIVE_INT64 -#print temp[0] - -if type_1 == 201326626: # H5Part.H5T_NATIVE_INT64: - value_1 = H5Part.longArray(nparticle) - H5Part.H5PartReadDataInt64(h5file, options.var_1, value_1) -elif type_1 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - value_1 = H5Part.doubleArray(nparticle) - H5Part.H5PartReadDataFloat64(h5file, options.var_1, value_1) -else: - print "Dataset Type is UNKNOWN for %s. (Check the variable name.)\n" % options.var_1 - sys.exit(1) - -if type_2 == 201326626: # H5Part.H5T_NATIVE_INT64: - value_2 = H5Part.longArray(nparticle) - H5Part.H5PartReadDataInt64(h5file, options.var_2, value_2) -elif type_2 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - value_2 = H5Part.doubleArray(nparticle) - H5Part.H5PartReadDataFloat64(h5file, options.var_2, value_2) -else: - print "Dataset Type is UNKNOWN for %s. (Check the variable name.)\n" % options.var_2 - sys.exit(1) - - -if options.start != None: - start_indx = options.start - -if options.nparticle != None: - stop = options.nparticle + start_indx -else: - stop = nparticle - -if stop > nparticle: - stop = nparticle - -if options.output_file != None: - outFile = open(options.output_file,"w") - - for x in range(start_indx, stop): - if type_1 == 201326626: # H5Part.H5T_NATIVE_INT64: - outFile.write("%ld" % value_1[x]) - elif type_1 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - outFile.write("%lf" % value_1[x]) - - if type_2 == 201326626: # H5Part.H5T_NATIVE_INT64: - outFile.write("\t%ld" % value_2[x]) - outFile.write("\n") - elif type_2 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - outFile.write("\t%lf" % value_2[x]) - outFile.write("\n") - - outFile.write("\n") - outFile.close() - -else: - for y in range(start_indx, stop): - if type_1 == 201326626: # H5Part.H5T_NATIVE_INT64: - print "%ld" % value_1[y], - elif type_1 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - print "%lf" % value_1[y], - - if type_2 == 201326626: # H5Part.H5T_NATIVE_INT64: - print "\t%ld" % value_2[y] - elif type_2 == 201326635: # H5Part.H5T_NATIVE_DOUBLE: - print "\t%lf" % value_2[y] - - print "\n" - - -H5Part.H5PartCloseFile(h5file) - -# if __name__ == "__main__": -# print "I'M RUNNING AS A MAIN PROGRAM!!!"